diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-12-03 20:27:45 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-12-03 20:37:55 -0500 |
commit | 61d70de7f4ced76f8d4bd50247e2d2c6216b7619 (patch) | |
tree | 931115b45787ed0068f772872ad96f1390cfc621 | |
parent | d114429d88f7bc427425ed93d8bbcfba213ff52c (diff) | |
download | rockbox-61d70de7f4.tar.gz rockbox-61d70de7f4.zip |
tools: Fix up a bunch of compilation warnings
Plenty more to go.
Change-Id: I3f6e6686d3e581bb97493d40dcb7df74650ba96c
-rw-r--r-- | tools/mkboot.c | 27 | ||||
-rw-r--r-- | tools/rbspeex/rbspeex.c | 14 | ||||
-rw-r--r-- | utils/ipodpatcher/main.c | 36 | ||||
-rw-r--r-- | utils/sansapatcher/main.c | 12 | ||||
-rw-r--r-- | utils/themeeditor/gui/codeeditor.cpp | 5 |
5 files changed, 47 insertions, 47 deletions
diff --git a/tools/mkboot.c b/tools/mkboot.c index b305da2eae..3996029aa3 100644 --- a/tools/mkboot.c +++ b/tools/mkboot.c @@ -55,13 +55,13 @@ int main(int argc, char *argv[]) if ( ! strcmp(argv[1], "-h100")) return mkboot_iriver(argv[2], argv[3], argv[4], 0x1f0000); - + if ( ! strcmp(argv[1], "-h300")) return mkboot_iriver(argv[2], argv[3], argv[4], 0x3f0000); - + if ( ! strcmp(argv[1], "-iax5")) return mkboot_iaudio(argv[2], argv[3], argv[4], 0); - + if ( ! strcmp(argv[1], "-iam5")) return mkboot_iaudio(argv[2], argv[3], argv[4], 1); @@ -113,14 +113,13 @@ int mkboot_iriver(const char* infile, const char* bootfile, const char* outfile, fclose(f); return -3; } - + fclose(f); /* Now, read the boot loader into the image */ f = fopen(bootfile, "rb"); if(!f) { perror(bootfile); - fclose(f); return -4; } @@ -158,7 +157,7 @@ int mkboot_iriver(const char* infile, const char* bootfile, const char* outfile, image[0x20d] = (actual_length >> 16) & 0xff; image[0x20e] = (actual_length >> 8) & 0xff; image[0x20f] = actual_length & 0xff; - + image[0x21c] = (actual_length >> 24) & 0xff; image[0x21d] = (actual_length >> 16) & 0xff; image[0x21e] = (actual_length >> 8) & 0xff; @@ -179,17 +178,17 @@ int mkboot_iriver(const char* infile, const char* bootfile, const char* outfile, image[1] = (total_length >> 8) & 0xff; image[2] = (total_length >> 16) & 0xff; image[3] = (total_length >> 24) & 0xff; - + image[4] = binary_length & 0xff; image[5] = (binary_length >> 8) & 0xff; image[6] = (binary_length >> 16) & 0xff; image[7] = (binary_length >> 24) & 0xff; - + image[8] = num_chksums & 0xff; image[9] = (num_chksums >> 8) & 0xff; image[10] = (num_chksums >> 16) & 0xff; image[11] = (num_chksums >> 24) & 0xff; - + i = fwrite(image, 1, total_length, f); if(i < total_length) { perror(outfile); @@ -198,9 +197,9 @@ int mkboot_iriver(const char* infile, const char* bootfile, const char* outfile, } printf("Wrote 0x%x bytes in %s\n", total_length, outfile); - + fclose(f); - + return 0; } @@ -217,7 +216,7 @@ int mkboot_iriver(const char* infile, const char* bootfile, const char* outfile, * offset!) where we patch in the Rockbox loader */ #define ROCKBOX_BOOTLOADER 0x00150000 /* End of unused space in original firmware */ -#define BOOTLOADER_LIMIT 0x00170000 +#define BOOTLOADER_LIMIT 0x00170000 /* Patch the Rockbox bootloader into free space in the original firmware * (starting at 0x150000). The preloader starts execution of the OF at @@ -254,12 +253,12 @@ int mkboot_iaudio(const char* infile, const char* bootfile, const char* outfile, fprintf(stderr, "Rockbox bootloader is too big.\n"); return 1; } - + if ((ffile = fopen(infile, "rb")) == NULL) { perror("Cannot open original firmware file."); return 1; } - + fseek(ffile, 0, SEEK_END); flength = ftell(ffile); fseek(ffile, 0, SEEK_SET); diff --git a/tools/rbspeex/rbspeex.c b/tools/rbspeex/rbspeex.c index 66b8aeb19c..7ffecb1a35 100644 --- a/tools/rbspeex/rbspeex.c +++ b/tools/rbspeex/rbspeex.c @@ -143,6 +143,10 @@ bool encode_file(FILE *fin, FILE *fout, float quality, int complexity, int a; #endif + numchan = 0; + bps = 0; + sr = 0; + if (!get_wave_metadata(fin, &numchan, &bps, &sr, &numsamples)) { snprintf(errstr, errlen, "invalid WAV file"); return false; @@ -181,7 +185,7 @@ bool encode_file(FILE *fin, FILE *fout, float quality, int complexity, ret = false; goto finish; } - if (fread(in, 2, numsamples, fin) != numsamples) { + if (fread(in, 2, numsamples, fin) != (size_t)numsamples) { snprintf(errstr, errlen, "could not read input file data"); ret = false; goto finish; @@ -209,7 +213,7 @@ bool encode_file(FILE *fin, FILE *fout, float quality, int complexity, * make sure the Speex encoder is allowed to spit out all its data at clip * end */ numsamples += lookahead; - + inpos = in; while (numsamples > 0) { int samples = frame_size; @@ -250,7 +254,7 @@ bool encode_file(FILE *fin, FILE *fout, float quality, int complexity, nbytes = speex_bits_write_whole_bytes(&bits, cbits, 200); /* Write the compressed data */ - if (fwrite(cbits, 1, nbytes, fout) != nbytes) { + if (fwrite(cbits, 1, nbytes, fout) != (size_t)nbytes) { snprintf(errstr, errlen, "could not write output data"); ret = false; goto finish; @@ -258,7 +262,7 @@ bool encode_file(FILE *fin, FILE *fout, float quality, int complexity, } /* Squeeze out the last bits */ nbytes = speex_bits_write(&bits, cbits, 200); - if (fwrite(cbits, 1, nbytes, fout) != nbytes) { + if (fwrite(cbits, 1, nbytes, fout) != (size_t)nbytes) { snprintf(errstr, errlen, "could not write output data"); ret = false; } @@ -273,5 +277,3 @@ finish: free(in); return ret; } - - diff --git a/utils/ipodpatcher/main.c b/utils/ipodpatcher/main.c index 7b0a909178..031458488d 100644 --- a/utils/ipodpatcher/main.c +++ b/utils/ipodpatcher/main.c @@ -180,7 +180,7 @@ int main(int argc, char* argv[]) #ifdef __WIN32__ snprintf(ipod.diskname,sizeof(ipod.diskname),"\\\\.\\PhysicalDrive%s",argv[1]); #else - strncpy(ipod.diskname,argv[1],sizeof(ipod.diskname)); + strncpy(ipod.diskname,argv[1],sizeof(ipod.diskname)-1); #endif i = 2; } else { @@ -233,11 +233,11 @@ int main(int argc, char* argv[]) action = INSTALL; i++; #endif - } else if ((strcmp(argv[i],"-d")==0) || + } else if ((strcmp(argv[i],"-d")==0) || (strcmp(argv[i],"--delete-bootloader")==0)) { action = DELETE_BOOTLOADER; i++; - } else if ((strcmp(argv[i],"-a")==0) || + } else if ((strcmp(argv[i],"-a")==0) || (strcmp(argv[i],"--add-bootloader")==0)) { action = ADD_BOOTLOADER; type = FILETYPE_DOT_IPOD; @@ -245,7 +245,7 @@ int main(int argc, char* argv[]) if (i == argc) { print_usage(); return IPOD_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-ab")==0) || + } else if ((strcmp(argv[i],"-ab")==0) || (strcmp(argv[i],"--add-bootloader-bin")==0)) { action = ADD_BOOTLOADER; type = FILETYPE_DOT_BIN; @@ -253,7 +253,7 @@ int main(int argc, char* argv[]) if (i == argc) { print_usage(); return IPOD_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-rf")==0) || + } else if ((strcmp(argv[i],"-rf")==0) || (strcmp(argv[i],"--read-firmware")==0)) { action = READ_FIRMWARE; type = FILETYPE_DOT_IPOD; @@ -261,7 +261,7 @@ int main(int argc, char* argv[]) if (i == argc) { print_usage(); return IPOD_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-rfb")==0) || + } else if ((strcmp(argv[i],"-rfb")==0) || (strcmp(argv[i],"--read-firmware-bin")==0)) { action = READ_FIRMWARE; type = FILETYPE_DOT_BIN; @@ -270,14 +270,14 @@ int main(int argc, char* argv[]) filename=argv[i]; i++; #ifdef WITH_BOOTOBJS - } else if ((strcmp(argv[i],"-we")==0) || + } else if ((strcmp(argv[i],"-we")==0) || (strcmp(argv[i],"--write-embedded")==0)) { action = WRITE_FIRMWARE; type = FILETYPE_INTERNAL; filename="[embedded bootloader]"; /* Only displayed for user */ i++; #endif - } else if ((strcmp(argv[i],"-wf")==0) || + } else if ((strcmp(argv[i],"-wf")==0) || (strcmp(argv[i],"--write-firmware")==0)) { action = WRITE_FIRMWARE; type = FILETYPE_DOT_IPOD; @@ -285,7 +285,7 @@ int main(int argc, char* argv[]) if (i == argc) { print_usage(); return IPOD_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-wfb")==0) || + } else if ((strcmp(argv[i],"-wfb")==0) || (strcmp(argv[i],"--write-firmware-bin")==0)) { action = WRITE_FIRMWARE; type = FILETYPE_DOT_BIN; @@ -293,25 +293,25 @@ int main(int argc, char* argv[]) if (i == argc) { print_usage(); return IPOD_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-r")==0) || + } else if ((strcmp(argv[i],"-r")==0) || (strcmp(argv[i],"--read-partition")==0)) { action = READ_PARTITION; i++; if (i == argc) { print_usage(); return IPOD_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-w")==0) || + } else if ((strcmp(argv[i],"-w")==0) || (strcmp(argv[i],"--write-partition")==0)) { action = WRITE_PARTITION; i++; if (i == argc) { print_usage(); return IPOD_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-v")==0) || + } else if ((strcmp(argv[i],"-v")==0) || (strcmp(argv[i],"--verbose")==0)) { ipod_verbose++; i++; - } else if ((strcmp(argv[i],"-f")==0) || + } else if ((strcmp(argv[i],"-f")==0) || (strcmp(argv[i],"--format")==0)) { action = FORMAT_PARTITION; i++; @@ -334,7 +334,7 @@ int main(int argc, char* argv[]) if (i == argc) { print_usage(); return IPOD_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-c")==0) || + } else if ((strcmp(argv[i],"-c")==0) || (strcmp(argv[i],"--convert")==0)) { action = CONVERT_TO_FAT32; i++; @@ -388,7 +388,7 @@ int main(int argc, char* argv[]) #endif - /* Read the XML info, and if successful, look for the ramsize + /* Read the XML info, and if successful, look for the ramsize (only available for some models - set to 0 if not known) */ ipod.ramsize = 0; @@ -404,7 +404,7 @@ int main(int argc, char* argv[]) if (ipod.macpod) { print_macpod_warning(); } - + if (action==LIST_IMAGES) { list_images(&ipod); #ifdef WITH_BOOTOBJS @@ -566,7 +566,7 @@ int main(int argc, char* argv[]) printf("WARNING!!! YOU ARE ABOUT TO USE AN EXPERIMENTAL FEATURE.\n"); printf("ALL DATA ON YOUR IPOD WILL BE ERASED.\n"); printf("Are you sure you want to format your ipod? (y/n):"); - + if (fgets(yesno,4,stdin)) { if (yesno[0]=='y') { if (ipod_reopen_rw(&ipod) < 0) { @@ -587,7 +587,7 @@ int main(int argc, char* argv[]) printf("WARNING!!! YOU ARE ABOUT TO USE AN EXPERIMENTAL FEATURE.\n"); printf("ALL DATA ON YOUR IPOD WILL BE ERASED.\n"); printf("Are you sure you want to convert your ipod to FAT32? (y/n):"); - + if (fgets(yesno,4,stdin)) { if (yesno[0]=='y') { if (ipod_reopen_rw(&ipod) < 0) { diff --git a/utils/sansapatcher/main.c b/utils/sansapatcher/main.c index d12e33c22b..56e8712715 100644 --- a/utils/sansapatcher/main.c +++ b/utils/sansapatcher/main.c @@ -172,7 +172,7 @@ int main(int argc, char* argv[]) #ifdef __WIN32__ snprintf(sansa.diskname,sizeof(sansa.diskname),"\\\\.\\PhysicalDrive%s",argv[1]); #else - strncpy(sansa.diskname,argv[1],sizeof(sansa.diskname)); + strncpy(sansa.diskname,argv[1],sizeof(sansa.diskname)-1); #endif i = 2; } else { @@ -218,32 +218,32 @@ int main(int argc, char* argv[]) } else if (strcmp(argv[i],"--install")==0) { action = INSTALL; i++; - } else if ((strcmp(argv[i],"-d")==0) || + } else if ((strcmp(argv[i],"-d")==0) || (strcmp(argv[i],"--delete-bootloader")==0)) { action = DELETE_BOOTLOADER; i++; - } else if ((strcmp(argv[i],"-a")==0) || + } else if ((strcmp(argv[i],"-a")==0) || (strcmp(argv[i],"--add-bootloader")==0)) { action = ADD_BOOTLOADER; i++; if (i == argc) { print_usage(); return SANSA_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-of")==0) || + } else if ((strcmp(argv[i],"-of")==0) || (strcmp(argv[i],"--update-original-firmware")==0)) { action = UPDATE_OF; i++; if (i == argc) { print_usage(); return SANSA_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-bl")==0) || + } else if ((strcmp(argv[i],"-bl")==0) || (strcmp(argv[i],"--update-ppbl")==0)) { action = UPDATE_PPBL; i++; if (i == argc) { print_usage(); return SANSA_WRONG_ARGUMENTS; } filename=argv[i]; i++; - } else if ((strcmp(argv[i],"-rf")==0) || + } else if ((strcmp(argv[i],"-rf")==0) || (strcmp(argv[i],"--read-firmware")==0)) { action = READ_FIRMWARE; i++; diff --git a/utils/themeeditor/gui/codeeditor.cpp b/utils/themeeditor/gui/codeeditor.cpp index 9a2a0182f2..08bbfc2071 100644 --- a/utils/themeeditor/gui/codeeditor.cpp +++ b/utils/themeeditor/gui/codeeditor.cpp @@ -65,14 +65,14 @@ int CodeEditor::lineNumberAreaWidth() ++digits; } - int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits; + int space = 3 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits; return space; } void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */) -{ +{ setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); } @@ -267,4 +267,3 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) ++blockNumber; } } - |