incremented various buffers for sprintf %0*d usage to remove

gcc warnings.
Fixed strcat incorrect 3rd argument
This commit is contained in:
Marcus Meissner
2018-06-24 19:23:31 +02:00
parent f514ff9021
commit d8fda3263c
8 changed files with 14 additions and 14 deletions

View File

@@ -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. */

View File

@@ -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;

View File

@@ -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++) {

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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));

View File

@@ -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;

View File

@@ -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;