summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/io/compression.cpp4
-rw-r--r--core/os/memory_pool_dynamic_static.h2
-rw-r--r--core/ustring.cpp8
3 files changed, 8 insertions, 6 deletions
diff --git a/core/io/compression.cpp b/core/io/compression.cpp
index 67ba5de0fa..ea2f5d2d9c 100644
--- a/core/io/compression.cpp
+++ b/core/io/compression.cpp
@@ -55,7 +55,7 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,M
strm.zfree = zipio_free;
strm.opaque = Z_NULL;
int err = deflateInit(&strm,Z_DEFAULT_COMPRESSION);
- if (err==Z_OK)
+ if (err!=Z_OK)
return -1;
strm.avail_in=p_src_size;
@@ -93,7 +93,7 @@ int Compression::get_max_compressed_buffer_size(int p_src_size,Mode p_mode){
strm.zfree = zipio_free;
strm.opaque = Z_NULL;
int err = deflateInit(&strm,Z_DEFAULT_COMPRESSION);
- if (err==Z_OK)
+ if (err!=Z_OK)
return -1;
int aout = deflateBound(&strm,p_src_size);
deflateEnd(&strm);
diff --git a/core/os/memory_pool_dynamic_static.h b/core/os/memory_pool_dynamic_static.h
index ce038bc00a..d10cdb3d0a 100644
--- a/core/os/memory_pool_dynamic_static.h
+++ b/core/os/memory_pool_dynamic_static.h
@@ -38,7 +38,7 @@ class MemoryPoolDynamicStatic : public MemoryPoolDynamic {
_THREAD_SAFE_CLASS_
enum {
- MAX_CHUNKS=16384
+ MAX_CHUNKS=65536
};
diff --git a/core/ustring.cpp b/core/ustring.cpp
index f53829fe21..d119e341c3 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2501,19 +2501,21 @@ bool String::begins_with(const String& p_string) const {
const CharType *src=&p_string[0];
const CharType *str=&operator[](0);
- for (int i=0;i<l;i++) {
+ int i = 0;
+ for (;i<l;i++) {
if (src[i]!=str[i])
return false;
}
- return true;
+ // only if i == l the p_string matches the beginning
+ return i == l;
}
bool String::begins_with(const char* p_string) const {
int l=length();
- if (l==0)
+ if (l==0||!p_string)
return false;
const CharType *str=&operator[](0);