Revision aba59705d963b79f5732f2265fa2175654b61db8 authored by Philippe Mathieu-Daudé on 04 June 2018, 15:14:20 UTC, committed by Michael Roth on 21 June 2018, 15:18:22 UTC
This fixes:

  hw/usb/dev-mtp.c:971:5: warning: 4th function call argument is an uninitialized value
      trace_usb_mtp_op_get_partial_object(s->dev.addr, o->handle, o->path,
                                           c->argv[1], c->argv[2]);
                                                       ^~~~~~~~~~
and:

  hw/usb/dev-mtp.c:981:12: warning: Assigned value is garbage or undefined
      offset = c->argv[1];
               ^ ~~~~~~~~~~

Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180604151421.23385-3-f4bug@amsat.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 62713a2e50f653162387451034f1a2490e87be88)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
1 parent 17e3fcb
Raw File
hxtool
#!/bin/sh

hxtoh()
{
    flag=1
    while read -r str; do
        case $str in
            HXCOMM*)
            ;;
            STEXI*|ETEXI*) flag=$(($flag^1))
            ;;
            *)
            test $flag -eq 1 && printf "%s\n" "$str"
            ;;
        esac
    done
}

print_texi_heading()
{
    if test "$*" != ""; then
        title="$*"
        printf "@subsection %s\n" "${title%:}"
    fi
}

hxtotexi()
{
    flag=0
    line=1
    while read -r str; do
        case "$str" in
            HXCOMM*)
            ;;
            STEXI*)
            if test $flag -eq 1 ; then
                printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
                exit 1
            fi
            flag=1
            ;;
            ETEXI*)
            if test $flag -ne 1 ; then
                printf "line %d: syntax error: expected STEXI, found '%s'\n" "$line" "$str" >&2
                exit 1
            fi
            flag=0
            ;;
            DEFHEADING*)
            print_texi_heading "$(expr "$str" : "DEFHEADING(\(.*\))")"
            ;;
            ARCHHEADING*)
            print_texi_heading "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
            ;;
            *)
            test $flag -eq 1 && printf '%s\n' "$str"
            ;;
        esac
        line=$((line+1))
    done
}

case "$1" in
"-h") hxtoh ;;
"-t") hxtotexi ;;
*) exit 1 ;;
esac

exit 0
back to top