Δημοσιεύτηκε: 01 Μαρ 2012, 03:39
από simosx
Προσπάθησα να διαβάσω τον κώδικα του προγράμματος. Τελικά έφτιαξα αποθετήριο στο
https://github.com/ubuntu-gr/hexview
όπου για τη μεταγλώττιση

Κώδικας: Επιλογή όλων
git clone git://github.com/ubuntu-gr/hexview.git
cd hexview
make


Οι προειδοποιήσεις που εμφανίζονται είναι

Κώδικας: Επιλογή όλων
hexview.c: In function ‘show_help’:
hexview.c:171:2: warning: null argument where non-null required (argument 1)
hexview.c:185:2: warning: null argument where non-null required (argument 1)
hexview.c: In function ‘show_header’:
hexview.c:243:2: warning: null argument where non-null required (argument 1)
hexview.c:255:4: warning: null argument where non-null required (argument 1)
hexview.c:260:4: warning: null argument where non-null required (argument 1)
hexview.c:271:4: warning: null argument where non-null required (argument 1)
hexview.c:275:4: warning: null argument where non-null required (argument 1)
hexview.c:286:3: warning: null argument where non-null required (argument 1)
hexview.c:289:3: warning: null argument where non-null required (argument 1)
hexview.c: In function ‘show_prompt’:
hexview.c:324:2: warning: null argument where non-null required (argument 1)
hexview.c:336:2: warning: null argument where non-null required (argument 1)
hexview.c:342:2: warning: null argument where non-null required (argument 1)
hexview.c:352:2: warning: null argument where non-null required (argument 1)
hexview.c:417:2: warning: null argument where non-null required (argument 1)
hexview.c:420:2: warning: null argument where non-null required (argument 1)
hexview.c: In function ‘view_row’:
hexview.c:457:10: warning: assignment makes integer from pointer without a cast
hexview.c:458:2: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:359:12: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
hexview.c:458:2: warning: format not a string literal and no format arguments
hexview.c:458:2: warning: null argument where non-null required (argument 1)
hexview.c:477:12: warning: assignment makes integer from pointer without a cast
hexview.c:478:4: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:359:12: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
hexview.c:478:4: warning: format not a string literal and no format arguments
hexview.c:478:4: warning: null argument where non-null required (argument 1)
hexview.c:484:12: warning: assignment makes integer from pointer without a cast
hexview.c:485:4: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:359:12: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
hexview.c:485:4: warning: format not a string literal and no format arguments
hexview.c:485:4: warning: null argument where non-null required (argument 1)
hexview.c:491:12: warning: assignment makes integer from pointer without a cast
hexview.c:492:4: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:359:12: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
hexview.c:492:4: warning: format not a string literal and no format arguments
hexview.c:492:4: warning: null argument where non-null required (argument 1)
hexview.c:511:12: warning: assignment makes integer from pointer without a cast
hexview.c:512:4: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:359:12: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
hexview.c:512:4: warning: format not a string literal and no format arguments
hexview.c:512:4: warning: null argument where non-null required (argument 1)
hexview.c:515:12: warning: assignment makes integer from pointer without a cast
hexview.c:516:4: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:359:12: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
hexview.c:516:4: warning: format not a string literal and no format arguments
hexview.c:516:4: warning: null argument where non-null required (argument 1)
hexview.c:519:12: warning: assignment makes integer from pointer without a cast
hexview.c:520:4: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:359:12: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
hexview.c:520:4: warning: format not a string literal and no format arguments
hexview.c:520:4: warning: null argument where non-null required (argument 1)
hexview.c: In function ‘do_command’:
hexview.c:603:3: warning: null argument where non-null required (argument 1)
hexview.c:649:16: warning: comparison between signed and unsigned integer expressions
hexview.c:682:16: warning: comparison between signed and unsigned integer expressions
hexview.c:703:15: warning: comparison between signed and unsigned integer expressions
hexview.c:754:3: warning: null argument where non-null required (argument 1)
hexview.c:778:3: warning: null argument where non-null required (argument 1)
hexview.c:816:3: warning: null argument where non-null required (argument 1)
hexview.c:850:3: warning: null argument where non-null required (argument 1)


Για την colorPRINTF(), γίνονται κλήσεις σε άλλες δύο #define, η μία καλεί την άλλη. Για την πιο εύκολη κατανόηση του κώδικα, μπορείτε να τρέξετε
Κώδικας: Επιλογή όλων
cpp hexview.c

Οι περισσότερες προειδοποιήσεις προέρχονται από εντολές τις μορφής printf('\0'), οπότε θα μπορούσαν να διορθωθούν γρήγορα.