summaryrefslogtreecommitdiff
path: root/libgphoto2_port/libgphoto2_port
diff options
context:
space:
mode:
authorSiim Meerits <sh0@yutani.ee>2020-08-02 22:10:20 +0300
committerMarcus Meissner <marcus@jet.franken.de>2020-08-27 16:51:13 +0200
commit6818e136edeefb0dcd73f83838b908e829c74ee9 (patch)
tree80cb8a91bed34a4f84410a5b27a5c8158c61b4ce /libgphoto2_port/libgphoto2_port
parent5ebc28fc46710f6c5942707b1d0e83aea501d2d3 (diff)
downloadlibgphoto2-6818e136edeefb0dcd73f83838b908e829c74ee9.tar.gz
Fix libgphoto2_port compilation warnings.
* gphoto2-port-info-list.c: * gp_port_info_list_append(...): Variables 'generic' and 'i' are changed to unsigned types as they are used in trivial 'for' loops already in unsigned comparison mode. * gp_port_info_list_get_info(...): Cast variable 'n' to unsigned in two places to avoid signed-unsigned compare warnings. This does not change behavior. * gphoto2-port-log.c: * gp_log_remove_func(...): Change variable 'i' to unsigned type as it is used in trivial 'for' loop in unsigned comparison mode. Also casts variable 'id' to unsigned to avoid signed-unsigned comparison. This does not change code behavior.
Diffstat (limited to 'libgphoto2_port/libgphoto2_port')
-rw-r--r--libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c6
-rw-r--r--libgphoto2_port/libgphoto2_port/gphoto2-port-log.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
index 9ea85f030..d923734a6 100644
--- a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
+++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
@@ -176,7 +176,7 @@ gp_port_info_list_free (GPPortInfoList *list)
int
gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info)
{
- int generic, i;
+ unsigned int generic, i;
C_PARAMS (list);
@@ -465,13 +465,13 @@ gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info)
GP_LOG_D ("Getting info of entry %i (%i available)...", n, list->count);
- C_PARAMS (n >= 0 && n < list->count);
+ C_PARAMS (n >= 0 && (unsigned int)n < list->count);
/* Ignore generic entries */
for (i = 0; i <= n; i++)
if (!strlen (list->info[i]->name)) {
n++;
- C_PARAMS (n < list->count);
+ C_PARAMS ((unsigned int)n < list->count);
}
*info = list->info[n];
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-log.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-log.c
index df63197d7..6ed9c8ceb 100644
--- a/libgphoto2_port/libgphoto2_port/gphoto2-port-log.c
+++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-log.c
@@ -137,10 +137,10 @@ gpi_vsnprintf (const char* format, va_list args)
int
gp_log_remove_func (int id)
{
- int i;
+ unsigned int i;
for (i=0;i<log_funcs_count;i++) {
- if (log_funcs[i].id == id) {
+ if (log_funcs[i].id == (unsigned int)id) {
memmove (log_funcs + i, log_funcs + i + 1, sizeof(LogFunc) * (log_funcs_count - i - 1));
log_funcs_count--;
return GP_OK;