diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-05-01 08:19:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-01 08:19:04 +0200 |
commit | ae41e35191cc64471f918318dc32428728c9c4bb (patch) | |
tree | 904f7611e51a9a0fa8f3e75f5556c89aa66396b5 /platform | |
parent | 8afc9c3938af385be17aab92ec5c4adcbfb0781a (diff) | |
parent | 8460d0678c28816f6f206f40b71de2510fab1ffc (diff) |
Merge pull request #27676 from qarmin/small_fixes_2
Small fixes to static analyzer bugs
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/export/export.cpp | 2 | ||||
-rw-r--r-- | platform/iphone/export/export.cpp | 2 | ||||
-rw-r--r-- | platform/osx/export/export.cpp | 1 | ||||
-rw-r--r-- | platform/x11/crash_handler_x11.cpp | 10 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 54 | ||||
-rw-r--r-- | platform/x11/power_x11.cpp | 2 |
6 files changed, 32 insertions, 39 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 2a3d0843a8..f45644f1eb 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1864,7 +1864,6 @@ public: return ERR_FILE_NOT_FOUND; } - ERR_FAIL_COND_V(!pkg, ERR_CANT_OPEN); int ret = unzGoToFirstFile(pkg); zlib_filefunc_def io2 = io; @@ -2204,7 +2203,6 @@ public: return ERR_FILE_NOT_FOUND; } - ERR_FAIL_COND_V(!tmp_unaligned, ERR_CANT_OPEN); ret = unzGoToFirstFile(tmp_unaligned); io2 = io; diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 85d4b9e847..e1083aeefc 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -920,7 +920,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p EditorNode::add_io_error("Could not open export template (not a zip file?):\n" + src_pkg_name); return ERR_CANT_OPEN; } - ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN); + int ret = unzGoToFirstFile(src_pkg_zip); Vector<uint8_t> project_file_data; while (ret == UNZ_OK) { diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 1a63d6ff75..89212b0e5e 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -441,7 +441,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p return ERR_FILE_NOT_FOUND; } - ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN); int ret = unzGoToFirstFile(src_pkg_zip); String binary_to_use = "godot_osx_" + String(p_debug ? "debug" : "release") + ".64"; diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp index 1e7f393bdd..44d3cf1910 100644 --- a/platform/x11/crash_handler_x11.cpp +++ b/platform/x11/crash_handler_x11.cpp @@ -96,12 +96,10 @@ static void handle_crash(int sig) { String output = ""; // Try to get the file/line number using addr2line - if (OS::get_singleton()) { - int ret; - Error err = OS::get_singleton()->execute(String("addr2line"), args, true, NULL, &output, &ret); - if (err == OK) { - output.erase(output.length() - 1, 1); - } + int ret; + Error err = OS::get_singleton()->execute(String("addr2line"), args, true, NULL, &output, &ret); + if (err == OK) { + output.erase(output.length() - 1, 1); } fprintf(stderr, "[%ld] %s (%ls)\n", i, fname, output.c_str()); diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 267ac08a72..5a3d3acb12 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -503,35 +503,33 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a current_cursor = CURSOR_ARROW; - if (cursor_theme) { - for (int i = 0; i < CURSOR_MAX; i++) { - - static const char *cursor_file[] = { - "left_ptr", - "xterm", - "hand2", - "cross", - "watch", - "left_ptr_watch", - "fleur", - "hand1", - "X_cursor", - "sb_v_double_arrow", - "sb_h_double_arrow", - "size_bdiag", - "size_fdiag", - "hand1", - "sb_v_double_arrow", - "sb_h_double_arrow", - "question_arrow" - }; + for (int i = 0; i < CURSOR_MAX; i++) { - img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size); - if (img[i]) { - cursors[i] = XcursorImageLoadCursor(x11_display, img[i]); - } else { - print_verbose("Failed loading custom cursor: " + String(cursor_file[i])); - } + static const char *cursor_file[] = { + "left_ptr", + "xterm", + "hand2", + "cross", + "watch", + "left_ptr_watch", + "fleur", + "hand1", + "X_cursor", + "sb_v_double_arrow", + "sb_h_double_arrow", + "size_bdiag", + "size_fdiag", + "hand1", + "sb_v_double_arrow", + "sb_h_double_arrow", + "question_arrow" + }; + + img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size); + if (img[i]) { + cursors[i] = XcursorImageLoadCursor(x11_display, img[i]); + } else { + print_verbose("Failed loading custom cursor: " + String(cursor_file[i])); } } diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp index 943c2b1383..50da6a4967 100644 --- a/platform/x11/power_x11.cpp +++ b/platform/x11/power_x11.cpp @@ -115,7 +115,7 @@ bool PowerX11::make_proc_acpi_key_val(char **_ptr, char **_key, char **_val) { *(ptr++) = '\0'; /* terminate the key. */ - while ((*ptr == ' ') && (*ptr != '\0')) { + while (*ptr == ' ') { ptr++; /* skip whitespace. */ } |