Some small fixes

Merged Pablo Correa Gomez requested to merge pabloyoyoista/gnome-maps:some-fixes into main


maps-osm: Make sure all variables are initialized

Silence the following warnings

../lib/maps-osm.c: In function 'maps_osm_parse':
../lib/maps-osm.c:471:10: warning: 'object' may be used uninitialized [-Wmaybe-uninitialized]
  471 |   return object;
      |          ^~~~~~
../lib/maps-osm.c:439:18: note: 'object' was declared here
  439 |   MapsOSMObject *object;
      |                  ^~~~~~
In function 'fill_members',
    inlined from 'parse_relation' at ../lib/maps-osm.c:421:3,
    inlined from 'maps_osm_parse' at ../lib/maps-osm.c:465:32:
../lib/maps-osm.c:375:5: warning: 'ref' may be used uninitialized [-Wmaybe-uninitialized]
  375 |     maps_osm_relation_add_member (relation, role, type, ref);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/maps-osm.c: In function 'maps_osm_parse':
../lib/maps-osm.c:358:13: note: 'ref' was declared here
  358 |     guint64 ref;
      |             ^~~

Second is #506 (closed)


    maps-osm: Fix g_str_equal warnings from GLib >= 2.74                                                                                                                                                                                      
    GLib 2.74 introduced an optimization for string comparison[1], but                                                                                                                                                                        
    that generates warnings similar to the following:                                                                                                                                                                                         
    In file included from /usr/include/glib-2.0/glib.h:52,                                                                                                                                                                                    
                     from ../lib/maps-osm.h:23,                                                                                                                                                                                               
                     from ../lib/maps-osm.c:20:                                                                                                                                                                                               
    ../lib/maps-osm.c: In function 'parse_tag':                                                                                                                                                                                               
    ../lib/maps-osm.c:75:32: warning: pointer targets in passing argument 1 of 'strcmp' differ in signedness [-Wpointer-sign]                                                                                                                 
       75 |       if (g_str_equal (cur_attr->name, "k"))                                                                                                                                                                                      
    /usr/include/glib-2.0/glib/ghash.h:165:39: note: in definition of macro 'g_str_equal'                                                                                                                                                     
      165 | #define g_str_equal(v1, v2) (strcmp ((v1), (v2)) == 0)                                                                                                                                                                            
          |                                       ^~                                                                                                                                                                                          
    In file included from /usr/include/fortify/string.h:22,                                                                                                                                                                                   
                     from /usr/include/glib-2.0/glib/galloca.h:35,                                                                                                                                                                            
                     from /usr/include/glib-2.0/glib.h:32:                                                                                                                                                                                    
    /usr/include/string.h:39:13: note: expected 'const char *' but argument is of type 'const xmlChar *' {aka 'const unsigned char *'}                                                                                                        
       39 | int strcmp (const char *, const char *);                                                                                                                                                                                          
          |             ^~~~~~~~~~~~
    Silence the warnings by casting the pointers to the correct type
Edited by Pablo Correa Gomez

Merge request reports