diff --git a/src/commands/cmd_change_image_type.cpp b/src/commands/cmd_change_image_type.cpp index a5567df1e..a24f5afb6 100644 --- a/src/commands/cmd_change_image_type.cpp +++ b/src/commands/cmd_change_image_type.cpp @@ -35,7 +35,6 @@ static bool cmd_change_image_type_enabled(const char *argument) const CurrentSpriteReader sprite; return sprite != NULL && - argument != NULL && ((ustrcmp(argument, "rgb") == 0 && sprite->imgtype != IMAGE_RGB) || (ustrcmp(argument, "grayscale") == 0 && sprite->imgtype != IMAGE_GRAYSCALE) || (ustrncmp(argument, "indexed", 7) == 0 && sprite->imgtype != IMAGE_INDEXED)); diff --git a/src/commands/cmd_eyedropper_tool.cpp b/src/commands/cmd_eyedropper_tool.cpp index 18422019e..26bc73972 100644 --- a/src/commands/cmd_eyedropper_tool.cpp +++ b/src/commands/cmd_eyedropper_tool.cpp @@ -55,7 +55,7 @@ static void cmd_eyedropper_tool_execute(const char *argument) if (color_type(color) != COLOR_TYPE_MASK) { /* set the color of the color-bar */ - if (argument != NULL && ustrcmp(argument, "background") == 0) + if (ustrcmp(argument, "background") == 0) colorbar_set_bg_color(app_get_colorbar(), color); else colorbar_set_fg_color(app_get_colorbar(), color); diff --git a/src/commands/cmd_flip.cpp b/src/commands/cmd_flip.cpp index 5c709797d..be869b3a2 100644 --- a/src/commands/cmd_flip.cpp +++ b/src/commands/cmd_flip.cpp @@ -37,10 +37,10 @@ static bool cmd_flip_enabled(const char *argument) { + assert(argument); const CurrentSpriteReader sprite; return - sprite != NULL && - argument != NULL; + sprite != NULL; } static void cmd_flip_execute(const char *argument) diff --git a/src/commands/cmd_open_file.cpp b/src/commands/cmd_open_file.cpp index 545693c9a..f7b1f2836 100644 --- a/src/commands/cmd_open_file.cpp +++ b/src/commands/cmd_open_file.cpp @@ -145,13 +145,13 @@ static void cmd_open_file_execute(const char *argument) Console console; jstring filename; - /* interactive */ - if (!argument) { + // interactive + if (ustrlen(argument) == 0) { char exts[4096]; get_readable_extensions(exts, sizeof(exts)); filename = ase_file_selector(_("Open Sprite"), "", exts); } - /* load the file specified in the argument */ + // load the file specified in the argument else { filename = argument; } diff --git a/src/commands/cmd_select_file.cpp b/src/commands/cmd_select_file.cpp index 67e3630d8..022c04987 100644 --- a/src/commands/cmd_select_file.cpp +++ b/src/commands/cmd_select_file.cpp @@ -33,7 +33,7 @@ static bool cmd_select_file_enabled(const char *argument) { /* with argument, the argument specified the ID of the GfxObj */ - if (argument) { + if (ustrlen(argument) > 0) { int sprite_id = ustrtol(argument, NULL, 10); GfxObj *gfxobj = gfxobj_find(sprite_id); return gfxobj && gfxobj->type == GFXOBJ_SPRITE; @@ -47,7 +47,7 @@ static bool cmd_select_file_checked(const char *argument) { const CurrentSpriteReader sprite; - if (argument) { + if (ustrlen(argument) > 0) { int sprite_id = ustrtol(argument, NULL, 10); GfxObj *gfxobj = gfxobj_find(sprite_id); return @@ -62,7 +62,7 @@ static void cmd_select_file_execute(const char *argument) { UIContext* context = UIContext::instance(); - if (argument) { + if (ustrlen(argument) > 0) { int sprite_id = ustrtol(argument, NULL, 10); GfxObj* gfxobj = gfxobj_find(sprite_id); assert(gfxobj != NULL); diff --git a/src/widgets/editor/editor.cpp b/src/widgets/editor/editor.cpp index 622f858c1..b24d0f2a0 100644 --- a/src/widgets/editor/editor.cpp +++ b/src/widgets/editor/editor.cpp @@ -1068,7 +1068,7 @@ static bool editor_msg_proc(JWidget widget, JMessage msg) else if (editor->alt_pressed) { Command *command = command_get_by_name(CMD_EYEDROPPER_TOOL); if (command_is_enabled(command, NULL)) - command_execute(command, msg->mouse.right ? "background": NULL); + command_execute(command, msg->mouse.right ? "background": ""); return TRUE; } /* draw */