MCPcopy Create free account
hub / github.com/DFHack/dfhack / ucvector_resize

Function ucvector_resize

depends/lodepng/lodepng.cpp:270–282  ·  view source on GitHub ↗

returns 1 if success, 0 if failure ==> nothing done*/

Source from the content-addressed store, hash-verified

268
269/*returns 1 if success, 0 if failure ==> nothing done*/
270static unsigned ucvector_resize(ucvector* p, size_t size) {
271 if(size > p->allocsize) {
272 size_t newsize = size + (p->allocsize >> 1u);
273 void* data = lodepng_realloc(p->data, newsize);
274 if(data) {
275 p->allocsize = newsize;
276 p->data = (unsigned char*)data;
277 }
278 else return 0; /*error: not enough memory*/
279 }
280 p->size = size;
281 return 1; /*success*/
282}
283
284static ucvector ucvector_init(unsigned char* buffer, size_t size) {
285 ucvector v;

Callers 7

lodepng.cppFile · 0.85
inflateHuffmanBlockFunction · 0.85
inflateNoCompressionFunction · 0.85
deflateNoCompressionFunction · 0.85
zlib_decompressFunction · 0.85
lodepng_chunk_initFunction · 0.85
writeSignatureFunction · 0.85

Calls 1

lodepng_reallocFunction · 0.85

Tested by

no test coverage detected