Restore memory storage position: */
| 276 | |
| 277 | /* Restore memory storage position: */ |
| 278 | CV_IMPL void |
| 279 | cvRestoreMemStoragePos( CvMemStorage * storage, CvMemStoragePos * pos ) |
| 280 | { |
| 281 | if( !storage || !pos ) |
| 282 | CV_Error( CV_StsNullPtr, "" ); |
| 283 | if( pos->free_space > storage->block_size ) |
| 284 | CV_Error( CV_StsBadSize, "" ); |
| 285 | |
| 286 | /* |
| 287 | // this breaks icvGoNextMemBlock, so comment it off for now |
| 288 | if( storage->parent && (!pos->top || pos->top->next) ) |
| 289 | { |
| 290 | CvMemBlock* save_bottom; |
| 291 | if( !pos->top ) |
| 292 | save_bottom = 0; |
| 293 | else |
| 294 | { |
| 295 | save_bottom = storage->bottom; |
| 296 | storage->bottom = pos->top->next; |
| 297 | pos->top->next = 0; |
| 298 | storage->bottom->prev = 0; |
| 299 | } |
| 300 | icvDestroyMemStorage( storage ); |
| 301 | storage->bottom = save_bottom; |
| 302 | }*/ |
| 303 | |
| 304 | storage->top = pos->top; |
| 305 | storage->free_space = pos->free_space; |
| 306 | |
| 307 | if( !storage->top ) |
| 308 | { |
| 309 | storage->top = storage->bottom; |
| 310 | storage->free_space = storage->top ? storage->block_size - sizeof(CvMemBlock) : 0; |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | |
| 315 | /* Allocate continuous buffer of the specified size in the storage: */ |
no outgoing calls
no test coverage detected