| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 | 11 |
| 12 /* This code is in the public domain. | 12 /* This code is in the public domain. |
| 13 ** Version: 1.1 Author: Walt Karas | 13 ** Version: 1.1 Author: Walt Karas |
| 14 */ | 14 */ |
| 15 | 15 |
| 16 #include "hmm_intrnl.h" | 16 #include "hmm_intrnl.h" |
| 17 | 17 |
| 18 void U(grow_chunk)(U(descriptor) *desc, void *end, U(size_bau) n_baus) | 18 void U(grow_chunk)(U(descriptor) *desc, void *end, U(size_bau) n_baus) { |
| 19 { | |
| 20 #undef HEAD_PTR | 19 #undef HEAD_PTR |
| 21 #define HEAD_PTR ((head_record *) end) | 20 #define HEAD_PTR ((head_record *) end) |
| 22 | 21 |
| 23 end = BAUS_BACKWARD(end, DUMMY_END_BLOCK_BAUS); | 22 end = BAUS_BACKWARD(end, DUMMY_END_BLOCK_BAUS); |
| 24 | 23 |
| 25 #ifdef HMM_AUDIT_FAIL | 24 #ifdef HMM_AUDIT_FAIL |
| 26 | 25 |
| 27 if (HEAD_PTR->block_size != 0) | 26 if (HEAD_PTR->block_size != 0) |
| 28 /* Chunk does not have valid dummy end block. */ | 27 /* Chunk does not have valid dummy end block. */ |
| 29 HMM_AUDIT_FAIL | 28 HMM_AUDIT_FAIL |
| 30 | 29 |
| 31 #endif | 30 #endif |
| 32 | 31 |
| 33 /* Create a new block that absorbs the old dummy end block. */ | 32 /* Create a new block that absorbs the old dummy end block. */ |
| 34 HEAD_PTR->block_size = n_baus; | 33 HEAD_PTR->block_size = n_baus; |
| 35 | 34 |
| 36 /* Set up the new dummy end block. */ | 35 /* Set up the new dummy end block. */ |
| 37 { | 36 { |
| 38 head_record *dummy = (head_record *) BAUS_FORWARD(end, n_baus); | 37 head_record *dummy = (head_record *) BAUS_FORWARD(end, n_baus); |
| 39 dummy->previous_block_size = n_baus; | 38 dummy->previous_block_size = n_baus; |
| 40 dummy->block_size = 0; | 39 dummy->block_size = 0; |
| 41 } | 40 } |
| 42 | 41 |
| 43 /* Simply free the new block, allowing it to coalesce with any | 42 /* Simply free the new block, allowing it to coalesce with any |
| 44 ** free block at that was the last block in the chunk prior to | 43 ** free block at that was the last block in the chunk prior to |
| 45 ** growth. | 44 ** growth. |
| 46 */ | 45 */ |
| 47 U(free)(desc, HEAD_TO_PTR_REC(end)); | 46 U(free)(desc, HEAD_TO_PTR_REC(end)); |
| 48 | 47 |
| 49 #undef HEAD_PTR | 48 #undef HEAD_PTR |
| 50 } | 49 } |
| OLD | NEW |