Fix compilation warnings

This commit is contained in:
Pali Rohár committed 2012-06-23 17:39:33 +02:00
1 parent 58c0dbe275
commit 027a6d9a18
6 files changed
+15 -9

No files matched your search

+2 -2
View File
@@ -71,7 +71,7 @@ int uncompress_image(char *srcf, char *dstf)
src = malloc ( fsize ); src = malloc ( fsize );
dst = malloc ( width*height*2 ); dst = malloc ( width*height*2 );
deof = dst+width*height*2; deof = dst+width*height*2;
if ((int)src == -1 || (int)dst == -1 ) { if (src == (void *)-1 || dst == (void *)-1 ) {
printf("Cannot malloc\n"); printf("Cannot malloc\n");
return 1; return 1;
} }
@@ -105,7 +105,7 @@ int uncompress_image(char *srcf, char *dstf)
} }
} }
} }
fprintf(stderr, "Output Size: %d\n",dst2-dst); fprintf(stderr, "Output Size: %lld\n",(long long int)(dst2-dst));
if ((dst2-dst)!=(width*height*2)) if ((dst2-dst)!=(width*height*2))
fprintf(stderr, "failed?\n"); fprintf(stderr, "failed?\n");
+1 -1
View File
@@ -6,7 +6,7 @@ BIN=0xFFFF
#LIBS=`${HAVE_USB} && echo -- '-lusb'` #LIBS=`${HAVE_USB} && echo -- '-lusb'`
LIBS=`if [ "${HAVE_USB}" = 1 ]; then echo '-lusb'; fi` LIBS=`if [ "${HAVE_USB}" = 1 ]; then echo '-lusb'; fi`
CFLAGS+=-DVERSION=\"${VERSION}\" -Wall -I . CFLAGS+=-DVERSION=\"${VERSION}\" -Wall -I .
CFLAGS+=-pedantic -std=c99 -DHAVE_USB=${HAVE_USB} CFLAGS+=-pedantic -std=c99 -DHAVE_USB=${HAVE_USB} -Wno-unused-result
USBOBJ=../libusb/error.o ../libusb/usb.o ../libusb/descriptors.o USBOBJ=../libusb/error.o ../libusb/usb.o ../libusb/descriptors.o
USBOBJ+=../libusb/linux.o ## XXX not portable USBOBJ+=../libusb/linux.o ## XXX not portable
+2 -2
View File
@@ -37,7 +37,7 @@ int rf_extract(char *dev, off_t from, off_t to, char *file)
FILE *fd = fopen(file, "wb+"); FILE *fd = fopen(file, "wb+");
if (from>to) { if (from>to) {
printf("Bad range %lld - %lld for %s\n", from, to, file); printf("Bad range %lld - %lld for %s\n", (long long int)from, (long long int)to, file);
goto __rf_extract_exit; goto __rf_extract_exit;
} }
if (fs == NULL) { perror(dev); goto __rf_extract_exit; } if (fs == NULL) { perror(dev); goto __rf_extract_exit; }
@@ -56,7 +56,7 @@ int rf_extract(char *dev, off_t from, off_t to, char *file)
} }
printf("\r%s: %lld bytes dumped from %s\n", printf("\r%s: %lld bytes dumped from %s\n",
file, to-from, dev); file, (long long int)(to-from), dev);
__rf_extract_exit: __rf_extract_exit:
if (fs) fclose(fs); if (fs) fclose(fs);
+3 -1
View File
@@ -28,6 +28,8 @@
#include "main.h" #include "main.h"
#include "hash.h" #include "hash.h"
char *strdup(const char *s);
int (*fiasco_callback)(struct header_t *header) = NULL; int (*fiasco_callback)(struct header_t *header) = NULL;
int openfiasco(const char *name, const char *piece_grep, int v) int openfiasco(const char *name, const char *piece_grep, int v)
@@ -306,7 +308,7 @@ int fiasco_new(const char *filename, const char *swver)
{ {
int fd; int fd;
unsigned int len; unsigned int len;
uint8_t len8; unsigned char len8;
const char *str = "OSSO UART+USB"; const char *str = "OSSO UART+USB";
if (swver && strlen(swver)+1 > UINT8_MAX) { if (swver && strlen(swver)+1 > UINT8_MAX) {
+6 -2
View File
@@ -517,8 +517,12 @@ int main(int argc, char **argv)
} }
if (unpack) { if (unpack) {
if (reverseto) if (reverseto) {
chdir(reverseto); if (chdir(reverseto) < 0) {
printf("Error: Cannot change directory to %s\n", reverseto);
return 1;
}
}
unpack_fiasco_image(fiasco_image); unpack_fiasco_image(fiasco_image);
return 0; return 0;
} }
+1 -1
View File
@@ -89,7 +89,7 @@ _retry:
} }
pool = shmat(shmid, NULL, 0); pool = shmat(shmid, NULL, 0);
if (((int)pool) == -1) { if (pool == (void *)-1) {
perror("shmat"); perror("shmat");
return NULL; return NULL;
} }