Fix ricoh camlib compilation warnings.

* g3.c:
  * get_file_func(...): Change variable 'seek' type to 'int'. Currently 'sscanf' already reads a signed decimal into 'seek' and a following comparison uses negative constant (-2). This change should not change behavior in practice.
  * folder_list_func(...): Variable 'n' is used in trivial 'for' loop already as unsigned so change the the type accordingly. No behavior changes.
  * file_list_func(...): Same as above.
* library.c:
  * camera_init(...): Add cast to 'unsigned int' to avoid signed-unsigned compare warning. This does not change code behavior.
This commit is contained in:
Siim Meerits
2020-08-13 00:45:52 +03:00
committed by Marcus Meissner
parent b93507aca1
commit 950e39f9dc
2 changed files with 6 additions and 4 deletions

View File

@@ -358,7 +358,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
{
Camera *camera = data;
char *buf = NULL, *reply = NULL, *cmd =NULL, *msg = NULL;
unsigned int len, bytes, seek;
unsigned int len, bytes;
int seek;
int ret, channel;
ret = g3_cwd_command (camera->port, folder);
@@ -758,7 +759,7 @@ folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
free(cmd);cmd = NULL;
if (ret < GP_OK) goto out;
if (buf[0] == '1') { /* 1xx means another reply follows */
int n = 0;
unsigned int n = 0;
ret = g3_channel_read(camera->port, &channel, &buf, &len); /* data. */
if (ret < GP_OK) goto out;
@@ -805,7 +806,8 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
free(cmd); cmd = NULL;
if (ret < GP_OK) goto out;
if (buf[0] == '1') { /* 1xx means another reply follows */
int n = 0, channel;
unsigned int n = 0;
int channel;
unsigned int len, rlen;
ret = g3_channel_read(camera->port, &channel, &buf, &len); /* data. */
if (ret < GP_OK) goto out;

View File

@@ -565,7 +565,7 @@ camera_init (Camera *camera, GPContext *context)
}
/* Contact made. Do we need to change the speed? */
if (settings.serial.speed != speed) {
if ((unsigned int)settings.serial.speed != speed) {
for (i = 0; speeds[i].speed; i++)
if (speeds[i].speed == speed)
break;