Merge pull request #1792 from swenner/static_analysis_fixes
Static analysis fixes
This commit is contained in:
commit
c631d597ad
|
@ -39,7 +39,7 @@ void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
|
||||||
|
|
||||||
if (!files) {
|
if (!files) {
|
||||||
files = memnew((Map<String, Vector<uint8_t> >));
|
files = memnew((Map<String, Vector<uint8_t> >));
|
||||||
};
|
}
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
if (Globals::get_singleton())
|
if (Globals::get_singleton())
|
||||||
|
@ -49,7 +49,7 @@ void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
|
||||||
name = DirAccess::normalize_path(name);
|
name = DirAccess::normalize_path(name);
|
||||||
|
|
||||||
(*files)[name] = p_data;
|
(*files)[name] = p_data;
|
||||||
};
|
}
|
||||||
|
|
||||||
void FileAccessMemory::cleanup() {
|
void FileAccessMemory::cleanup() {
|
||||||
|
|
||||||
|
@ -57,13 +57,13 @@ void FileAccessMemory::cleanup() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memdelete(files);
|
memdelete(files);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
FileAccess* FileAccessMemory::create() {
|
FileAccess* FileAccessMemory::create() {
|
||||||
|
|
||||||
return memnew(FileAccessMemory);
|
return memnew(FileAccessMemory);
|
||||||
};
|
}
|
||||||
|
|
||||||
bool FileAccessMemory::file_exists(const String& p_name) {
|
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);
|
name = DirAccess::normalize_path(name);
|
||||||
|
|
||||||
return files && (files->find(name) != NULL);
|
return files && (files->find(name) != NULL);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) {
|
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;
|
pos = 0;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
};
|
}
|
||||||
|
|
||||||
void FileAccessMemory::close() {
|
void FileAccessMemory::close() {
|
||||||
|
|
||||||
data = NULL;
|
data = NULL;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool FileAccessMemory::is_open() const {
|
bool FileAccessMemory::is_open() const {
|
||||||
|
|
||||||
return data != NULL;
|
return data != NULL;
|
||||||
};
|
}
|
||||||
|
|
||||||
void FileAccessMemory::seek(size_t p_position) {
|
void FileAccessMemory::seek(size_t p_position) {
|
||||||
|
|
||||||
ERR_FAIL_COND(!data);
|
ERR_FAIL_COND(!data);
|
||||||
pos = p_position;
|
pos = p_position;
|
||||||
};
|
}
|
||||||
|
|
||||||
void FileAccessMemory::seek_end(int64_t p_position) {
|
void FileAccessMemory::seek_end(int64_t p_position) {
|
||||||
|
|
||||||
ERR_FAIL_COND(!data);
|
ERR_FAIL_COND(!data);
|
||||||
pos = length + p_position;
|
pos = length + p_position;
|
||||||
};
|
}
|
||||||
|
|
||||||
size_t FileAccessMemory::get_pos() const {
|
size_t FileAccessMemory::get_pos() const {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!data, 0);
|
ERR_FAIL_COND_V(!data, 0);
|
||||||
return pos;
|
return pos;
|
||||||
};
|
}
|
||||||
|
|
||||||
size_t FileAccessMemory::get_len() const {
|
size_t FileAccessMemory::get_len() const {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(!data, 0);
|
ERR_FAIL_COND_V(!data, 0);
|
||||||
return length;
|
return length;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool FileAccessMemory::eof_reached() const {
|
bool FileAccessMemory::eof_reached() const {
|
||||||
|
|
||||||
return pos >= length;
|
return pos >= length;
|
||||||
};
|
}
|
||||||
|
|
||||||
uint8_t FileAccessMemory::get_8() const {
|
uint8_t FileAccessMemory::get_8() const {
|
||||||
|
|
||||||
uint8_t ret;
|
uint8_t ret = 0;
|
||||||
if (pos < length) {
|
if (pos < length) {
|
||||||
ret = data[pos];
|
ret = data[pos];
|
||||||
};
|
}
|
||||||
++pos;
|
++pos;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
};
|
}
|
||||||
|
|
||||||
int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const {
|
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;
|
pos += p_length;
|
||||||
|
|
||||||
return read;
|
return read;
|
||||||
};
|
}
|
||||||
|
|
||||||
Error FileAccessMemory::get_error() const {
|
Error FileAccessMemory::get_error() const {
|
||||||
|
|
||||||
return pos >= length ? ERR_FILE_EOF : OK;
|
return pos >= length ? ERR_FILE_EOF : OK;
|
||||||
};
|
}
|
||||||
|
|
||||||
void FileAccessMemory::store_8(uint8_t p_byte) {
|
void FileAccessMemory::store_8(uint8_t p_byte) {
|
||||||
|
|
||||||
ERR_FAIL_COND(!data);
|
ERR_FAIL_COND(!data);
|
||||||
ERR_FAIL_COND(pos >= length);
|
ERR_FAIL_COND(pos >= length);
|
||||||
data[pos++] = p_byte;
|
data[pos++] = p_byte;
|
||||||
};
|
}
|
||||||
|
|
||||||
void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) {
|
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);
|
int write = MIN(p_length, left);
|
||||||
if (write < p_length) {
|
if (write < p_length) {
|
||||||
WARN_PRINT("Writing less data than requested");
|
WARN_PRINT("Writing less data than requested");
|
||||||
};
|
}
|
||||||
|
|
||||||
copymem(&data[pos], p_src, write);
|
copymem(&data[pos], p_src, write);
|
||||||
pos += p_length;
|
pos += p_length;
|
||||||
};
|
}
|
||||||
|
|
||||||
FileAccessMemory::FileAccessMemory() {
|
FileAccessMemory::FileAccessMemory() {
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,7 @@ int CPPlayer::get_channel_voice(int p_channel) {
|
||||||
|
|
||||||
const char* CPPlayer::get_voice_sample_name(int p_voice) {
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -970,6 +970,7 @@ int32 DecomposeConvex(b2Polygon* p, b2Polygon* results, int32 maxPolys) {
|
||||||
}
|
}
|
||||||
if (nTri < 1) {
|
if (nTri < 1) {
|
||||||
//Still no luck? Oh well...
|
//Still no luck? Oh well...
|
||||||
|
delete[] triangulated;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int32 nPolys = PolygonizeTriangles(triangulated, nTri, results, maxPolys);
|
int32 nPolys = PolygonizeTriangles(triangulated, nTri, results, maxPolys);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
Loading…
Reference in New Issue