returns 1 if success, 0 if failure ==> nothing done*/
| 205 | |
| 206 | /*returns 1 if success, 0 if failure ==> nothing done*/ |
| 207 | static unsigned ucvector_resize(ucvector* p, size_t size) |
| 208 | { |
| 209 | if(size * sizeof(unsigned char) > p->allocsize) |
| 210 | { |
| 211 | size_t newsize = size * sizeof(unsigned char) * 2; |
| 212 | void* data = lodepng_realloc(p->data, newsize); |
| 213 | if(data) |
| 214 | { |
| 215 | p->allocsize = newsize; |
| 216 | p->data = (unsigned char*)data; |
| 217 | p->size = size; |
| 218 | } |
| 219 | else return 0; /*error: not enough memory*/ |
| 220 | } |
| 221 | else p->size = size; |
| 222 | return 1; |
| 223 | } |
| 224 | |
| 225 | #ifdef LODEPNG_COMPILE_PNG |
| 226 |
no test coverage detected