Skip to content

Commit 43c2dd6

Browse files
committed
ps_ptr pt21
1 parent e812549 commit 43c2dd6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/vorbis_decoder/vorbis_decoder.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,8 +1475,7 @@ int32_t oggpack_eop() {
14751475
//---------------------------------------------------------------------------------------------------------------------
14761476
vorbis_info_floor_t* floor1_info_unpack() {
14771477

1478-
uint8_t *B;
1479-
1478+
ps_ptr<uint8_t> B;
14801479
int32_t j, k, count = 0, maxclass = -1, rangebits;
14811480

14821481
vorbis_info_floor_t *info = (vorbis_info_floor_t *)ps_calloc(1, sizeof(vorbis_info_floor_t));
@@ -1535,7 +1534,7 @@ vorbis_info_floor_t* floor1_info_unpack() {
15351534
for(j = 0; j < info->posts; j++) info->forward_index[j] = j;
15361535

15371536
// vorbis_mergesort
1538-
B = (uint8_t *)ps_malloc(info->posts* sizeof(uint8_t));
1537+
B.alloc(info->posts * sizeof(uint8_t));
15391538

15401539
for(uint16_t i = 1; i < info->posts; i <<= 1) {
15411540
for(uint16_t j = 0; j + i < info->posts;) {
@@ -1555,14 +1554,12 @@ vorbis_info_floor_t* floor1_info_unpack() {
15551554
while(k2 < end) B[j++] = info->forward_index.get()[k2++];
15561555
}
15571556
for(; j < info->posts; j++) B[j] = info->forward_index.get()[j];
1558-
info->forward_index.swap_with_pointer(B);
1557+
info->forward_index.swap(B);
15591558
}
15601559

1561-
if(B == info->forward_index.get()) {
1560+
if(B.get() == info->forward_index.get()) {
15621561
for(j = 0; j < info->posts; j++) B[j] = info->forward_index.get()[j];
15631562
}
1564-
else
1565-
free(B);
15661563

15671564
/* discover our neighbors for decode where we don't use fit flags (that would push the neighbors outward) */
15681565
for(j = 0; j < info->posts - 2; j++) {

0 commit comments

Comments
 (0)