diff options
| author | bigbear <ns@bigbear.dk> | 2024-02-08 02:57:20 +0100 | 
|---|---|---|
| committer | bigbear <ns@bigbear.dk> | 2024-02-08 19:52:53 +0100 | 
| commit | 08e01f35f747bfe30a40ea99cbcd63ad7fb94e7e (patch) | |
| tree | a727faeb3ffb38d523b0700a63e6e537d295a152 | |
| parent | 4c249cfdc742d162fdb384fba61236cada3d9f29 (diff) | |
FIX GCC Warnings
| -rw-r--r-- | deps/uber-graph/g-ring.c | 8 | ||||
| -rw-r--r-- | deps/uber-graph/uber-line-graph.c | 28 | ||||
| -rw-r--r-- | deps/uber-graph/uber-scatter.c | 10 | ||||
| -rw-r--r-- | deps/uber-graph/uber-timeout-interval.c | 2 | ||||
| -rw-r--r-- | hardinfo2/info.c | 6 | ||||
| -rw-r--r-- | hardinfo2/vendor.c | 2 | ||||
| -rw-r--r-- | modules/benchmark.c | 4 | ||||
| -rw-r--r-- | modules/benchmark/cryptohash.c | 4 | ||||
| -rw-r--r-- | modules/computer.c | 4 | ||||
| -rw-r--r-- | modules/devices.c | 6 | ||||
| -rw-r--r-- | modules/devices/battery.c | 2 | ||||
| -rw-r--r-- | modules/devices/dmi.c | 5 | ||||
| -rw-r--r-- | modules/devices/inputdevices.c | 2 | ||||
| -rw-r--r-- | modules/devices/pci.c | 2 | ||||
| -rw-r--r-- | modules/devices/printers.c | 4 | ||||
| -rw-r--r-- | modules/devices/resources.c | 2 | ||||
| -rw-r--r-- | modules/devices/x86/processor.c | 2 | ||||
| -rw-r--r-- | modules/network/net.c | 2 | ||||
| -rw-r--r-- | shell/shell.c | 10 | ||||
| -rw-r--r-- | shell/stock.c | 2 | 
20 files changed, 54 insertions, 53 deletions
| diff --git a/deps/uber-graph/g-ring.c b/deps/uber-graph/g-ring.c index d865cc15..b014bf74 100644 --- a/deps/uber-graph/g-ring.c +++ b/deps/uber-graph/g-ring.c @@ -86,13 +86,13 @@ g_ring_append_vals (GRing         *ring,  	GRingImpl *ring_impl = (GRingImpl *)ring;  	gpointer idx;  	gint x; -	gint i; +	guint i;  	g_return_if_fail(ring_impl != NULL);  	for (i = 0; i < len; i++) { -		x = ring->pos - i; -		x = (x >= 0) ? x : ring->len + x; +	        x = (int)ring->pos - i; +		if (x < 0) x += ring->len;  		idx = ring->data + (ring_impl->elt_size * x);  		if (ring_impl->destroy && ring_impl->looped == TRUE) {  			ring_impl->destroy(idx); @@ -133,7 +133,7 @@ g_ring_foreach (GRing    *ring,  	for (i = ring_impl->pos - 1; i >= 0; i--) {  		func(get_element(ring_impl, i), user_data);  	} -	for (i = ring->len - 1; i >= ring_impl->pos; i--) { +	for (i = ring->len - 1; i >= (int)ring_impl->pos; i--) {  		func(get_element(ring_impl, i), user_data);  	}  } diff --git a/deps/uber-graph/uber-line-graph.c b/deps/uber-graph/uber-line-graph.c index 2e42ed60..776f5363 100644 --- a/deps/uber-graph/uber-line-graph.c +++ b/deps/uber-graph/uber-line-graph.c @@ -91,7 +91,7 @@ static inline void  uber_line_graph_init_ring (GRing *ring) /* IN */  {  	gdouble val = UBER_LINE_GRAPH_NO_VALUE; -	gint i; +	guint i;  	g_return_if_fail(ring != NULL); @@ -133,7 +133,7 @@ uber_line_graph_color_changed (UberLabel     *label, /* IN */  {  	UberLineGraphPrivate *priv;  	LineInfo *info; -	gint i; +	guint i;  	g_return_if_fail(UBER_IS_LINE_GRAPH(graph));  	g_return_if_fail(color != NULL); @@ -328,7 +328,7 @@ uber_line_graph_get_next_data (UberGraph *graph) /* IN */  	gboolean ret = FALSE;  	LineInfo *line;  	gdouble val; -	gint i; +	guint i;  	g_return_val_if_fail(UBER_IS_LINE_GRAPH(graph), FALSE); @@ -458,7 +458,7 @@ uber_line_graph_render_line (UberLineGraph *graph, /* IN */  	gdouble y;  	gdouble last_y;  	gdouble val; -	gint i; +	guint i;  	g_return_if_fail(UBER_IS_LINE_GRAPH(graph)); @@ -482,7 +482,7 @@ uber_line_graph_render_line (UberLineGraph *graph, /* IN */  		/*  		 * Retrieve data point.  		 */ -		val = g_ring_get_index(line->raw_data, gdouble, i); +                val = g_ring_get_index(line->raw_data, gdouble, (int)i);  		/*  		 * Once we get to UBER_LINE_GRAPH_NO_VALUE, we must be at the end of the data  		 * sequence.  This may not always be true in the future. @@ -546,7 +546,7 @@ uber_line_graph_render (UberGraph    *graph, /* IN */  {  	UberLineGraphPrivate *priv;  	LineInfo *line; -	gint i; +	guint i;  	g_return_if_fail(UBER_IS_LINE_GRAPH(graph)); @@ -582,7 +582,7 @@ uber_line_graph_render_fast (UberGraph    *graph, /* IN */  	LineInfo *line;  	gdouble last_y;  	gdouble y; -	gint i; +	guint i;  	g_return_if_fail(UBER_IS_LINE_GRAPH(graph));  	g_return_if_fail(cr != NULL); @@ -653,7 +653,7 @@ uber_line_graph_set_stride (UberGraph *graph,  /* IN */  {  	UberLineGraphPrivate *priv;  	LineInfo *line; -	gint i; +	guint i;  	g_return_if_fail(UBER_IS_LINE_GRAPH(graph)); @@ -793,7 +793,7 @@ uber_line_graph_set_line_width (UberLineGraph *graph, /* IN */  	g_return_if_fail(UBER_IS_LINE_GRAPH(graph));  	g_return_if_fail(line > 0); -	g_return_if_fail(line <= graph->priv->lines->len); +	g_return_if_fail(line <= (int)graph->priv->lines->len);  	info = &g_array_index(graph->priv->lines, LineInfo, line - 1);  	info->width = width; @@ -817,8 +817,8 @@ uber_line_graph_downscale (UberGraph *graph) /* IN */  	gdouble val = 0;  	gdouble cur;  	LineInfo *line; -	gint i; -	gint j; +	guint i; +	guint j;  	g_return_val_if_fail(UBER_IS_LINE_GRAPH(graph), FALSE); @@ -835,7 +835,7 @@ uber_line_graph_downscale (UberGraph *graph) /* IN */  	for (i = 0; i < priv->lines->len; i++) {  		line = &g_array_index(priv->lines, LineInfo, i);  		for (j = 0; j < line->raw_data->len; j++) { -			cur = g_ring_get_index(line->raw_data, gdouble, j); +		  cur = g_ring_get_index(line->raw_data, gdouble, (int)j);  			val = (cur > val) ? cur : val;  		}  	} @@ -867,7 +867,7 @@ uber_line_graph_finalize (GObject *object) /* IN */  {  	UberLineGraphPrivate *priv;  	LineInfo *line; -	gint i; +	guint i;  	priv = UBER_LINE_GRAPH(object)->priv;  	/* @@ -1019,7 +1019,7 @@ uber_line_graph_clear (UberLineGraph *graph) /* IN */  {  	UberLineGraphPrivate *priv = graph->priv;  	LineInfo *line; -	gint i; +	guint i;  	for (i = 0; i < priv->lines->len; i++) {  		line = &g_array_index(priv->lines, LineInfo, i); diff --git a/deps/uber-graph/uber-scatter.c b/deps/uber-graph/uber-scatter.c index 1889cfa8..56c7b00d 100644 --- a/deps/uber-graph/uber-scatter.c +++ b/deps/uber-graph/uber-scatter.c @@ -43,7 +43,7 @@ struct _UberScatterPrivate  {  	GRing           *raw_data;  	UberRange        range; -	gint             stride; +	guint            stride;  	GdkRGBA          fg_color;  	gboolean         fg_color_set;  	UberScatterFunc  func; @@ -173,8 +173,8 @@ uber_scatter_render (UberGraph     *graph, /* IN */  	GArray *ar;  	gdouble x;  	gdouble y; -	gint i; -	gint j; +	guint i; +	guint j;  	g_return_if_fail(UBER_IS_SCATTER(graph)); @@ -194,7 +194,7 @@ uber_scatter_render (UberGraph     *graph, /* IN */  	 * Retrieve the current data set.  	 */  	for (i = 0; i < priv->raw_data->len; i++) { -		if (!(ar = g_ring_get_index(priv->raw_data, GArray*, i))) { +	  if (!(ar = g_ring_get_index(priv->raw_data, GArray*, (int)i))) {  			continue;  		}  		x = epoch - (i * each) - (each / 2.); @@ -244,7 +244,7 @@ uber_scatter_render_fast (UberGraph    *graph, /* IN */  	GArray *ar;  	gdouble x;  	gdouble y; -	gint i; +	guint i;  	g_return_if_fail(UBER_IS_SCATTER(graph)); diff --git a/deps/uber-graph/uber-timeout-interval.c b/deps/uber-graph/uber-timeout-interval.c index 4a4cf52a..baabbcca 100644 --- a/deps/uber-graph/uber-timeout-interval.c +++ b/deps/uber-graph/uber-timeout-interval.c @@ -61,7 +61,7 @@ _uber_timeout_interval_prepare (gint64         current_time,                                     UberTimeoutInterval *interval,                                     gint                   *delay)  { -  gint elapsed_time, new_frame_num; +  guint elapsed_time, new_frame_num;    elapsed_time = _uber_timeout_interval_get_ticks (current_time, interval);    new_frame_num = elapsed_time * interval->fps / 1000; diff --git a/hardinfo2/info.c b/hardinfo2/info.c index 6fbb0f35..fae16497 100644 --- a/hardinfo2/info.c +++ b/hardinfo2/info.c @@ -172,7 +172,7 @@ void info_add_computed_group_wo_extra(struct Info *info, const gchar *name, cons  void info_set_column_title(struct Info *info, const gchar *column, const gchar *title)  { -    int i; +    guint i;      for (i = 0; i < G_N_ELEMENTS(info_column_titles); i++) {          if (g_str_equal(info_column_titles[i], column)) { @@ -380,7 +380,7 @@ static void flatten_shell_param(GString *output, const struct InfoGroup *group,  static void flatten_shell_param_global(GString *output, const struct Info *info)  { -    int i; +    guint i;      g_string_append_printf(output, "ViewType=%d\n", info->view_type);      g_string_append_printf(output, "ShowColumnHeaders=%s\n", @@ -457,7 +457,7 @@ void info_remove_group(struct Info *info, guint index)  struct InfoField *info_find_field(struct Info *info, const gchar *tag, const gchar *name) {      struct InfoGroup *group;      struct InfoField *field; -    int gi,fi; +    guint gi,fi;      for (gi = 0; gi < info->groups->len; gi++) {          struct InfoGroup *group = &g_array_index(info->groups, struct InfoGroup, gi);          for (fi = 0; fi < group->fields->len; fi++) { diff --git a/hardinfo2/vendor.c b/hardinfo2/vendor.c index bd3f52fe..469acaa2 100644 --- a/hardinfo2/vendor.c +++ b/hardinfo2/vendor.c @@ -64,7 +64,7 @@ static Vendor vendors_builtin[] = {      if (vendor_die_on_error) exit(-1); }  static vendor_list vendors = NULL; -const vendor_list get_vendors_list() { return vendors; } +vendor_list get_vendors_list() { return vendors; }  gboolean vendor_die_on_error = FALSE;  /* sort the vendor list by length of match_string, diff --git a/modules/benchmark.c b/modules/benchmark.c index 78dd32bb..6fe8adb4 100644 --- a/modules/benchmark.c +++ b/modules/benchmark.c @@ -755,7 +755,7 @@ static gchar *get_benchmark_results(gsize *len)      JsonNode *root;      bench_machine *this_machine;      gchar *out; -    gint i; +    guint i;      for (i = 0; i < G_N_ELEMENTS(entries); i++) {          if (!entries[i].name || !entries[i].scan_callback) @@ -905,7 +905,7 @@ void hi_module_init(void)      sync_manager_add_entry(&se[0]);      sync_manager_add_entry(&se[1]); -    int i; +    guint i;      for (i = 0; i < G_N_ELEMENTS(entries) - 1 /* account for NULL */; i++)          bench_results[i] = (bench_value)EMPTY_BENCH_VALUE;  } diff --git a/modules/benchmark/cryptohash.c b/modules/benchmark/cryptohash.c index add7ca03..32fcfd57 100644 --- a/modules/benchmark/cryptohash.c +++ b/modules/benchmark/cryptohash.c @@ -29,7 +29,7 @@  /* 5000*65536/(1024*1024) = 312.5 -- old version used 312.0 so results   * don't exactly compare. */ -void inline md5_step(char *data, glong srclen) +inline void md5_step(char *data, glong srclen)  {      struct MD5Context ctx;      guchar checksum[16]; @@ -39,7 +39,7 @@ void inline md5_step(char *data, glong srclen)      MD5Final(checksum, &ctx);  } -void inline sha1_step(char *data, glong srclen) +inline void sha1_step(char *data, glong srclen)  {      SHA1_CTX ctx;      guchar checksum[20]; diff --git a/modules/computer.c b/modules/computer.c index cfa6bb3c..fff8ba36 100644 --- a/modules/computer.c +++ b/modules/computer.c @@ -254,7 +254,7 @@ void scan_dev(gboolean reload)  {      SCAN_START(); -    int i; +    guint i;      struct {         gchar *compiler_name;         gchar *version_command; @@ -465,7 +465,7 @@ gchar *computer_get_virtualization(void)          "/var/log/dmesg",          NULL      }; -    const static struct { +    static const struct {          gchar *str;          gchar *vmtype;      } vm_types[] = { diff --git a/modules/devices.c b/modules/devices.c index 440e614a..574896ee 100644 --- a/modules/devices.c +++ b/modules/devices.c @@ -286,7 +286,7 @@ gchar *get_storage_devices_simple(void)          return "";      } -    int i, fi; +    guint i, fi;      struct InfoGroup *group;      struct InfoField *field;      gchar *storage_devs = NULL, *tmp; @@ -863,7 +863,7 @@ void hi_module_init(void)          },  #endif      }; -    gint i; +    guint i;      for (i = 0; i < G_N_ELEMENTS(entries); i++)          sync_manager_add_entry(&entries[i]); @@ -889,7 +889,7 @@ void hi_module_deinit(void)  const ModuleAbout *hi_module_get_about(void)  { -    const static ModuleAbout ma = { +    static const ModuleAbout ma = {          .author = "L. A. F. Pereira",          .description = N_("Gathers information about hardware devices"),          .version = VERSION, diff --git a/modules/devices/battery.c b/modules/devices/battery.c index 3424fa9d..e356c14a 100644 --- a/modules/devices/battery.c +++ b/modules/devices/battery.c @@ -57,7 +57,7 @@ __scan_battery_apcupsd(void)      GHashTable  *ups_data;      FILE	*apcaccess;      char	buffer[512], *apcaccess_path; -    int		i; +    guint		i;      apcaccess_path = find_program("apcaccess");      if (apcaccess_path && (apcaccess = popen(apcaccess_path, "r"))) { diff --git a/modules/devices/dmi.c b/modules/devices/dmi.c index 263d6944..64de77d9 100644 --- a/modules/devices/dmi.c +++ b/modules/devices/dmi.c @@ -72,7 +72,7 @@ gboolean dmi_get_info(void)      const gchar *group = NULL;      DMIInfo *info;      gboolean dmi_succeeded = FALSE; -    gint i; +    guint i;      gchar *value;      const gchar *vendor; @@ -102,7 +102,8 @@ gboolean dmi_get_info(void)                      state = (getuid() == 0) ? 0 : 1;                      break;                  case -1: -                    state = 2; +		  state = 2; +		    break;                  case 1:                      value = dmi_get_str_abs(info->id_str);                      break; diff --git a/modules/devices/inputdevices.c b/modules/devices/inputdevices.c index 54828b79..301641d4 100644 --- a/modules/devices/inputdevices.c +++ b/modules/devices/inputdevices.c @@ -113,7 +113,7 @@ __scan_input_devices(void)                  usb_lookup_ids_vendor_product_str(vendor, product, &vendor_str, &product_str);              } -            if (bus >= 0 && bus < sizeof(bus_types) / sizeof(gchar*)) { +            if (bus >= 0 && (guint)bus < sizeof(bus_types) / sizeof(gchar*)) {                  bus_str = bus_types[bus];              } diff --git a/modules/devices/pci.c b/modules/devices/pci.c index c7114672..859fa339 100644 --- a/modules/devices/pci.c +++ b/modules/devices/pci.c @@ -45,7 +45,7 @@ static const struct {  static const gchar *find_icon_for_class(uint32_t class)  { -    int i; +    guint i;      for (i = 0; i < G_N_ELEMENTS(class2icon); i++) {  	if (class2icon[i].class <= 0xff) { diff --git a/modules/devices/printers.c b/modules/devices/printers.c index e849e1dc..fb9389ac 100644 --- a/modules/devices/printers.c +++ b/modules/devices/printers.c @@ -181,7 +181,7 @@ const struct {  void  scan_printers_do(void)  { -    int num_dests, i, j; +    guint num_dests, j, i;      CUPSDest *dests;      gchar *prn_id, *prn_moreinfo; @@ -209,7 +209,7 @@ scan_printers_do(void)  	    options = g_hash_table_new(g_str_hash, g_str_equal); -	    for (j = 0; j < dests[i].num_options; j++) { +	    for (j = 0; (int)j < dests[i].num_options; j++) {  	      g_hash_table_insert(options,  	                          g_strdup(dests[i].options[j].name),  	                          g_strdup(dests[i].options[j].value)); diff --git a/modules/devices/resources.c b/modules/devices/resources.c index 1436192d..c9d1ccb5 100644 --- a/modules/devices/resources.c +++ b/modules/devices/resources.c @@ -72,7 +72,7 @@ void scan_device_resources(gboolean reload)      SCAN_START();      FILE *io;      gchar buffer[256]; -    gint i; +    guint i;      gint zero_to_zero_addr = 0;      struct { diff --git a/modules/devices/x86/processor.c b/modules/devices/x86/processor.c index 62d32135..518786b5 100644 --- a/modules/devices/x86/processor.c +++ b/modules/devices/x86/processor.c @@ -685,7 +685,7 @@ gchar *processor_describe(GSList * processors) {  gchar *dmi_socket_info() {      gchar *ret;      dmi_type dt = 4; -    int i; +    guint i;      dmi_handle_list *hl = dmidecode_handles(&dt);      if (!hl) { diff --git a/modules/network/net.c b/modules/network/net.c index 535461e4..9a5cb5f1 100644 --- a/modules/network/net.c +++ b/modules/network/net.c @@ -146,7 +146,7 @@ void get_wireless_info(int fd, NetInfo *netinfo)    if (ioctl(fd, SIOCGIWMODE, &wi_req) < 0) {      netinfo->wi_mode = 0;    } else { -    if (wi_req.u.mode >= 0 && wi_req.u.mode < 6) { +    if (wi_req.u.mode < 6) {        netinfo->wi_mode = wi_req.u.mode;      } else {        netinfo->wi_mode = 6; diff --git a/shell/shell.c b/shell/shell.c index 166e7232..81f3e084 100644 --- a/shell/shell.c +++ b/shell/shell.c @@ -2369,19 +2369,19 @@ void key_get_components(const gchar *key,          gchar *f = g_strdup(key);          gchar *s = g_utf8_strchr(f+1, -1, '$');          if(s==NULL) { -	    DEBUG("key_get_components_ERROR NOT FOUND"); +	    DEBUG("ERROR NOT FOUND");          }else{ -	    if((s-f+1)>strlen(key)) { -	    DEBUG("key_get_components_ERROR NOT FOUND"); -	}else{ + /*            if((s-f+1)>strlen(key)) { +	    DEBUG("ERROR TOO LATE"); +        }else{*/  	  *(g_utf8_strchr(f+1, -1, '$') + 1) = 0;  	  if (flags)  	    *flags = g_strdup(f);  	  if (tag)  	    *tag = key_mi_tag(f);  	  g_free(f); +	  //}  	} -      }      } else          np = key; diff --git a/shell/stock.c b/shell/stock.c index de5fc72c..27b2eedb 100644 --- a/shell/stock.c +++ b/shell/stock.c @@ -75,7 +75,7 @@ void stock_icon_register_pixbuf(GdkPixbuf * pixbuf, gchar * stock_id)  void stock_icons_init(void)  { -    gint i; +    guint i;      guint n_stock_icons = G_N_ELEMENTS(stock_icons);      DEBUG("initializing stock icons"); | 
