From 2830f85b056672f4cbcc61ca55437d625d0a58da Mon Sep 17 00:00:00 2001 From: Simon Wenner Date: Sun, 3 May 2015 01:45:55 +0200 Subject: [PATCH 1/5] fixed uninitialized variable (cppcheck) --- core/io/file_access_memory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 749f7d16419..c22d637d012 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -132,7 +132,7 @@ bool FileAccessMemory::eof_reached() const { uint8_t FileAccessMemory::get_8() const { - uint8_t ret; + uint8_t ret = 0; if (pos < length) { ret = data[pos]; }; From a0e985c6c19a438ebf7afcd86cc922076f13e177 Mon Sep 17 00:00:00 2001 From: Simon Wenner Date: Sun, 3 May 2015 01:48:20 +0200 Subject: [PATCH 2/5] removed unnecessary semicolons --- core/io/file_access_memory.cpp | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index c22d637d012..2880c4ebdab 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -39,7 +39,7 @@ void FileAccessMemory::register_file(String p_name, Vector p_data) { if (!files) { files = memnew((Map >)); - }; + } String name; if (Globals::get_singleton()) @@ -49,7 +49,7 @@ void FileAccessMemory::register_file(String p_name, Vector p_data) { name = DirAccess::normalize_path(name); (*files)[name] = p_data; -}; +} void FileAccessMemory::cleanup() { @@ -57,13 +57,13 @@ void FileAccessMemory::cleanup() { return; memdelete(files); -}; +} FileAccess* FileAccessMemory::create() { return memnew(FileAccessMemory); -}; +} bool FileAccessMemory::file_exists(const String& p_name) { @@ -71,7 +71,7 @@ bool FileAccessMemory::file_exists(const String& p_name) { name = DirAccess::normalize_path(name); return files && (files->find(name) != NULL); -}; +} Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) { @@ -89,57 +89,57 @@ Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) { pos = 0; return OK; -}; +} void FileAccessMemory::close() { data = NULL; -}; +} bool FileAccessMemory::is_open() const { return data != NULL; -}; +} void FileAccessMemory::seek(size_t p_position) { ERR_FAIL_COND(!data); pos = p_position; -}; +} void FileAccessMemory::seek_end(int64_t p_position) { ERR_FAIL_COND(!data); pos = length + p_position; -}; +} size_t FileAccessMemory::get_pos() const { ERR_FAIL_COND_V(!data, 0); return pos; -}; +} size_t FileAccessMemory::get_len() const { ERR_FAIL_COND_V(!data, 0); return length; -}; +} bool FileAccessMemory::eof_reached() const { return pos >= length; -}; +} uint8_t FileAccessMemory::get_8() const { uint8_t ret = 0; if (pos < length) { ret = data[pos]; - }; + } ++pos; return ret; -}; +} int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const { @@ -156,19 +156,19 @@ int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const { pos += p_length; return read; -}; +} Error FileAccessMemory::get_error() const { return pos >= length ? ERR_FILE_EOF : OK; -}; +} void FileAccessMemory::store_8(uint8_t p_byte) { ERR_FAIL_COND(!data); ERR_FAIL_COND(pos >= length); data[pos++] = p_byte; -}; +} void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) { @@ -176,11 +176,11 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) { int write = MIN(p_length, left); if (write < p_length) { WARN_PRINT("Writing less data than requested"); - }; + } copymem(&data[pos], p_src, write); pos += p_length; -}; +} FileAccessMemory::FileAccessMemory() { From bd08cd7fd2b309d0aa0af310f485ea056424fdd5 Mon Sep 17 00:00:00 2001 From: Simon Wenner Date: Sun, 3 May 2015 02:04:30 +0200 Subject: [PATCH 3/5] fixed broken comment block --- platform/android/android_native_app_glue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/android/android_native_app_glue.h b/platform/android/android_native_app_glue.h index a902a3b4dac..f5ba27ae665 100644 --- a/platform/android/android_native_app_glue.h +++ b/platform/android/android_native_app_glue.h @@ -26,7 +26,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ - * Copyright (C) 2010 The Android Open Source Project +/* Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 332d9af81ba9b74bf71b1201c65651db1f90756c Mon Sep 17 00:00:00 2001 From: Simon Wenner Date: Sun, 3 May 2015 02:11:43 +0200 Subject: [PATCH 4/5] fixed memory leak: triangulated (cppcheck) --- drivers/convex_decomp/b2Polygon.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/convex_decomp/b2Polygon.cpp b/drivers/convex_decomp/b2Polygon.cpp index 49a3e74c2aa..668313967e6 100644 --- a/drivers/convex_decomp/b2Polygon.cpp +++ b/drivers/convex_decomp/b2Polygon.cpp @@ -970,6 +970,7 @@ int32 DecomposeConvex(b2Polygon* p, b2Polygon* results, int32 maxPolys) { } if (nTri < 1) { //Still no luck? Oh well... + delete[] triangulated; return -1; } int32 nPolys = PolygonizeTriangles(triangulated, nTri, results, maxPolys); From 3f1826866bbd2b92cf5a9de780ef948323fe7b09 Mon Sep 17 00:00:00 2001 From: Simon Wenner Date: Sun, 3 May 2015 02:16:26 +0200 Subject: [PATCH 5/5] fixed uninitialized name pointers (cppcheck) --- drivers/chibi/cp_player_data_control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/chibi/cp_player_data_control.cpp b/drivers/chibi/cp_player_data_control.cpp index 4d30c1a7038..d5ca648fff5 100644 --- a/drivers/chibi/cp_player_data_control.cpp +++ b/drivers/chibi/cp_player_data_control.cpp @@ -233,7 +233,7 @@ int CPPlayer::get_channel_voice(int p_channel) { const char* CPPlayer::get_voice_sample_name(int p_voice) { - const char *name; + const char *name = NULL; @@ -302,7 +302,7 @@ const char * CPPlayer::get_voice_instrument_name(int p_voice) { - const char *name; + const char *name = NULL;