returns 1 if success, 0 if failure ==> nothing done*/
| 141 | |
| 142 | /*returns 1 if success, 0 if failure ==> nothing done*/ |
| 143 | static 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*/ |
| 162 | static unsigned uivector_resizev(uivector* p, size_t size, unsigned value) |
no test coverage detected