diff options
| author | Anilforextra <anilforextra@gmail.com> | 2022-02-02 00:04:13 +0545 |
|---|---|---|
| committer | Anilforextra <anilforextra@gmail.com> | 2022-02-02 00:11:09 +0545 |
| commit | fc27636999a15f88b1f3b1d7101d84a67968ba06 (patch) | |
| tree | e3b66fce3dfd70ef1e7d5a4d1543446af2deae47 /core/io/compression.cpp | |
| parent | ea12094f19b028c1dcf6d402b8cbb3296b2065a8 (diff) | |
| download | redot-engine-fc27636999a15f88b1f3b1d7101d84a67968ba06.tar.gz | |
Vectors: Use clear() and has().
Use clear() instead of resize(0).
Use has() instead of "find(p_val) != -1".
Diffstat (limited to 'core/io/compression.cpp')
| -rw-r--r-- | core/io/compression.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/io/compression.cpp b/core/io/compression.cpp index d1f915f064..ae5ccf8354 100644 --- a/core/io/compression.cpp +++ b/core/io/compression.cpp @@ -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); |
