From 0bad6ddb994877ffe4e83b95894058a3db70dca3 Mon Sep 17 00:00:00 2001 From: Qball Date: Tue, 18 Feb 2025 21:10:45 +0100 Subject: [PATCH] [CodeChecker] More cleanup with remarks from gcc/clang static code analysis --- include/helper.h | 3 +- include/settings.h | 4 +-- include/xcb.h | 2 +- source/helper.c | 3 +- source/mode.c | 24 ++++++++------ source/modes/drun.c | 20 ++++++----- source/modes/ssh.c | 68 ++++++++++++++++++++++---------------- source/theme.c | 6 ++++ source/view.c | 41 +++++++++++++++++------ source/widgets/listview.c | 4 +++ source/widgets/scrollbar.c | 8 +++-- source/widgets/textbox.c | 2 ++ source/xcb.c | 33 +++++++++--------- source/xrmoptions.c | 4 +++ 14 files changed, 141 insertions(+), 81 deletions(-) diff --git a/include/helper.h b/include/helper.h index cf75667b..29a59fae 100644 --- a/include/helper.h +++ b/include/helper.h @@ -331,7 +331,8 @@ gboolean helper_execute(const char *wd, char **args, const char *error_precmd, */ gboolean helper_execute_command(const char *wd, const char *cmd, gboolean run_in_term, - RofiHelperExecuteContext *context); + RofiHelperExecuteContext *context) + __attribute__((nonnull(2))); /** * @param file The file path diff --git a/include/settings.h b/include/settings.h index a958b478..0da54a38 100644 --- a/include/settings.h +++ b/include/settings.h @@ -61,7 +61,7 @@ typedef struct { /** Whether to load and show icons */ gboolean show_icons; - + /** Custom command to generate preview icons */ char *preview_cmd; @@ -211,7 +211,7 @@ typedef struct { /** Default number of columns in the list view */ #define DEFAULT_MENU_COLUMNS 1 /** Default window width */ -#define DEFAULT_MENU_WIDTH 50.0f +#define DEFAULT_MENU_WIDTH 50.0 /** Global Settings structure. */ extern Settings config; diff --git a/include/xcb.h b/include/xcb.h index b4a7a3ba..c0116951 100644 --- a/include/xcb.h +++ b/include/xcb.h @@ -237,7 +237,7 @@ cairo_surface_t *x11_helper_get_screenshot_surface_window(xcb_window_t window, * * Blur the content of the surface with radius and deviation. */ -void cairo_image_surface_blur(cairo_surface_t *surface, double radius, +void cairo_image_surface_blur(cairo_surface_t *surface, int radius, double deviation); #ifdef XCB_IMDKIT diff --git a/source/helper.c b/source/helper.c index a8abc2e3..7a44661d 100644 --- a/source/helper.c +++ b/source/helper.c @@ -275,6 +275,7 @@ static rofi_int_matcher *create_regex(const char *input, int case_sensitive) { retv = R(r, case_sensitive); g_free(r); break; + case MM_NORMAL: default: r = g_regex_escape_string(input, -1); retv = R(r, case_sensitive); @@ -1113,7 +1114,6 @@ gboolean helper_execute_command(const char *wd, const char *cmd, static char *helper_get_theme_path_check_file(const char *filename, const char *parent_file) { - // Check if absolute path. if (g_path_is_absolute(filename)) { g_debug("Opening theme, path is absolute: %s", filename); @@ -1199,7 +1199,6 @@ static char *helper_get_theme_path_check_file(const char *filename, char *helper_get_theme_path(const char *file, const char **ext, const char *parent_file) { - char *filename = rofi_expand_path(file); g_debug("Opening theme, testing: %s\n", filename); if (g_path_is_absolute(filename)) { diff --git a/source/mode.c b/source/mode.c index 66edeb87..357ce49c 100644 --- a/source/mode.c +++ b/source/mode.c @@ -62,8 +62,15 @@ int mode_init(Mode *mode) { } void mode_destroy(Mode *mode) { - g_assert(mode != NULL); - g_assert(mode->_destroy != NULL); + if (mode == NULL) { + g_warning("Invalid mode structure."); + return; + } + if (mode->_destroy == NULL) { + g_debug("Mode '%s' has no destroy method.", mode->name); + return; + } + mode->_destroy(mode); } @@ -125,7 +132,8 @@ char *mode_get_completion(const Mode *mode, unsigned int selected_line) { } int state = 0; g_assert(mode->_get_display_value != NULL); - char *retv = mode->_get_display_value(mode, selected_line, &state, NULL, TRUE); + char *retv = + mode->_get_display_value(mode, selected_line, &state, NULL, TRUE); return retv; } @@ -204,7 +212,7 @@ const char *mode_get_display_name(const Mode *mode) { } void mode_set_config(Mode *mode) { - if (snprintf(mode->cfg_name_key, 128, "display-%s", mode->name) > 0 ){ + if (snprintf(mode->cfg_name_key, 128, "display-%s", mode->name) > 0) { config_parser_add_option(xrm_String, mode->cfg_name_key, (void **)&(mode->display_name), "The display name of this browser"); @@ -252,10 +260,6 @@ gboolean mode_is_completer(const Mode *mode) { return FALSE; } -void mode_plugin_set_module(Mode *mode, GModule *mod){ - mode->module = mod; -} -GModule *mode_plugin_get_module(Mode *mode){ - return mode->module; -} +void mode_plugin_set_module(Mode *mode, GModule *mod) { mode->module = mod; } +GModule *mode_plugin_get_module(Mode *mode) { return mode->module; } /**@}*/ diff --git a/source/modes/drun.c b/source/modes/drun.c index 06ce7544..069ecf6c 100644 --- a/source/modes/drun.c +++ b/source/modes/drun.c @@ -955,20 +955,20 @@ static gint drun_int_sort_list(gconstpointer a, gconstpointer b, #define CACHE_VERSION 3 static int drun_write_str(FILE *fd, const char *str) { size_t l = (str == NULL ? 0 : strlen(str)); - if(fwrite(&l, sizeof(l), 1, fd)<=0){ + if (fwrite(&l, sizeof(l), 1, fd) <= 0) { return 1; } // Only write string if it is not NULL or empty. if (l > 0) { // Also writeout terminating '\0' - if ( fwrite(str, 1, l + 1, fd) <= 0 ){ + if (fwrite(str, 1, l + 1, fd) <= 0) { return 1; } } return 0; } static int drun_write_integer(FILE *fd, int32_t val) { - if ( fwrite(&val, sizeof(val), 1, fd) <= 0 ){ + if (fwrite(&val, sizeof(val), 1, fd) <= 0) { return 1; } return 0; @@ -1001,12 +1001,12 @@ static gboolean drun_read_string(FILE *fd, char **str) { } static void drun_write_strv(FILE *fd, char **str) { guint vl = (str == NULL ? 0 : g_strv_length(str)); - if ( fwrite(&vl, sizeof(vl), 1, fd) <= 0 ){ + if (fwrite(&vl, sizeof(vl), 1, fd) <= 0) { return; } for (guint index = 0; index < vl; index++) { - if ( drun_write_str(fd, str[index])){ - return ; + if (drun_write_str(fd, str[index])) { + return; } } } @@ -1017,6 +1017,10 @@ static gboolean drun_read_stringv(FILE *fd, char ***str) { g_warning("Failed to read entry, cache corrupt?"); return TRUE; } + if (vl > 1024) { + g_warning("Cache corrupted, trying to read to to many entries: %u", vl); + return TRUE; + } if (vl > 0) { // Include terminating NULL entry. (*str) = g_malloc0((vl + 1) * sizeof(**str)); @@ -1041,13 +1045,13 @@ static void write_cache(DRunModePrivateData *pd, const char *cache_file) { return; } uint8_t version = CACHE_VERSION; - if ( fwrite(&version, sizeof(version), 1, fd) <= 0 ){ + if (fwrite(&version, sizeof(version), 1, fd) <= 0) { g_warning("Failed to write to drun cache file."); (void)(void)fclose(fd); return; } - if ( fwrite(&(pd->cmd_list_length), sizeof(pd->cmd_list_length), 1, fd) <= 0){ + if (fwrite(&(pd->cmd_list_length), sizeof(pd->cmd_list_length), 1, fd) <= 0) { g_warning("Failed to write to drun cache file."); (void)(void)fclose(fd); return; diff --git a/source/modes/ssh.c b/source/modes/ssh.c index 05484cc4..d530492f 100644 --- a/source/modes/ssh.c +++ b/source/modes/ssh.c @@ -202,7 +202,7 @@ static SshEntry *read_known_hosts_file(const char *path, SshEntry *retv, if (start[0] == '[') { start++; char *strend = strchr(start, ']'); - if (strend[1] == ':') { + if (strend != NULL && strend[1] == ':') { *strend = '\0'; errno = 0; gchar *endptr = NULL; @@ -223,8 +223,9 @@ static SshEntry *read_known_hosts_file(const char *path, SshEntry *retv, // Is this host name already in the list? // We often get duplicates in hosts file, so lets check this. int found = 0; - for (unsigned int j = 0; j < (*length); j++) { - if (!g_ascii_strcasecmp(start, retv[j].hostname)) { + for (unsigned int j = 0; j < (*length) && retv; j++) { + if (retv[j].hostname != NULL && + !g_ascii_strcasecmp(start, retv[j].hostname)) { found = 1; break; } @@ -413,8 +414,9 @@ static void parse_ssh_config_file(SSHModePrivateData *pd, const char *filename, // This is a nice little penalty, but doable? time will tell. // given num_favorites is max 25. int found = 0; - for (unsigned int j = 0; j < num_favorites; j++) { - if (!g_ascii_strcasecmp(token, (*retv)[j].hostname)) { + for (unsigned int j = 0; j < num_favorites && *retv; j++) { + if ((*retv)[j].hostname != NULL && + !g_ascii_strcasecmp(token, (*retv)[j].hostname)) { found = 1; break; } @@ -465,29 +467,39 @@ static SshEntry *get_ssh(SSHModePrivateData *pd, unsigned int *length) { path = g_build_filename(cache_dir, SSH_CACHE_FILE, NULL); char **h = history_get_list(path, length); - retv = malloc((*length) * sizeof(SshEntry)); - for (unsigned int i = 0; i < (*length); i++) { - int port = 0; - char *portstr = strchr(h[i], '\x1F'); - if (portstr != NULL) { - *portstr = '\0'; - errno = 0; - gchar *endptr = NULL; - gint64 number = g_ascii_strtoll(&(portstr[1]), &endptr, 10); - if (errno != 0) { - g_warning("Failed to parse port number: %s.", &(portstr[1])); - } else if (endptr == &(portstr[1])) { - g_warning("Failed to parse port number: %s, invalid number.", - &(portstr[1])); - } else if (number < 0 || number > 65535) { - g_warning("Failed to parse port number: %s, out of range.", - &(portstr[1])); - } else { - port = number; - } + if ((*length) > 0) { + retv = malloc((*length) * sizeof(SshEntry)); + if (retv == NULL) { + // This should never happen, but if it does.. + // we fail. + *length = 0; + g_strfreev(h); + g_free(path); + return NULL; + } + for (unsigned int i = 0; i < (*length); i++) { + int port = 0; + char *portstr = strchr(h[i], '\x1F'); + if (portstr != NULL) { + *portstr = '\0'; + errno = 0; + gchar *endptr = NULL; + gint64 number = g_ascii_strtoll(&(portstr[1]), &endptr, 10); + if (errno != 0) { + g_warning("Failed to parse port number: %s.", &(portstr[1])); + } else if (endptr == &(portstr[1])) { + g_warning("Failed to parse port number: %s, invalid number.", + &(portstr[1])); + } else if (number < 0 || number > 65535) { + g_warning("Failed to parse port number: %s, out of range.", + &(portstr[1])); + } else { + port = number; + } + } + retv[i].hostname = h[i]; + retv[i].port = port; } - retv[i].hostname = h[i]; - retv[i].port = port; } g_free(h); @@ -646,5 +658,5 @@ Mode ssh_mode = {.name = "ssh", ._preprocess_input = NULL, .private_data = NULL, .free = NULL, - .type = MODE_TYPE_SWITCHER }; + .type = MODE_TYPE_SWITCHER}; /**@}*/ diff --git a/source/theme.c b/source/theme.c index 0e019996..c5465ce6 100644 --- a/source/theme.c +++ b/source/theme.c @@ -436,6 +436,9 @@ static void int_rofi_theme_print_property(Property *p) { case WL_SOUTH | WL_WEST: (void)fputs("southwest", stdout); break; + default: + g_warning("Unknown location specified."); + break; } break; } @@ -1138,6 +1141,9 @@ static gboolean rofi_theme_get_image_inside(Property *p, const widget *wid, wid->w / 2.0 + offsetx1, wid->h / 2.0 + offsety1); break; } + default: + g_warning("Unknown gradient direction specified."); + break; }; guint length = g_list_length(p->value.image.colors); if (length > 1) { diff --git a/source/view.c b/source/view.c index 39e90757..cc36fc6f 100644 --- a/source/view.c +++ b/source/view.c @@ -266,7 +266,8 @@ void rofi_capture_screenshot(void) { } else { fpath = g_strdup(outp); } - (void)fprintf(stderr, color_green "Storing screenshot %s\n" color_reset, fpath); + (void)fprintf(stderr, color_green "Storing screenshot %s\n" color_reset, + fpath); cairo_surface_t *surf = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, state->width, state->height); cairo_status_t status = cairo_surface_status(surf); @@ -328,8 +329,10 @@ static gboolean bench_update(void) { if (fps < BenchMark.min) { BenchMark.min = fps; } + // There never will be so many draws that it does not fit safely in a + // doubles. or some loss of precision is an issue for printing fps. printf("current: %.2f fps, avg: %.2f fps, min: %.2f fps, %lu draws\r\n", - fps, BenchMark.draws / ts, BenchMark.min, BenchMark.draws); + fps, ((double)BenchMark.draws) / ts, BenchMark.min, BenchMark.draws); BenchMark.last_ts = ts; } @@ -849,7 +852,7 @@ rofi_view_setup_fake_transparency(widget *win, cairo_destroy(dr); cairo_surface_destroy(s); if (blur > 0) { - cairo_image_surface_blur(CacheState.fake_bg, (double)blur, 0); + cairo_image_surface_blur(CacheState.fake_bg, blur, 0); TICK_N("BLUR"); } } @@ -907,8 +910,8 @@ gboolean rofi_set_im_window_pos(int new_x, int new_y) { static xcb_point_t spot = {.x = 0, .y = 0}; if (spot.x != new_x || spot.y != new_y) { - spot.x = new_x; - spot.y = new_y; + spot.x = (short)new_x; + spot.y = (short)new_y; xcb_xim_nested_list nested = xcb_xim_create_nested_list( xcb->im, XCB_XIM_XNSpotLocation, &spot, NULL); xcb_xim_set_ic_values(xcb->im, xcb->ic, NULL, NULL, XCB_XIM_XNClientWindow, @@ -923,10 +926,10 @@ static void open_xim_callback(xcb_xim_t *im, G_GNUC_UNUSED void *user_data) { RofiViewState *state = rofi_view_get_active(); uint32_t input_style = XCB_IM_PreeditPosition | XCB_IM_StatusArea; xcb_point_t spot; - spot.x = widget_get_x_pos(&state->text->widget) + - textbox_get_cursor_x_pos(state->text); - spot.y = widget_get_y_pos(&state->text->widget) + - widget_get_height(&state->text->widget); + spot.x = (short)(widget_get_x_pos(&state->text->widget) + + textbox_get_cursor_x_pos(state->text)); + spot.y = (short)(widget_get_y_pos(&state->text->widget) + + widget_get_height(&state->text->widget)); xcb_xim_nested_list nested = xcb_xim_create_nested_list(im, XCB_XIM_XNSpotLocation, &spot, NULL); xcb_xim_create_ic( @@ -1111,8 +1114,8 @@ void __create_window(MenuFlags menu_flags) { // default pango is 96. PangoFontMap *font_map = pango_cairo_font_map_get_default(); // TODO should we round? - config.dpi = (int) - pango_cairo_font_map_get_resolution((PangoCairoFontMap *)font_map); + config.dpi = + (int)pango_cairo_font_map_get_resolution((PangoCairoFontMap *)font_map); } // Setup font. // Dummy widget. @@ -1998,6 +2001,8 @@ static void rofi_view_trigger_global_action(KeyBindingAction action) { rofi_view_refilter(state); rofi_view_set_overlay_timeout(state, helper_get_matching_mode_str()); break; + default: + break; } } @@ -2025,9 +2030,13 @@ gboolean rofi_view_check_action(RofiViewState *state, BindingsScope scope, case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN: case WIDGET_TRIGGER_ACTION_RESULT_HANDLED: return TRUE; + default: + break; } break; } + default: + break; } return FALSE; } @@ -2067,9 +2076,13 @@ void rofi_view_trigger_action(RofiViewState *state, BindingsScope scope, rofi_fallthrough; case WIDGET_TRIGGER_ACTION_RESULT_HANDLED: return; + default: + break; } break; } + default: + break; } } @@ -2090,6 +2103,8 @@ static X11CursorType rofi_cursor_type_to_x11_cursor_type(RofiCursorType type) { case ROFI_CURSOR_TEXT: return CURSOR_TEXT; + default: + break; } return CURSOR_DEFAULT; @@ -2300,6 +2315,8 @@ WidgetTriggerActionResult textbox_button_trigger_action( case MOUSE_DCLICK_DOWN: case MOUSE_DCLICK_UP: break; + default: + break; } return WIDGET_TRIGGER_ACTION_RESULT_IGNORED; } @@ -2327,6 +2344,8 @@ static WidgetTriggerActionResult textbox_sidebar_modes_trigger_action( case MOUSE_DCLICK_DOWN: case MOUSE_DCLICK_UP: break; + default: + break; } return WIDGET_TRIGGER_ACTION_RESULT_IGNORED; } diff --git a/source/widgets/listview.c b/source/widgets/listview.c index 2479f501..bcefc222 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -735,6 +735,8 @@ listview_trigger_action(widget *wid, MouseBindingListviewAction action, case SCROLL_UP: listview_nav_up(lv); break; + default: + break; } return WIDGET_TRIGGER_ACTION_RESULT_HANDLED; } @@ -763,6 +765,8 @@ static WidgetTriggerActionResult listview_element_trigger_action( listview_set_selected(lv, lv->last_offset + i); lv->mouse_activated(lv, custom, lv->mouse_activated_data); break; + default: + break; } return WIDGET_TRIGGER_ACTION_RESULT_HANDLED; } diff --git a/source/widgets/scrollbar.c b/source/widgets/scrollbar.c index fdee1df5..cdb944c9 100644 --- a/source/widgets/scrollbar.c +++ b/source/widgets/scrollbar.c @@ -58,8 +58,8 @@ guint scrollbar_scroll_get_line(const scrollbar *sb, int y) { return sb->length - 1; } - int r = - (int)((sb->length * sb->widget.h) / ((double)(sb->length + sb->pos_length))); + int r = (int)((sb->length * sb->widget.h) / + ((double)(sb->length + sb->pos_length))); int handle = sb->widget.h - r; double sec = ((r) / (double)(sb->length - 1)); int half_handle = handle / 2; @@ -89,6 +89,8 @@ scrollbar_trigger_action(widget *wid, MouseBindingMouseDefaultAction action, case MOUSE_DCLICK_DOWN: case MOUSE_DCLICK_UP: break; + default: + break; } return FALSE; } @@ -164,7 +166,7 @@ static void scrollbar_draw(widget *wid, cairo_t *draw) { double wh = widget_padding_get_remaining_height(wid); // Calculate position and size. double r = (sb->length * wh) / ((double)(sb->length + sb->pos_length)); - unsigned int handle = (unsigned int )(wid->h - r); + unsigned int handle = (unsigned int)(wid->h - r); double sec = ((r) / (double)(sb->length - 1)); unsigned int height = handle; unsigned int y = (unsigned int)(sb->pos * sec); diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index f567adb3..a74b5c4d 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -120,6 +120,8 @@ textbox_editable_trigger_action(widget *wid, case MOUSE_DCLICK_DOWN: case MOUSE_DCLICK_UP: break; + default: + break; } return WIDGET_TRIGGER_ACTION_RESULT_IGNORED; } diff --git a/source/xcb.c b/source/xcb.c index c8e6bc2b..b0c8d355 100644 --- a/source/xcb.c +++ b/source/xcb.c @@ -146,11 +146,10 @@ static xcb_visualtype_t *lookup_visual(xcb_screen_t *s, xcb_visualid_t vis) { * website: http://macslow.thepimp.net. I'm not entirely sure he's proud of it, * but it has proved immeasurably useful for me. */ -static uint32_t *create_kernel(double radius, double deviation, - uint32_t *sum2) { +static uint32_t *create_kernel(int radius, double deviation, uint32_t *sum2) { int size = 2 * (int)(radius) + 1; uint32_t *kernel = (uint32_t *)(g_malloc(sizeof(uint32_t) * (size + 1))); - double radiusf = fabs(radius) + 1.0; + double radiusf = abs(radius) + 1.0; double value = -radius; uint32_t sum = 0; int i; @@ -162,8 +161,9 @@ static uint32_t *create_kernel(double radius, double deviation, kernel[0] = size; for (i = 0; i < size; i++) { - kernel[1 + i] = (uint32_t)(INT16_MAX / (2.506628275 * deviation) * - exp(-((value * value) / (2.0 * (deviation * deviation))))); + kernel[1 + i] = + (uint32_t)(INT16_MAX / (2.506628275 * deviation) * + exp(-((value * value) / (2.0 * (deviation * deviation))))); sum += kernel[1 + i]; value += 1.0; @@ -174,14 +174,13 @@ static uint32_t *create_kernel(double radius, double deviation, return kernel; } -inline static uint8_t rofi_uint32_uint8_range(const uint32_t v) -{ - if ( v > UINT8_MAX){ +inline static uint8_t rofi_uint32_uint8_range(const uint32_t v) { + if (v > UINT8_MAX) { return UINT8_MAX; } return (uint8_t)v; } -void cairo_image_surface_blur(cairo_surface_t *surface, double radius, +void cairo_image_surface_blur(cairo_surface_t *surface, int radius, double deviation) { uint32_t *horzBlur; uint32_t *kernel = 0; @@ -207,7 +206,7 @@ void cairo_image_surface_blur(cairo_surface_t *surface, double radius, TICK(); uint32_t sum = 0; kernel = create_kernel(radius, deviation, &sum); - if ( sum == 0 ){ + if (sum == 0) { // This is invalid. g_warning("Failed to create blurring kernel."); g_free(kernel); @@ -336,7 +335,8 @@ cairo_surface_t *x11_helper_get_screenshot_surface_window(xcb_window_t window, double scale = (double)size / max; cairo_surface_t *s2 = cairo_surface_create_similar_image( - t, CAIRO_FORMAT_ARGB32, (int)(reply->width * scale), (int)(reply->height * scale)); + t, CAIRO_FORMAT_ARGB32, (int)(reply->width * scale), + (int)(reply->height * scale)); free(reply); if (cairo_surface_status(s2) != CAIRO_STATUS_SUCCESS) { @@ -563,8 +563,8 @@ static int x11_is_extension_present(const char *extension) { // TODO add a quick check for the length of extension. // We know how (as it is not a user-provided string) the length // will always be less then 2**16 - xcb_query_extension_cookie_t randr_cookie = - xcb_query_extension(xcb->connection, (uint16_t)strlen(extension), extension); + xcb_query_extension_cookie_t randr_cookie = xcb_query_extension( + xcb->connection, (uint16_t)strlen(extension), extension); xcb_query_extension_reply_t *randr_reply = xcb_query_extension_reply(xcb->connection, randr_cookie, NULL); @@ -1496,6 +1496,8 @@ static gboolean main_loop_x11_event_handler(xcb_generic_event_t *ev, rofi_view_maybe_update(rofi_view_get_active()); break; } + default: + break; } return G_SOURCE_CONTINUE; } @@ -1630,8 +1632,9 @@ static void x11_create_frequently_used_atoms(void) { for (int i = 0; i < NUM_NETATOMS; i++) { // we know the length of the atoms are smaller then 2**16, so cast // is valid. - xcb_intern_atom_cookie_t cc = xcb_intern_atom( - xcb->connection, 0, (uint16_t)strlen(netatom_names[i]), netatom_names[i]); + xcb_intern_atom_cookie_t cc = + xcb_intern_atom(xcb->connection, 0, (uint16_t)strlen(netatom_names[i]), + netatom_names[i]); xcb_intern_atom_reply_t *r = xcb_intern_atom_reply(xcb->connection, cc, NULL); if (r) { diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 303d0f6a..c19260dd 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -522,6 +522,10 @@ void config_parser_add_option(XrmOptionType type, const char *key, void **value, case xrm_String: extra_options[num_extra_options].mem = ((char *)(*value)); break; + case xrm_Number: + case xrm_SNumber: + case xrm_Boolean: + case xrm_Char: default: extra_options[num_extra_options].mem = NULL; break;