MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / uivector_resize

Function uivector_resize

src/lodepng.cpp:143–159  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

141
142/*returns 1 if success, 0 if failure ==> nothing done*/
143static unsigned uivector_resize(uivector* p, size_t size)
144{
145 if(size * sizeof(unsigned) > p->allocsize)
146 {
147 size_t newsize = size * sizeof(unsigned) * 2;
148 void* data = lodepng_realloc(p->data, newsize);
149 if(data)
150 {
151 p->allocsize = newsize;
152 p->data = (unsigned*)data;
153 p->size = size;
154 }
155 else return 0;
156 }
157 else p->size = size;
158 return 1;
159}
160
161/*resize and give all new elements the value*/
162static unsigned uivector_resizev(uivector* p, size_t size, unsigned value)

Callers 4

uivector_resizevFunction · 0.85
uivector_push_backFunction · 0.85
uivector_copyFunction · 0.85
deflateDynamicFunction · 0.85

Calls 1

lodepng_reallocFunction · 0.85

Tested by

no test coverage detected