returns 1 if success, 0 if failure ==> nothing done*/
| 211 | |
| 212 | /*returns 1 if success, 0 if failure ==> nothing done*/ |
| 213 | static unsigned ucvector_reserve(ucvector* p, size_t allocsize) |
| 214 | { |
| 215 | if(allocsize > p->allocsize) |
| 216 | { |
| 217 | size_t newsize = (allocsize > p->allocsize * 2) ? allocsize : (allocsize * 3 / 2); |
| 218 | void* data = lodepng_realloc(p->data, newsize); |
| 219 | if(data) |
| 220 | { |
| 221 | p->allocsize = newsize; |
| 222 | p->data = (unsigned char*)data; |
| 223 | } |
| 224 | else return 0; /*error: not enough memory*/ |
| 225 | } |
| 226 | return 1; |
| 227 | } |
| 228 | |
| 229 | /*returns 1 if success, 0 if failure ==> nothing done*/ |
| 230 | static unsigned ucvector_resize(ucvector* p, size_t size) |
no test coverage detected