From d8fda3263c35da576fbcbf15e6c287204cefdbe9 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 24 Jun 2018 19:23:31 +0200 Subject: [PATCH] incremented various buffers for sprintf %0*d usage to remove gcc warnings. Fixed strcat incorrect 3rd argument --- camlibs/aox/library.c | 2 +- camlibs/ax203/library.c | 2 +- camlibs/mars/library.c | 2 +- camlibs/sonix/library.c | 6 +++--- camlibs/sonydscf1/command.c | 6 +++--- camlibs/spca50x/spca50x-flash.c | 2 +- camlibs/spca50x/spca50x-sdram.c | 6 +++--- camlibs/tp6801/library.c | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/camlibs/aox/library.c b/camlibs/aox/library.c index 20c327e04..58f82b703 100644 --- a/camlibs/aox/library.c +++ b/camlibs/aox/library.c @@ -134,7 +134,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, int num_lo_pics = aox_get_num_lo_pics (camera->pl->info); int num_hi_pics = aox_get_num_hi_pics (camera->pl->info); int n = num_hi_pics + num_lo_pics; - char name[20]; + char name[30]; int i; /* Low-resolution pictures are always downloaded first. We do not know * yet how to process them, so they will remain in RAW format. */ diff --git a/camlibs/ax203/library.c b/camlibs/ax203/library.c index 44ad70212..6b3636fa0 100644 --- a/camlibs/ax203/library.c +++ b/camlibs/ax203/library.c @@ -362,7 +362,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, { Camera *camera = data; int i, count, present; - char buf[16]; + char buf[30]; count = ax203_read_filecount (camera); if (count < 0) return count; diff --git a/camlibs/mars/library.c b/camlibs/mars/library.c index 77926fcbb..5c3d87a99 100644 --- a/camlibs/mars/library.c +++ b/camlibs/mars/library.c @@ -163,7 +163,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, { Camera *camera = data; int i = 0, n; - char name[16]; + char name[30]; n = mars_get_num_pics(camera->pl->info); for (i=0; i < n; i++) { diff --git a/camlibs/sonix/library.c b/camlibs/sonix/library.c index f3b5fd6ec..2d7546cd2 100644 --- a/camlibs/sonix/library.c +++ b/camlibs/sonix/library.c @@ -500,7 +500,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context) { int ret = 0, n; - char name[16]; + char name[30]; if(!camera->pl->sonix_init_done) ret = sonix_init(camera->port, camera->pl); if ( ret != GP_OK) { @@ -515,9 +515,9 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, return GP_ERROR_NO_MEMORY; n=camera->pl->num_pics; sonix_capture_image(camera->port); - snprintf(name, 16, "sonix%03i.ppm",n+1); + snprintf(name, sizeof(name), "sonix%03i.ppm",n+1); sprintf(path->folder,"/"); - snprintf(path->name,16,"sonix%03i.ppm",n+1); + snprintf(path->name,sizeof(path->name),"sonix%03i.ppm",n+1); gp_filesystem_append(camera->fs, "/", name, context); return GP_OK; } diff --git a/camlibs/sonydscf1/command.c b/camlibs/sonydscf1/command.c index a99795d41..b13d5d749 100644 --- a/camlibs/sonydscf1/command.c +++ b/camlibs/sonydscf1/command.c @@ -177,11 +177,11 @@ char F1newstatus(GPPort *port, int verbose, char *return_buf) break; } sprintf(tmp_buf, "Total Pictures: %02d\n", pic_num); - strncat(status_buf, tmp_buf, sizeof(tmp_buf)); + strncat(status_buf, tmp_buf, sizeof(status_buf)); sprintf(tmp_buf, "Date: %02d/%02d/%02d\n", month, date, year); - strncat(status_buf, tmp_buf, sizeof(tmp_buf)); + strncat(status_buf, tmp_buf, sizeof(status_buf)); sprintf(tmp_buf, "Time: %02d:%02d\n",hour, minutes); - strncat(status_buf, tmp_buf, sizeof(tmp_buf)); + strncat(status_buf, tmp_buf, sizeof(status_buf)); } strcpy(return_buf, status_buf); diff --git a/camlibs/spca50x/spca50x-flash.c b/camlibs/spca50x/spca50x-flash.c index c5ed5504f..1b52985c3 100644 --- a/camlibs/spca50x/spca50x-flash.c +++ b/camlibs/spca50x/spca50x-flash.c @@ -332,7 +332,7 @@ spca50x_flash_get_file_name (CameraPrivateLibrary *pl, int index, char *name) { uint8_t *p; if (pl->bridge == BRIDGE_SPCA500) { - char p[14]; + char p[30]; int w, h, type, size; memset (p, 0, sizeof(p)); diff --git a/camlibs/spca50x/spca50x-sdram.c b/camlibs/spca50x/spca50x-sdram.c index 3b5824422..02e5a1947 100644 --- a/camlibs/spca50x/spca50x-sdram.c +++ b/camlibs/spca50x/spca50x-sdram.c @@ -836,7 +836,7 @@ spca50x_get_FATs (CameraPrivateLibrary * lib, int dramtype) unsigned int index = 0; unsigned int file_index = 0; uint8_t *p = NULL; - uint8_t buf[14]; + uint8_t buf[30]; /* Reset image and movie counter */ lib->num_images = lib->num_movies = 0; @@ -891,13 +891,13 @@ spca50x_get_FATs (CameraPrivateLibrary * lib, int dramtype) } else { /* its an image */ if (type == 0x00 || type == 0x01) { - snprintf ((char*)buf, 13, "Image%03d.jpg", + snprintf (buf, sizeof(buf), "Image%03d.jpg", ++lib->num_images); lib->files[file_index].mime_type = SPCA50X_FILE_TYPE_IMAGE; } else if ((type == 0x08) || (type == 0x03)) { /* its the start of an avi */ - snprintf ((char*)buf, 13, "Movie%03d.avi", + snprintf (buf, sizeof(buf), "Movie%03d.avi", ++lib->num_movies); lib->files[file_index].mime_type = SPCA50X_FILE_TYPE_AVI; diff --git a/camlibs/tp6801/library.c b/camlibs/tp6801/library.c index a7bd0a75a..3eb78b1d3 100644 --- a/camlibs/tp6801/library.c +++ b/camlibs/tp6801/library.c @@ -356,7 +356,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, { Camera *camera = data; int i, count, present; - char buf[16]; + char buf[30]; count = tp6801_max_filecount (camera); if (count < 0) return count;