examples/ezusb: Replace rewind with fseek, to check for errors

Replace rewind, which gives no error result, with fseek, which does.

Fixes all clang-tidy bugprone-unsafe-functions warnings

References #1479
This commit is contained in:
Sean McBride authored and Tormod Volden committed 2024-07-28 13:27:05 +02:00
1 parent e678b3fad5
commit 00454ab087
3 files changed
+7 -3

No files matched your search

-1
View File
@@ -13,7 +13,6 @@ bugprone-*,\
-bugprone-signed-char-misuse,\
-bugprone-suspicious-string-compare,\
-bugprone-switch-missing-default-case,\
-bugprone-unsafe-functions,\
-bugprone-too-small-loop-variable,\
clang-analyzer-*,\
-clang-analyzer-core.NullDereference,\
+6 -1
View File
@@ -815,7 +815,12 @@ int ezusb_load_ram(libusb_device_handle *device, const char *path, int fx_type,
}
/* at least write the interrupt vectors (at 0x0000) for reset! */
rewind(image);
status = fseek(image, 0L, SEEK_SET);
if (ret < 0) {
logerror("unable to rewind file %s\n", path);
ret = status;
goto exit;
}
if (verbose)
logerror("2nd stage: write on-chip memory\n");
status = parse_ihex(image, &ctx, is_external, ram_poke);
+1 -1
View File
@@ -1 +1 @@
#define LIBUSB_NANO 11913
#define LIBUSB_NANO 11914