diff options
author | rbuj <[email protected]> | 2021-02-21 10:30:00 +0100 |
---|---|---|
committer | Luke from DC <[email protected]> | 2021-02-25 04:07:11 +0000 |
commit | 61ab4b0088628429259810780a7d9360863fe3df (patch) | |
tree | 378187421ebc50706ff8b7fab1494896f5e9e0cb /src | |
parent | 8ffff0ec396a40caa9251ac78597ff70ae1df4d1 (diff) | |
download | caja-61ab4b0088628429259810780a7d9360863fe3df.tar.bz2 caja-61ab4b0088628429259810780a7d9360863fe3df.tar.xz |
Fix warnings about xmlChar cast
Diffstat (limited to 'src')
-rw-r--r-- | src/caja-application.c | 116 | ||||
-rw-r--r-- | src/caja-property-browser.c | 84 |
2 files changed, 105 insertions, 95 deletions
diff --git a/src/caja-application.c b/src/caja-application.c index 461bbfd5..bb90a504 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -1390,12 +1390,12 @@ caja_application_get_session_data (CajaApplication *self) xmlSaveCtxtPtr ctx; xmlBufferPtr buffer; - doc = xmlNewDoc ("1.0"); + doc = xmlNewDoc ((const xmlChar *) "1.0"); - root_node = xmlNewNode (NULL, "session"); + root_node = xmlNewNode (NULL, (const xmlChar *) "session"); xmlDocSetRootElement (doc, root_node); - history_node = xmlNewChild (root_node, NULL, "history", NULL); + history_node = xmlNewChild (root_node, NULL, (const xmlChar *) "history", NULL); n_processed = 0; for (l = caja_get_history_list (); l != NULL; l = l->next) { @@ -1406,10 +1406,10 @@ caja_application_get_session_data (CajaApplication *self) bookmark = l->data; - bookmark_node = xmlNewChild (history_node, NULL, "bookmark", NULL); + bookmark_node = xmlNewChild (history_node, NULL, (const xmlChar *) "bookmark", NULL); tmp = caja_bookmark_get_name (bookmark); - xmlNewProp (bookmark_node, "name", tmp); + xmlNewProp (bookmark_node, (const xmlChar *) "name", (const xmlChar *) tmp); g_free (tmp); icon = caja_bookmark_get_icon (bookmark); @@ -1417,16 +1417,16 @@ caja_application_get_session_data (CajaApplication *self) tmp = g_icon_to_string (icon); g_object_unref (icon); if (tmp) { - xmlNewProp (bookmark_node, "icon", tmp); + xmlNewProp (bookmark_node, (const xmlChar *) "icon", (const xmlChar *) tmp); g_free (tmp); } tmp = caja_bookmark_get_uri (bookmark); - xmlNewProp (bookmark_node, "uri", tmp); + xmlNewProp (bookmark_node, (const xmlChar *) "uri", (const xmlChar *) tmp); g_free (tmp); if (caja_bookmark_get_has_custom_name (bookmark)) { - xmlNewProp (bookmark_node, "has_custom_name", "TRUE"); + xmlNewProp (bookmark_node, (const xmlChar *) "has_custom_name", (const xmlChar *) "TRUE"); } if (++n_processed > 50) { /* prevent history list from growing arbitrarily large. */ @@ -1457,49 +1457,49 @@ caja_application_get_session_data (CajaApplication *self) continue; } - win_node = xmlNewChild (root_node, NULL, "window", NULL); + win_node = xmlNewChild (root_node, NULL, (const xmlChar *) "window", NULL); - xmlNewProp (win_node, "location", tmp); + xmlNewProp (win_node, (const xmlChar *) "location", (const xmlChar *) tmp); g_free (tmp); - xmlNewProp (win_node, "type", CAJA_IS_NAVIGATION_WINDOW (window) ? "navigation" : "spatial"); + xmlNewProp (win_node, (const xmlChar *) "type", CAJA_IS_NAVIGATION_WINDOW (window) ? (const xmlChar *) "navigation" : (const xmlChar *) "spatial"); if (CAJA_IS_NAVIGATION_WINDOW (window)) { /* spatial windows store their state as file metadata */ GdkWindow *gdk_window; tmp = eel_gtk_window_get_geometry_string (GTK_WINDOW (window)); - xmlNewProp (win_node, "geometry", tmp); + xmlNewProp (win_node, (const xmlChar *) "geometry", (const xmlChar *) tmp); g_free (tmp); gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); if (gdk_window && gdk_window_get_state (gdk_window) & GDK_WINDOW_STATE_MAXIMIZED) { - xmlNewProp (win_node, "maximized", "TRUE"); + xmlNewProp (win_node, (const xmlChar *) "maximized", (const xmlChar *) "TRUE"); } if (gdk_window && gdk_window_get_state (gdk_window) & GDK_WINDOW_STATE_STICKY) { - xmlNewProp (win_node, "sticky", "TRUE"); + xmlNewProp (win_node, (const xmlChar *) "sticky", (const xmlChar *) "TRUE"); } if (gdk_window && gdk_window_get_state (gdk_window) & GDK_WINDOW_STATE_ABOVE) { - xmlNewProp (win_node, "keep-above", "TRUE"); + xmlNewProp (win_node, (const xmlChar *) "keep-above", (const xmlChar *) "TRUE"); } } for (m = slots; m != NULL; m = m->next) { slot = CAJA_WINDOW_SLOT (m->data); - slot_node = xmlNewChild (win_node, NULL, "slot", NULL); + slot_node = xmlNewChild (win_node, NULL, (const xmlChar *) "slot", NULL); tmp = caja_window_slot_get_location_uri (slot); - xmlNewProp (slot_node, "location", tmp); + xmlNewProp (slot_node, (const xmlChar *) "location", (const xmlChar *) tmp); g_free (tmp); if (slot == active_slot) { - xmlNewProp (slot_node, "active", "TRUE"); + xmlNewProp (slot_node, (const xmlChar *) "active", (const xmlChar *) "TRUE"); } } @@ -1515,7 +1515,7 @@ caja_application_get_session_data (CajaApplication *self) } xmlSaveClose(ctx); - data = g_strndup (buffer->content, buffer->use); + data = g_strndup ((const char *) buffer->content, buffer->use); xmlBufferFree (buffer); xmlFreeDoc (doc); @@ -1564,12 +1564,13 @@ caja_application_load_session (CajaApplication *application) for (node = root_node->children; node != NULL; node = node->next) { - - if (g_strcmp0 (node->name, "text") == 0) + if (node->name == NULL || *node->name == '\0' || + xmlStrcmp (node->name, (const xmlChar *) "text") == 0) { continue; } - else if (g_strcmp0 (node->name, "history") == 0) + + if (xmlStrcmp (node->name, (const xmlChar *) "history") == 0) { xmlNodePtr bookmark_node; gboolean emit_change; @@ -1578,29 +1579,31 @@ caja_application_load_session (CajaApplication *application) for (bookmark_node = node->children; bookmark_node != NULL; bookmark_node = bookmark_node->next) { - if (g_strcmp0 (bookmark_node->name, "text") == 0) + if (bookmark_node->name == NULL || *bookmark_node->name == '\0' || + xmlStrcmp (bookmark_node->name, (const xmlChar *) "text") == 0) { continue; } - else if (g_strcmp0 (bookmark_node->name, "bookmark") == 0) + + if (xmlStrcmp (bookmark_node->name, (const xmlChar *) "bookmark") == 0) { xmlChar *name, *icon_str, *uri; gboolean has_custom_name; GIcon *icon; GFile *location; - uri = xmlGetProp (bookmark_node, "uri"); - name = xmlGetProp (bookmark_node, "name"); - has_custom_name = xmlHasProp (bookmark_node, "has_custom_name") ? TRUE : FALSE; - icon_str = xmlGetProp (bookmark_node, "icon"); + uri = xmlGetProp (bookmark_node, (const xmlChar *) "uri"); + name = xmlGetProp (bookmark_node, (const xmlChar *) "name"); + has_custom_name = xmlHasProp (bookmark_node, (const xmlChar *) "has_custom_name") ? TRUE : FALSE; + icon_str = xmlGetProp (bookmark_node, (const xmlChar *) "icon"); icon = NULL; if (icon_str) { - icon = g_icon_new_for_string (icon_str, NULL); + icon = g_icon_new_for_string ((const char *) icon_str, NULL); } - location = g_file_new_for_uri (uri); + location = g_file_new_for_uri ((const char *) uri); - emit_change |= caja_add_to_history_list_no_notify (location, name, has_custom_name, icon); + emit_change |= caja_add_to_history_list_no_notify (location, (const char *) name, has_custom_name, icon); g_object_unref (location); @@ -1626,7 +1629,7 @@ caja_application_load_session (CajaApplication *application) } } - else if (g_strcmp0 (node->name, "window") == 0) + else if (xmlStrcmp (node->name, (const xmlChar *) "window") == 0) { CajaWindow *window; @@ -1634,7 +1637,7 @@ caja_application_load_session (CajaApplication *application) xmlNodePtr slot_node; GFile *location; - type = xmlGetProp (node, "type"); + type = xmlGetProp (node, (const xmlChar *) "type"); if (type == NULL) { g_message ("empty type node while parsing session data"); @@ -1642,7 +1645,7 @@ caja_application_load_session (CajaApplication *application) continue; } - location_uri = xmlGetProp (node, "location"); + location_uri = xmlGetProp (node, (const xmlChar *) "location"); if (location_uri == NULL) { g_message ("empty location node while parsing session data"); @@ -1651,25 +1654,24 @@ caja_application_load_session (CajaApplication *application) continue; } - if (g_strcmp0 (type, "navigation") == 0) + if (xmlStrcmp (type, (const xmlChar *) "navigation") == 0) { xmlChar *geometry; int i; window = caja_application_create_navigation_window (application, gdk_screen_get_default ()); - geometry = xmlGetProp (node, "geometry"); - if (geometry != NULL) + geometry = xmlGetProp (node, (const xmlChar *) "geometry"); + if (geometry != NULL && *geometry != '\0') { - eel_gtk_window_set_initial_geometry_from_string - (GTK_WINDOW (window), - geometry, - CAJA_NAVIGATION_WINDOW_MIN_WIDTH, - CAJA_NAVIGATION_WINDOW_MIN_HEIGHT, - FALSE); + eel_gtk_window_set_initial_geometry_from_string (GTK_WINDOW (window), + (const char *) geometry, + CAJA_NAVIGATION_WINDOW_MIN_WIDTH, + CAJA_NAVIGATION_WINDOW_MIN_HEIGHT, + FALSE); } xmlFree (geometry); - if (xmlHasProp (node, "maximized")) + if (xmlHasProp (node, (const xmlChar *) "maximized")) { gtk_window_maximize (GTK_WINDOW (window)); } @@ -1678,7 +1680,7 @@ caja_application_load_session (CajaApplication *application) gtk_window_unmaximize (GTK_WINDOW (window)); } - if (xmlHasProp (node, "sticky")) + if (xmlHasProp (node, (const xmlChar *) "sticky")) { gtk_window_stick (GTK_WINDOW (window)); } @@ -1687,7 +1689,7 @@ caja_application_load_session (CajaApplication *application) gtk_window_unstick (GTK_WINDOW (window)); } - if (xmlHasProp (node, "keep-above")) + if (xmlHasProp (node, (const xmlChar *) "keep-above")) { gtk_window_set_keep_above (GTK_WINDOW (window), TRUE); } @@ -1698,11 +1700,11 @@ caja_application_load_session (CajaApplication *application) for (i = 0, slot_node = node->children; slot_node != NULL; slot_node = slot_node->next) { - if (g_strcmp0 (slot_node->name, "slot") == 0) + if (slot_node->name && xmlStrcmp (slot_node->name, (const xmlChar *) "slot") == 0) { xmlChar *slot_uri; - slot_uri = xmlGetProp (slot_node, "location"); + slot_uri = xmlGetProp (slot_node, (const xmlChar *) "location"); if (slot_uri != NULL) { CajaWindowSlot *slot; @@ -1716,10 +1718,10 @@ caja_application_load_session (CajaApplication *application) slot = caja_window_open_slot (window->details->active_pane, CAJA_WINDOW_OPEN_SLOT_APPEND); } - location = g_file_new_for_uri (slot_uri); + location = g_file_new_for_uri ((const char *) slot_uri); caja_window_slot_open_location (slot, location, FALSE); - if (xmlHasProp (slot_node, "active")) + if (xmlHasProp (slot_node, (const xmlChar *) "active")) { caja_window_set_active_slot (slot->pane->window, slot); } @@ -1733,20 +1735,18 @@ caja_application_load_session (CajaApplication *application) if (i == 0) { /* This may be an old session file */ - location = g_file_new_for_uri (location_uri); + location = g_file_new_for_uri ((const char *) location_uri); caja_window_slot_open_location (window->details->active_pane->active_slot, location, FALSE); g_object_unref (location); } } - else if (g_strcmp0 (type, "spatial") == 0) + else if (xmlStrcmp (type, (const xmlChar *) "spatial") == 0) { - location = g_file_new_for_uri (location_uri); + location = g_file_new_for_uri ((const char *) location_uri); window = caja_application_get_spatial_window (application, NULL, NULL, - location, gdk_screen_get_default (), - NULL); - - caja_window_go_to (window, location); - + location, gdk_screen_get_default (), + NULL); + caja_window_go_to (window, location); g_object_unref (location); } else diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index a12ca187..b684467a 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -903,19 +903,23 @@ write_browser_xml (CajaPropertyBrowser *property_browser, static xmlNodePtr get_color_category (xmlDocPtr document) { - return eel_xml_get_root_child_by_name_and_property (document, "category", "name", "colors"); + return eel_xml_get_root_child_by_name_and_property (document, + (const xmlChar *) "category", + (const xmlChar *) "name", + (const xmlChar *) "colors"); } /* routines to remove specific category types. First, handle colors */ static void -remove_color (CajaPropertyBrowser *property_browser, const char* color_name) +remove_color (CajaPropertyBrowser *property_browser, + const xmlChar *color_name) { /* load the local xml file to remove the color */ xmlDocPtr document; xmlNodePtr cur_node, color_node; gboolean match; - char *name; + xmlChar *name; document = read_browser_xml (property_browser); if (document == NULL) @@ -938,9 +942,8 @@ remove_color (CajaPropertyBrowser *property_browser, const char* color_name) continue; } - name = xmlGetProp (color_node, "name"); - match = name != NULL - && strcmp (name, color_name) == 0; + name = xmlGetProp (color_node, (const xmlChar *) "name"); + match = name != NULL && xmlStrcmp (name, color_name) == 0; xmlFree (name); if (match) @@ -1022,7 +1025,7 @@ caja_property_browser_remove_element (CajaPropertyBrowser *property_browser, Eel break; case CAJA_PROPERTY_COLOR: color_name = eel_labeled_image_get_text (child); - remove_color (property_browser, color_name); + remove_color (property_browser, (const xmlChar *) color_name); g_free (color_name); break; case CAJA_PROPERTY_EMBLEM: @@ -1360,7 +1363,9 @@ add_new_pattern (CajaPropertyBrowser *property_browser) /* here's where we add the passed in color to the file that defines the colors */ static void -add_color_to_file (CajaPropertyBrowser *property_browser, const char *color_spec, const char *color_name) +add_color_to_file (CajaPropertyBrowser *property_browser, + const xmlChar *color_spec, + const xmlChar *color_name) { xmlNodePtr cur_node, new_color_node, children_node; xmlDocPtr document; @@ -1382,7 +1387,7 @@ add_color_to_file (CajaPropertyBrowser *property_browser, const char *color_spec { xmlChar *child_color_name; - child_color_name = xmlGetProp (children_node, "name"); + child_color_name = xmlGetProp (children_node, (const xmlChar *) "name"); if (xmlStrcmp (color_name, child_color_name) == 0) { color_name_exists = TRUE; @@ -1397,10 +1402,10 @@ add_color_to_file (CajaPropertyBrowser *property_browser, const char *color_spec /* add a new color node */ if (!color_name_exists) { - new_color_node = xmlNewChild (cur_node, NULL, "color", NULL); + new_color_node = xmlNewChild (cur_node, NULL, (const xmlChar *) "color", NULL); xmlNodeSetContent (new_color_node, color_spec); - xmlSetProp (new_color_node, "local", "1"); - xmlSetProp (new_color_node, "name", color_name); + xmlSetProp (new_color_node, (const xmlChar *) "local", (const xmlChar *) "1"); + xmlSetProp (new_color_node, (const xmlChar *) "name", color_name); write_browser_xml (property_browser, document); } @@ -1442,7 +1447,7 @@ add_color_to_browser (GtkWidget *widget, gint which_button, gpointer data) } else { - add_color_to_file (property_browser, color_spec, stripped_color_name); + add_color_to_file (property_browser, (const xmlChar *) color_spec, (const xmlChar *) stripped_color_name); caja_property_browser_update_contents(property_browser); } g_free (stripped_color_name); @@ -1960,7 +1965,7 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser) object_pixbuf = gdk_pixbuf_new_from_file (path, NULL); } g_free (path); - property_image = labeled_image_new (_("Erase"), object_pixbuf, "erase", PANGO_SCALE_LARGE); + property_image = labeled_image_new (_("Erase"), object_pixbuf, (const char *) "erase", PANGO_SCALE_LARGE); eel_labeled_image_set_fixed_image_height (EEL_LABELED_IMAGE (property_image), MAX_EMBLEM_HEIGHT); gtk_container_add (GTK_CONTAINER (image_table), property_image); @@ -2035,7 +2040,7 @@ make_properties_from_xml_node (CajaPropertyBrowser *property_browser, xmlNodePtr child_node; GdkPixbuf *pixbuf; GtkWidget *new_property; - char *deleted, *local, *color, *name; + xmlChar *deleted, *local, *color, *name; gboolean local_only = property_browser->details->remove_mode; @@ -2060,8 +2065,8 @@ make_properties_from_xml_node (CajaPropertyBrowser *property_browser, /* We used to mark colors that were removed with the "deleted" attribute. * To prevent these colors from suddenly showing up now, this legacy remains. */ - deleted = xmlGetProp (child_node, "deleted"); - local = xmlGetProp (child_node, "local"); + deleted = xmlGetProp (child_node, (const xmlChar *) "deleted"); + local = xmlGetProp (child_node, (const xmlChar *) "local"); if (deleted == NULL && (!local_only || local != NULL)) { @@ -2071,13 +2076,18 @@ make_properties_from_xml_node (CajaPropertyBrowser *property_browser, } color = xmlNodeGetContent (child_node); - name = xmlGetProp (child_node, "name"); + name = xmlGetProp (child_node, (const xmlChar *) "name"); /* make the image from the color spec */ - pixbuf = make_color_drag_image (property_browser, color, FALSE); + pixbuf = make_color_drag_image (property_browser, + (const char *) color, + FALSE); /* make the tile from the pixmap and name */ - new_property = labeled_image_new (_(name), pixbuf, color, PANGO_SCALE_LARGE); + new_property = labeled_image_new (_((const char *) name), + pixbuf, + (const char *) color, + PANGO_SCALE_LARGE); gtk_container_add (GTK_CONTAINER (property_browser->details->content_table), new_property); gtk_widget_show (new_property); @@ -2195,7 +2205,7 @@ caja_property_browser_update_contents (CajaPropertyBrowser *property_browser) GtkWidget *viewport; GtkRadioButton *group; gboolean got_categories; - char *name, *image, *type, *description, *display_name, *path, *mode; + xmlChar *name, *image, *type, *description, *display_name, *path, *mode; /* load the xml document corresponding to the path and selection */ document = read_browser_xml (property_browser); @@ -2257,24 +2267,24 @@ caja_property_browser_update_contents (CajaPropertyBrowser *property_browser) continue; } - if (strcmp (cur_node->name, "category") == 0) + if (cur_node->name && xmlStrcmp (cur_node->name, (const xmlChar *) "category") == 0) { - name = xmlGetProp (cur_node, "name"); + name = xmlGetProp (cur_node, (const xmlChar *) "name"); if (property_browser->details->category != NULL - && strcmp (property_browser->details->category, name) == 0) + && strcmp (property_browser->details->category, (const char *) name) == 0) { - path = xmlGetProp (cur_node, "path"); - mode = xmlGetProp (cur_node, "mode"); - description = xmlGetProp (cur_node, "description"); - type = xmlGetProp (cur_node, "type"); + path = xmlGetProp (cur_node, (const xmlChar *) "path"); + mode = xmlGetProp (cur_node, (const xmlChar *) "mode"); + description = xmlGetProp (cur_node, (const xmlChar *) "description"); + type = xmlGetProp (cur_node, (const xmlChar *) "type"); make_category (property_browser, - path, - mode, + (const char *) path, + (const char *) mode, cur_node, - _(description)); - caja_property_browser_set_drag_type (property_browser, type); + _((const char *) description)); + caja_property_browser_set_drag_type (property_browser, (const char *) type); xmlFree (path); xmlFree (mode); @@ -2284,13 +2294,13 @@ caja_property_browser_update_contents (CajaPropertyBrowser *property_browser) if (!got_categories) { - display_name = xmlGetProp (cur_node, "display_name"); - image = xmlGetProp (cur_node, "image"); + display_name = xmlGetProp (cur_node, (const xmlChar *) "display_name"); + image = xmlGetProp (cur_node, (const xmlChar *) "image"); make_category_link (property_browser, - name, - _(display_name), - image, + (const char *) name, + _((const char *) display_name), + (const char *) image, &group); xmlFree (display_name); |