diff options
-rw-r--r-- | camlibs/aox/library.c | 6 | ||||
-rw-r--r-- | camlibs/fuji/fuji.h | 4 | ||||
-rw-r--r-- | camlibs/jl2005a/jl2005a.c | 12 | ||||
-rw-r--r-- | camlibs/kodak/dc3200/library.c | 15 | ||||
-rw-r--r-- | camlibs/mars/mars.c | 27 | ||||
-rw-r--r-- | camlibs/panasonic/dc.c | 2 | ||||
-rw-r--r-- | camlibs/panasonic/dc1000.c | 2 | ||||
-rw-r--r-- | camlibs/panasonic/dc1580.c | 2 | ||||
-rw-r--r-- | camlibs/polaroid/pdc700.c | 16 | ||||
-rw-r--r-- | camlibs/ricoh/ricoh.h | 24 | ||||
-rw-r--r-- | camlibs/sierra/library.c | 2 | ||||
-rw-r--r-- | camlibs/sierra/library.h | 4 | ||||
-rw-r--r-- | camlibs/smal/ultrapocket.c | 2 | ||||
-rw-r--r-- | camlibs/topfield/puppy.c | 1 | ||||
-rw-r--r-- | libgphoto2/gphoto2-abilities-list.c | 3 | ||||
-rw-r--r-- | libgphoto2/gphoto2-file.c | 4 | ||||
-rw-r--r-- | libgphoto2/gphoto2-widget.c | 4 | ||||
-rw-r--r-- | libgphoto2_port/disk/disk.c | 2 | ||||
-rw-r--r-- | libgphoto2_port/gphoto2/gphoto2-port-portability.h | 2 | ||||
-rw-r--r-- | packaging/generic/print-camera-list.c | 9 | ||||
-rw-r--r-- | tests/test-camera-list.c | 6 |
21 files changed, 91 insertions, 58 deletions
diff --git a/camlibs/aox/library.c b/camlibs/aox/library.c index 845901694..f85d20800 100644 --- a/camlibs/aox/library.c +++ b/camlibs/aox/library.c @@ -132,18 +132,18 @@ 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[n]; + char name[20]; 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. */ for (i=0; i< num_lo_pics; i++){ - sprintf( name, "aox_pic%03i.raw", i+1 ); + snprintf( name, sizeof(name), "aox_pic%03i.raw", i+1 ); gp_list_append(list, name, NULL); } for (i = num_lo_pics; i < n; i++){ - sprintf( name, "aox_pic%03i.ppm", i+1 ); + snprintf( name, sizeof(name), "aox_pic%03i.ppm", i+1 ); gp_list_append(list, name, NULL); } return GP_OK; diff --git a/camlibs/fuji/fuji.h b/camlibs/fuji/fuji.h index 6379a2594..e239b38c7 100644 --- a/camlibs/fuji/fuji.h +++ b/camlibs/fuji/fuji.h @@ -24,7 +24,6 @@ #include <gphoto2/gphoto2-context.h> #include <gphoto2/gphoto2-camera.h> -typedef enum _FujiCmd FujiCmd; enum _FujiCmd { FUJI_CMD_PIC_GET = 0x02, FUJI_CMD_PIC_GET_THUMB = 0x00, @@ -74,6 +73,7 @@ enum _FujiCmd { FUJI_CMD_UNKNOWN8 = 0xc0 /* Figure this out! */ }; +typedef enum _FujiCmd FujiCmd; int fuji_get_cmds (Camera *camera, unsigned char *cmds, GPContext *context); @@ -114,7 +114,6 @@ int fuji_pic_get (Camera *camera, unsigned int i, unsigned char **data, int fuji_pic_get_thumb (Camera *camera, unsigned int i, unsigned char **data, unsigned int *size, GPContext *context); -typedef enum _FujiSpeed FujiSpeed; enum _FujiSpeed { FUJI_SPEED_9600 = 0, FUJI_SPEED_19200 = 5, @@ -122,6 +121,7 @@ enum _FujiSpeed { FUJI_SPEED_57600 = 7, FUJI_SPEED_115200 = 8 }; +typedef enum _FujiSpeed FujiSpeed; int fuji_set_speed (Camera *camera, FujiSpeed speed, GPContext *context); diff --git a/camlibs/jl2005a/jl2005a.c b/camlibs/jl2005a/jl2005a.c index fc785fafe..2008eab34 100644 --- a/camlibs/jl2005a/jl2005a.c +++ b/camlibs/jl2005a/jl2005a.c @@ -59,8 +59,10 @@ int jl2005a_get_pic_data_size (GPPort *port, int n) { unsigned int size = 0; - char command[2] = {0xa1, (char)(n&0xff)}; + char command[2]; char response=0; + command[0] = 0xa1; + command[1] = (char)(n&0xff); GP_DEBUG("Getting photo data size\n"); gp_port_write (port, "\xab\x00", 2); gp_port_write (port, command, 2); @@ -172,7 +174,9 @@ jl2005a_reset (Camera *camera, GPPort *port) int jl2005a_read_info_byte(GPPort *port, int n) { char response; - char command[2] = {0xa1, (char)(n&0xff)}; + char command[2]; + command[0] = 0xa1; + command[1] = (char)(n&0xff); gp_port_write (port, "\xab\x00", 2); gp_port_write (port, command , 2); gp_port_write (port, "\xab\x00", 2); @@ -189,7 +193,9 @@ int jl2005a_read_info_byte(GPPort *port, int n) int jl2005a_shortquery(GPPort *port, int n) { char response; - char command[2] = {0xa2, (char)(n&0xff)}; + char command[2]; + command[0] = 0xa2; + command[1] = (char)(n&0xff); gp_port_write (port, "\xab\x00", 2); gp_port_write (port, command, 2); gp_port_write (port, "\xab\x00", 2); diff --git a/camlibs/kodak/dc3200/library.c b/camlibs/kodak/dc3200/library.c index a5173b067..2959b81db 100644 --- a/camlibs/kodak/dc3200/library.c +++ b/camlibs/kodak/dc3200/library.c @@ -138,12 +138,15 @@ int dc3200_setup(Camera *camera) * */ - unsigned char cmd1[5] = {0x01, dc3200_calc_seqnum(camera), 0x01, 0x00, 0x0F}; - unsigned char cmd2[8] = {0x01, dc3200_calc_seqnum(camera), 0x80, 0x00, 0x01, 0x81, 0x00, 0x03}; + unsigned char cmd1[5] = {0x01, 0, 0x01, 0x00, 0x0F}; + unsigned char cmd2[8] = {0x01, 0, 0x80, 0x00, 0x01, 0x81, 0x00, 0x03}; unsigned char ack[ACK_PACKET_LEN], resp[DEF_PACKET_LEN]; int ack_len = ACK_PACKET_LEN, resp_len = DEF_PACKET_LEN; + cmd1[1] = dc3200_calc_seqnum(camera); + cmd2[1] = dc3200_calc_seqnum(camera); + if(dc3200_send_command(camera, cmd1, sizeof(cmd1), ack, &ack_len) == GP_ERROR) return GP_ERROR; if(dc3200_check_ack(camera, ack, ack_len) == GP_ERROR) @@ -472,14 +475,18 @@ int dc3200_get_data(Camera *camera, unsigned char **data, unsigned long *data_le */ int dc3200_cancel_get_data(Camera *camera) { - unsigned char pkt[20] = {0x01, dc3200_calc_seqnum(camera), 0x80, 0x00, 0x20, 0x03, 0x0d, 0xc1, 0x50, 0xc0, - 0x00, 0x00, 0x00, 0x06, 0x04, 0x01, 0x00, 0x01, (camera->pl->cmd_seqnum >> 8) & 0xff, camera->pl->cmd_seqnum & 0xff}; + unsigned char pkt[20] = {0x01, 0, 0x80, 0x00, 0x20, 0x03, 0x0d, 0xc1, 0x50, 0xc0, + 0x00, 0x00, 0x00, 0x06, 0x04, 0x01, 0x00, 0x01, 0, 0}; unsigned char ack[ACK_PACKET_LEN], resp[DEF_PACKET_LEN]; int ack_len = ACK_PACKET_LEN, resp_len = DEF_PACKET_LEN; struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 1000; + pkt[1] = dc3200_calc_seqnum(camera); + pkt[18] = (camera->pl->cmd_seqnum >> 8) & 0xff; + pkt[19] = camera->pl->cmd_seqnum & 0xff; + /* wait a bit ... */ select(0, 0, 0, 0, &timeout); diff --git a/camlibs/mars/mars.c b/camlibs/mars/mars.c index 0627750ea..0e439a47d 100644 --- a/camlibs/mars/mars.c +++ b/camlibs/mars/mars.c @@ -308,17 +308,30 @@ mars_routine (Info *info, GPPort *port, char param, int n) char c[16]; char start[2] = {0x19, 0x51}; char do_something[2]; - /* See protocol.txt for my theories about what these mean. */ - char address1[2] = {0x19, info[8*n+1]}; - char address2[2] = {0x19, info[8*n+2]}; - char address3[2] = {0x19, info[8*n+3]}; - char address4[2] = {0x19, info[8*n+4]}; - char address5[2] = {0x19, info[8*n+5]}; - char address6[2] = {0x19, info[8*n+6]}; + char address1[2]; + char address2[2]; + char address3[2]; + char address4[2]; + char address5[2]; + char address6[2]; do_something[0]= 0x19; do_something[1]=param; + /* See protocol.txt for my theories about what these mean. */ + address1[0] = 0x19; + address1[1] = info[8*n+1]; + address2[0] = 0x19; + address2[1] = info[8*n+2]; + address3[0] = 0x19; + address3[1] = info[8*n+3]; + address4[0] = 0x19; + address4[1] = info[8*n+4]; + address5[0] = 0x19; + address5[1] = info[8*n+5]; + address6[0] = 0x19; + address6[1] = info[8*n+6]; + memset(c,0,sizeof(c)); diff --git a/camlibs/panasonic/dc.c b/camlibs/panasonic/dc.c index 344806426..0f81013e2 100644 --- a/camlibs/panasonic/dc.c +++ b/camlibs/panasonic/dc.c @@ -27,7 +27,9 @@ #include <sys/stat.h> #include <unistd.h> #include <string.h> +#ifdef HAVE_MEMORY_H #include <memory.h> +#endif #include "dc.h" #include "dc1000.h" diff --git a/camlibs/panasonic/dc1000.c b/camlibs/panasonic/dc1000.c index 938205e49..2f4445223 100644 --- a/camlibs/panasonic/dc1000.c +++ b/camlibs/panasonic/dc1000.c @@ -24,7 +24,9 @@ #include <sys/time.h> #include <sys/stat.h> #include <unistd.h> +#ifdef HAVE_MEMORY_H #include <memory.h> +#endif #include <string.h> #ifdef ENABLE_NLS diff --git a/camlibs/panasonic/dc1580.c b/camlibs/panasonic/dc1580.c index f5081f63a..36e16efa9 100644 --- a/camlibs/panasonic/dc1580.c +++ b/camlibs/panasonic/dc1580.c @@ -27,7 +27,9 @@ #include <sys/time.h> #include <sys/stat.h> #include <unistd.h> +#ifdef HAVE_MEMORY_H #include <memory.h> +#endif #include <string.h> #ifdef ENABLE_NLS diff --git a/camlibs/polaroid/pdc700.c b/camlibs/polaroid/pdc700.c index 28bea9d23..ed7876080 100644 --- a/camlibs/polaroid/pdc700.c +++ b/camlibs/polaroid/pdc700.c @@ -61,14 +61,13 @@ #define RETRIES 5 -typedef enum _PDCStatus PDCStatus; enum _PDCStatus { PDC_STATUS_FAIL = 0x00, PDC_STATUS_DONE = 0x01, PDC_STATUS_LAST = 0x02 }; +typedef enum _PDCStatus PDCStatus; -typedef enum _PDCConf PDCConf; enum _PDCConf { PDC_CONF_FLASH = 0x00, PDC_CONF_TIMER = 0x01, @@ -80,8 +79,8 @@ enum _PDCConf { PDC_CONF_SIZE = 0x07 /* I think we have them all... 8 and 9 return failure */ }; +typedef enum _PDCConf PDCConf; -typedef enum _PDCBaud PDCBaud; enum _PDCBaud { PDC_BAUD_9600 = 0x00, PDC_BAUD_19200 = 0x01, @@ -89,12 +88,13 @@ enum _PDCBaud { PDC_BAUD_57600 = 0x03, PDC_BAUD_115200 = 0x04 }; +typedef enum _PDCBaud PDCBaud; -typedef enum _PDCBool PDCBool; enum _PDCBool { PDC_BOOL_OFF = 0, PDC_BOOL_ON = 1 }; +typedef enum _PDCBool PDCBool; typedef struct _PDCDate PDCDate; struct _PDCDate { @@ -107,32 +107,32 @@ struct _PDCDate { unsigned char hour, minute, second; }; -typedef enum _PDCMode PDCMode; enum _PDCMode { PDC_MODE_PLAY = 0, PDC_MODE_RECORD = 1, PDC_MODE_MENU = 2 }; +typedef enum _PDCMode PDCMode; -typedef enum _PDCQuality PDCQuality; enum _PDCQuality { PDC_QUALITY_NORMAL = 0, PDC_QUALITY_FINE = 1, PDC_QUALITY_SUPERFINE = 2 }; +typedef enum _PDCQuality PDCQuality; -typedef enum _PDCSize PDCSize; enum _PDCSize { PDC_SIZE_VGA = 0, PDC_SIZE_XGA = 1, }; +typedef enum _PDCSize PDCSize; -typedef enum _PDCFlash PDCFlash; enum _PDCFlash { PDC_FLASH_AUTO = 0, PDC_FLASH_ON = 1, PDC_FLASH_OFF = 2 }; +typedef enum _PDCFlash PDCFlash; typedef struct _PDCInfo PDCInfo; struct _PDCInfo { diff --git a/camlibs/ricoh/ricoh.h b/camlibs/ricoh/ricoh.h index 1d808a394..97518bd6f 100644 --- a/camlibs/ricoh/ricoh.h +++ b/camlibs/ricoh/ricoh.h @@ -26,7 +26,6 @@ #include <gphoto2/gphoto2-camera.h> #include <gphoto2/gphoto2-context.h> -typedef enum _RicohSpeed RicohSpeed; enum _RicohSpeed { RICOH_SPEED_2400 = 0x00, RICOH_SPEED_4800 = 0x01, @@ -36,11 +35,11 @@ enum _RicohSpeed { RICOH_SPEED_57600 = 0x05, RICOH_SPEED_115200 = 0x07 }; +typedef enum _RicohSpeed RicohSpeed; int ricoh_set_speed (Camera *camera, GPContext *context, RicohSpeed speed); /* We don't know the numbers for the models marked as 'dummy'. */ -typedef enum _RicohModel RicohModel; enum _RicohModel { RICOH_MODEL_1 = 0x001, /* dummy */ RICOH_MODEL_2 = 0x002, /* dummy */ @@ -58,15 +57,16 @@ enum _RicohModel { RICOH_MODEL_ESP80 = 0x010, /* dummy */ RICOH_MODEL_ESP80SXG = 0x400 }; +typedef enum _RicohModel RicohModel; int ricoh_connect (Camera *camera, GPContext *context, RicohModel *model); int ricoh_disconnect (Camera *camera, GPContext *context); -typedef enum _RicohMode RicohMode; enum _RicohMode { RICOH_MODE_PLAY = 0x00, RICOH_MODE_RECORD = 0x01 }; +typedef enum _RicohMode RicohMode; int ricoh_get_mode (Camera *camera, GPContext *context, RicohMode *mode); int ricoh_set_mode (Camera *camera, GPContext *context, RicohMode mode); @@ -79,11 +79,11 @@ int ricoh_get_pic_name (Camera *, GPContext *, unsigned int, const char **); int ricoh_get_pic_memo (Camera *, GPContext *, unsigned int, const char **); int ricoh_del_pic (Camera *, GPContext *, unsigned int); -typedef enum _RicohFileType RicohFileType; enum _RicohFileType { RICOH_FILE_TYPE_NORMAL = 0xa0, RICOH_FILE_TYPE_PREVIEW = 0xa4 }; +typedef enum _RicohFileType RicohFileType; int ricoh_get_pic (Camera *camera, GPContext *context, unsigned int n, RicohFileType type, unsigned char **data, unsigned int *size); @@ -103,16 +103,15 @@ int ricoh_get_copyright (Camera *camera, GPContext *context, int ricoh_set_copyright (Camera *camera, GPContext *context, const char *copyright); -typedef enum _RicohResolution RicohResolution; enum _RicohResolution { RICOH_RESOLUTION_640_480 = 0x01, RICOH_RESOLUTION_1280_960 = 0x04 }; +typedef enum _RicohResolution RicohResolution; int ricoh_get_resolution (Camera *, GPContext *, RicohResolution *); int ricoh_set_resolution (Camera *, GPContext *, RicohResolution); -typedef enum _RicohExposure RicohExposure; enum _RicohExposure { RICOH_EXPOSURE_M20 = 0x01, /* -2.0 */ RICOH_EXPOSURE_M15 = 0x02, @@ -125,11 +124,11 @@ enum _RicohExposure { RICOH_EXPOSURE_20 = 0x09, /* +2.0 */ RICOH_EXPOSURE_AUTO = 0xff }; +typedef enum _RicohExposure RicohExposure; int ricoh_get_exposure (Camera *, GPContext *, RicohExposure *); int ricoh_set_exposure (Camera *, GPContext *, RicohExposure); -typedef enum _RicohWhiteLevel RicohWhiteLevel; enum _RicohWhiteLevel { RICOH_WHITE_LEVEL_AUTO = 0x00, RICOH_WHITE_LEVEL_OUTDOOR = 0x01, @@ -138,20 +137,20 @@ enum _RicohWhiteLevel { RICOH_WHITE_LEVEL_BLACK_WHITE = 0x04, RICOH_WHITE_LEVEL_SEPIA = 0x05 }; +typedef enum _RicohWhiteLevel RicohWhiteLevel; int ricoh_get_white_level (Camera *, GPContext *, RicohWhiteLevel *); int ricoh_set_white_level (Camera *, GPContext *, RicohWhiteLevel); -typedef enum _RicohMacro RicohMacro; enum _RicohMacro { RICOH_MACRO_OFF = 0x00, RICOH_MACRO_ON = 0x01 }; +typedef enum _RicohMacro RicohMacro; int ricoh_get_macro (Camera *, GPContext *, RicohMacro *); int ricoh_set_macro (Camera *, GPContext *, RicohMacro); -typedef enum _RicohZoom RicohZoom; enum _RicohZoom { RICOH_ZOOM_OFF = 0x00, RICOH_ZOOM_1 = 0x01, @@ -163,21 +162,21 @@ enum _RicohZoom { RICOH_ZOOM_7 = 0x07, RICOH_ZOOM_8 = 0x08 }; +typedef enum _RicohZoom RicohZoom; int ricoh_get_zoom (Camera *, GPContext *, RicohZoom *); int ricoh_set_zoom (Camera *, GPContext *, RicohZoom); -typedef enum _RicohFlash RicohFlash; enum _RicohFlash { RICOH_FLASH_AUTO = 0x00, RICOH_FLASH_OFF = 0x01, RICOH_FLASH_ON = 0x02 }; +typedef enum _RicohFlash RicohFlash; int ricoh_get_flash (Camera *, GPContext *, RicohFlash *); int ricoh_set_flash (Camera *, GPContext *, RicohFlash); -typedef enum _RicohRecMode RicohRecMode; enum _RicohRecMode { RICOH_REC_MODE_IMAGE = 0x00, RICOH_REC_MODE_CHARACTER = 0x01, @@ -185,17 +184,18 @@ enum _RicohRecMode { RICOH_REC_MODE_IMAGE_SOUND = 0x04, RICOH_REC_MODE_CHARACTER_SOUND = 0x06 }; +typedef enum _RicohRecMode RicohRecMode; int ricoh_get_rec_mode (Camera *, GPContext *, RicohRecMode *); int ricoh_set_rec_mode (Camera *, GPContext *, RicohRecMode); -typedef enum _RicohCompression RicohCompression; enum _RicohCompression { RICOH_COMPRESSION_NONE = 0x00, RICOH_COMPRESSION_MAX = 0x01, RICOH_COMPRESSION_NORM = 0x02, RICOH_COMPRESSION_MIN = 0x03 }; +typedef enum _RicohCompression RicohCompression; int ricoh_get_compression (Camera *, GPContext *, RicohCompression *); int ricoh_set_compression (Camera *, GPContext *, RicohCompression); diff --git a/camlibs/sierra/library.c b/camlibs/sierra/library.c index 07a7c2330..19a2cfae3 100644 --- a/camlibs/sierra/library.c +++ b/camlibs/sierra/library.c @@ -52,7 +52,6 @@ # define N_(String) (String) #endif -typedef enum _SierraPacket SierraPacket; enum _SierraPacket { NUL = 0x00, SIERRA_PACKET_DATA = 0x02, @@ -66,6 +65,7 @@ enum _SierraPacket { SIERRA_PACKET_SESSION_ERROR = 0xfc, SIERRA_PACKET_SESSION_END = 0xff }; +typedef enum _SierraPacket SierraPacket; /* Size of requested packet */ #define SIERRA_PACKET_SIZE 32774 diff --git a/camlibs/sierra/library.h b/camlibs/sierra/library.h index 015fe92e4..6a4843c3a 100644 --- a/camlibs/sierra/library.h +++ b/camlibs/sierra/library.h @@ -61,7 +61,6 @@ } \ } -typedef enum _SierraAction SierraAction; enum _SierraAction { SIERRA_ACTION_DELETE_LAST_PIC = 0x00, SIERRA_ACTION_DELETE_ALL = 0x01, @@ -75,6 +74,7 @@ enum _SierraAction { SIERRA_ACTION_UPLOAD = 0x0b, SIERRA_ACTION_LCD_TEST = 0x0c, }; +typedef enum _SierraAction SierraAction; typedef enum { SIERRA_LOCKED_NO = 0x00, @@ -97,7 +97,6 @@ int sierra_set_locked (Camera *camera, unsigned int n, SierraLocked locked, GPContext *context); /* Communications functions */ -typedef enum _SierraSpeed SierraSpeed; enum _SierraSpeed { SIERRA_SPEED_9600 = 1, SIERRA_SPEED_19200 = 2, @@ -105,6 +104,7 @@ enum _SierraSpeed { SIERRA_SPEED_57600 = 4, SIERRA_SPEED_115200 = 5 }; +typedef enum _SierraSpeed SierraSpeed; int sierra_set_speed (Camera *camera, SierraSpeed speed, GPContext *context); int sierra_end_session (Camera *camera, GPContext *context); diff --git a/camlibs/smal/ultrapocket.c b/camlibs/smal/ultrapocket.c index 03b4b0ee9..391a43e6d 100644 --- a/camlibs/smal/ultrapocket.c +++ b/camlibs/smal/ultrapocket.c @@ -377,8 +377,8 @@ ultrapocket_reset(Camera *camera) GPPortInfo oldpi; GPPort *port = camera->port; CameraAbilities cab; - gp_camera_get_abilities(camera, &cab); unsigned char cmdbuf[0x10]; + gp_camera_get_abilities(camera, &cab); GP_DEBUG ("First connect since camera was used - need to reset cam"); /* diff --git a/camlibs/topfield/puppy.c b/camlibs/topfield/puppy.c index 57774e935..fbb5ab86a 100644 --- a/camlibs/topfield/puppy.c +++ b/camlibs/topfield/puppy.c @@ -53,7 +53,6 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> -#include <sys/file.h> #include <unistd.h> #include <fcntl.h> diff --git a/libgphoto2/gphoto2-abilities-list.c b/libgphoto2/gphoto2-abilities-list.c index f9c32520b..e16e3565c 100644 --- a/libgphoto2/gphoto2-abilities-list.c +++ b/libgphoto2/gphoto2-abilities-list.c @@ -187,7 +187,8 @@ gp_abilities_list_load_dir (CameraAbilitiesList *list, const char *dir, } if (1) { /* a new block in which we can define a temporary variable */ int ret; - foreach_data_t foreach_data = { flist, GP_OK }; + foreach_data_t foreach_data = { NULL, GP_OK }; + foreach_data.list = flist; lt_dlinit (); lt_dladdsearchdir (dir); ret = lt_dlforeachfile (dir, foreach_func, &foreach_data); diff --git a/libgphoto2/gphoto2-file.c b/libgphoto2/gphoto2-file.c index a4288285f..78df91499 100644 --- a/libgphoto2/gphoto2-file.c +++ b/libgphoto2/gphoto2-file.c @@ -1131,11 +1131,7 @@ gp_file_adjust_name_for_mime_type (CameraFile *file) if (!strcmp (file->mime_type, table[x])) { /* Search the current suffix and erase it */ -#ifdef HAVE_STRCHR suffix = strrchr (file->name, '.'); -#else - suffix = rindex (file->name, '.'); -#endif if (suffix++) *suffix = '\0'; strcat (file->name, table[x + 1]); diff --git a/libgphoto2/gphoto2-widget.c b/libgphoto2/gphoto2-widget.c index 1002253e6..3c87c9a13 100644 --- a/libgphoto2/gphoto2-widget.c +++ b/libgphoto2/gphoto2-widget.c @@ -130,8 +130,8 @@ gp_widget_new (CameraWidgetType type, const char *label, int gp_widget_free (CameraWidget *widget) { - CHECK_NULL (widget); int x; + CHECK_NULL (widget); /* Free children recursively */ if ((widget->type == GP_WIDGET_WINDOW) || @@ -432,8 +432,8 @@ gp_widget_get_value (CameraWidget *widget, void *value) int gp_widget_append (CameraWidget *widget, CameraWidget *child) { - CHECK_NULL (widget && child); CameraWidget **newlist; + CHECK_NULL (widget && child); /* Return if they can't have any children */ if ((widget->type != GP_WIDGET_WINDOW) && diff --git a/libgphoto2_port/disk/disk.c b/libgphoto2_port/disk/disk.c index e44c60e99..6a3797238 100644 --- a/libgphoto2_port/disk/disk.c +++ b/libgphoto2_port/disk/disk.c @@ -30,7 +30,9 @@ #include <fcntl.h> #include <errno.h> #include <sys/time.h> +#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> +#endif #include <dirent.h> #include <string.h> #ifdef HAVE_MNTENT_H diff --git a/libgphoto2_port/gphoto2/gphoto2-port-portability.h b/libgphoto2_port/gphoto2/gphoto2-port-portability.h index 2233f7648..c85118567 100644 --- a/libgphoto2_port/gphoto2/gphoto2-port-portability.h +++ b/libgphoto2_port/gphoto2/gphoto2-port-portability.h @@ -171,7 +171,9 @@ typedef struct { # include <strings.h> # include <sys/types.h> # include <dirent.h> +#ifdef HAVE_SYS_PARAM_H # include <sys/param.h> +#endif # include <sys/stat.h> # include <unistd.h> diff --git a/packaging/generic/print-camera-list.c b/packaging/generic/print-camera-list.c index beb8c2621..8fdf7ab98 100644 --- a/packaging/generic/print-camera-list.c +++ b/packaging/generic/print-camera-list.c @@ -315,7 +315,7 @@ human_end_func (const func_params_t *params, void *data) /** C equivalent of basename(1) */ static const char * -basename (const char *pathname) +path_basename (const char *pathname) { char *result, *tmp; /* remove path part from camlib name */ @@ -337,7 +337,7 @@ human_camera_func (const func_params_t *params, void *data) { const char *camlib_basename; - camlib_basename = basename(a->library); + camlib_basename = path_basename(a->library); printf("%3d|%-20s|%-20s|%s\n", i+1, camlib_basename, @@ -435,7 +435,8 @@ udev_parse_params (const func_params_t *params, void **data) } else if (strcmp("group", key)==0) { pdata->group = val; } else if (strcmp("version", key)==0) { - if (gpi_string_to_enum(val, &(pdata->version), + unsigned int ver = pdata->version; + if (gpi_string_to_enum(val, &ver, udev_version_t_map)) { FATAL("Unrecognized udev version: \"%s\"", val); } @@ -724,7 +725,7 @@ ddb_camera_func (const func_params_t *params, const CameraAbilities *a, void *data) { - const char *camlib_basename = basename(a->library); + const char *camlib_basename = path_basename(a->library); int head_printed = 0; #define DELAYED_HEAD() \ do { \ diff --git a/tests/test-camera-list.c b/tests/test-camera-list.c index 1555023cb..fa0fda625 100644 --- a/tests/test-camera-list.c +++ b/tests/test-camera-list.c @@ -97,7 +97,7 @@ print_hline (void) /** C equivalent of basename(1) */ static const char * -basename (const char *pathname) +path_basename (const char *pathname) { char *result, *tmp; /* remove path part from camlib name */ @@ -166,7 +166,7 @@ parse_command_line (const int argc, char *argv[]) } else if (strcmp(argv[i], "--format=camlibs") == 0) { format = FMT_FLAT_CAMLIBS; } else { - const char * const bn = basename(argv[0]); + const char * const bn = path_basename(argv[0]); printf("Unknown command line parameter %d: \"%s\"\n", i, argv[i]); printf("Sorry, no more help to give but the " @@ -255,7 +255,7 @@ main (int argc, char *argv[]) CameraAbilities abilities; const char *camlib_basename; CHECK (gp_abilities_list_get_abilities (al, i, &abilities)); - camlib_basename = basename(abilities.library); + camlib_basename = path_basename(abilities.library); switch (format) { case FMT_HEADED_TEXT: |