mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Vectors: Use clear() and has().
Use clear() instead of resize(0). Use has() instead of "find(p_val) != -1".
This commit is contained in:
@@ -212,7 +212,7 @@ int Compression::decompress_dynamic(Vector<uint8_t> *p_dst_vect, int p_max_dst_s
|
||||
strm.avail_in = p_src_size;
|
||||
|
||||
// Ensure the destination buffer is empty
|
||||
p_dst_vect->resize(0);
|
||||
p_dst_vect->clear();
|
||||
|
||||
// decompress until deflate stream ends or end of file
|
||||
do {
|
||||
@@ -244,7 +244,7 @@ int Compression::decompress_dynamic(Vector<uint8_t> *p_dst_vect, int p_max_dst_s
|
||||
WARN_PRINT(strm.msg);
|
||||
}
|
||||
(void)inflateEnd(&strm);
|
||||
p_dst_vect->resize(0);
|
||||
p_dst_vect->clear();
|
||||
return ret;
|
||||
}
|
||||
} while (strm.avail_out > 0 && strm.avail_in > 0);
|
||||
@@ -254,7 +254,7 @@ int Compression::decompress_dynamic(Vector<uint8_t> *p_dst_vect, int p_max_dst_s
|
||||
// Enforce max output size
|
||||
if (p_max_dst_size > -1 && strm.total_out > (uint64_t)p_max_dst_size) {
|
||||
(void)inflateEnd(&strm);
|
||||
p_dst_vect->resize(0);
|
||||
p_dst_vect->clear();
|
||||
return Z_BUF_ERROR;
|
||||
}
|
||||
} while (ret != Z_STREAM_END);
|
||||
|
||||
Reference in New Issue
Block a user