struct fileio: improve member types

Add const keyword to file url and cast to free().

Make size an ssize_t and chase all format strings that use it.
__archive__
Zachary T Welch 2009-11-13 14:22:21 -08:00
parent 9763aef76a
commit 69df712d1d
6 changed files with 7 additions and 7 deletions

View File

@ -847,7 +847,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{ {
command_print(cmd_ctx, "wrote %lld byte from file %s to flash bank %u" command_print(cmd_ctx, "wrote %zu byte from file %s to flash bank %u"
" at offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)", " at offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)",
fileio.size, args[1], p->bank_number, offset, fileio.size, args[1], p->bank_number, offset,
duration_elapsed(&bench), duration_kbps(&bench, fileio.size)); duration_elapsed(&bench), duration_kbps(&bench, fileio.size));

View File

@ -750,7 +750,7 @@ COMMAND_HANDLER(mg_write_cmd)
if (duration_measure(&bench) == ERROR_OK) if (duration_measure(&bench) == ERROR_OK)
{ {
command_print(cmd_ctx, "wrote %lli byte from file %s " command_print(cmd_ctx, "wrote %zu byte from file %s "
"in %fs (%0.3f kB/s)", fileio.size, args[1], "in %fs (%0.3f kB/s)", fileio.size, args[1],
duration_elapsed(&bench), duration_kbps(&bench, fileio.size)); duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
} }

View File

@ -1637,7 +1637,7 @@ COMMAND_HANDLER(handle_nand_dump_command)
if (nand_fileio_finish(&s) == ERROR_OK) if (nand_fileio_finish(&s) == ERROR_OK)
{ {
command_print(cmd_ctx, "dumped %lld byte in %fs (%0.3f kb/s)", command_print(cmd_ctx, "dumped %zu bytes in %fs (%0.3f kb/s)",
s.fileio.size, duration_elapsed(&s.bench), s.fileio.size, duration_elapsed(&s.bench),
duration_kbps(&s.bench, s.fileio.size)); duration_kbps(&s.bench, s.fileio.size));
} }

View File

@ -137,7 +137,7 @@ int fileio_close(struct fileio *fileio)
retval = fileio_close_local(fileio); retval = fileio_close_local(fileio);
free(fileio->url); free((void*)fileio->url);
fileio->url = NULL; fileio->url = NULL;
return retval; return retval;

View File

@ -47,8 +47,8 @@ enum fileio_access
}; };
struct fileio { struct fileio {
char *url; const char *url;
long long size; ssize_t size;
enum fileio_type type; enum fileio_type type;
enum fileio_access access; enum fileio_access access;
FILE *file; FILE *file;

View File

@ -2543,7 +2543,7 @@ COMMAND_HANDLER(handle_dump_image_command)
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{ {
command_print(cmd_ctx, command_print(cmd_ctx,
"dumped %lld bytes in %fs (%0.3f kb/s)", fileio.size, "dumped %zu bytes in %fs (%0.3f kb/s)", fileio.size,
duration_elapsed(&bench), duration_kbps(&bench, fileio.size)); duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
} }