annotate src/flac/libflac/memory.c @ 997:e46b98155d5d trunk

[svn] - fix a bug which counts number of frames twice in handling xing header. - now fileinfo dialog calculates play length even though TLEN tag exists so that it can overwrite wrong TLEN tag.
author yaz
date Tue, 01 May 2007 12:49:27 -0700
parents 454ad11020ec
children 6d749f573b3b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
715
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
1 /* libFLAC - Free Lossless Audio Codec library
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
2 * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
3 *
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
4 * Redistribution and use in source and binary forms, with or without
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
5 * modification, are permitted provided that the following conditions
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
6 * are met:
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
7 *
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
8 * - Redistributions of source code must retain the above copyright
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
9 * notice, this list of conditions and the following disclaimer.
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
10 *
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
11 * - Redistributions in binary form must reproduce the above copyright
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
12 * notice, this list of conditions and the following disclaimer in the
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
13 * documentation and/or other materials provided with the distribution.
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
14 *
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
15 * - Neither the name of the Xiph.org Foundation nor the names of its
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
16 * contributors may be used to endorse or promote products derived from
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
17 * this software without specific prior written permission.
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
18 *
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
27 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
30 */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
31
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
32 #if HAVE_CONFIG_H
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
33 # include <config.h>
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
34 #endif
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
35
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
36 #include "private/memory.h"
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
37 #include "FLAC/assert.h"
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
38
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
39 void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
40 {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
41 void *x;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
42
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
43 FLAC__ASSERT(0 != aligned_address);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
44
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
45 #ifdef FLAC__ALIGN_MALLOC_DATA
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
46 /* align on 32-byte (256-bit) boundary */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
47 x = malloc(bytes+31);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
48 /* there's got to be a better way to do this right for all archs */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
49 if(sizeof(void*) == sizeof(unsigned))
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
50 *aligned_address = (void*)(((unsigned)x + 31) & -32);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
51 else if(sizeof(void*) == sizeof(FLAC__uint64))
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
52 *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32)));
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
53 else
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
54 return 0;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
55 #else
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
56 x = malloc(bytes);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
57 *aligned_address = x;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
58 #endif
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
59 return x;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
60 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
61
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
62 FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
63 {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
64 FLAC__int32 *pu; /* unaligned pointer */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
65 union { /* union needed to comply with C99 pointer aliasing rules */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
66 FLAC__int32 *pa; /* aligned pointer */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
67 void *pv; /* aligned pointer alias */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
68 } u;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
69
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
70 FLAC__ASSERT(elements > 0);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
71 FLAC__ASSERT(0 != unaligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
72 FLAC__ASSERT(0 != aligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
73 FLAC__ASSERT(unaligned_pointer != aligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
74
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
75 pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(FLAC__int32) * elements, &u.pv);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
76 if(0 == pu) {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
77 return false;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
78 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
79 else {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
80 if(*unaligned_pointer != 0)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
81 free(*unaligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
82 *unaligned_pointer = pu;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
83 *aligned_pointer = u.pa;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
84 return true;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
85 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
86 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
87
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
88 FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
89 {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
90 FLAC__uint32 *pu; /* unaligned pointer */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
91 union { /* union needed to comply with C99 pointer aliasing rules */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
92 FLAC__uint32 *pa; /* aligned pointer */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
93 void *pv; /* aligned pointer alias */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
94 } u;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
95
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
96 FLAC__ASSERT(elements > 0);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
97 FLAC__ASSERT(0 != unaligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
98 FLAC__ASSERT(0 != aligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
99 FLAC__ASSERT(unaligned_pointer != aligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
100
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
101 pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(FLAC__uint32) * elements, &u.pv);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
102 if(0 == pu) {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
103 return false;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
104 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
105 else {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
106 if(*unaligned_pointer != 0)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
107 free(*unaligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
108 *unaligned_pointer = pu;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
109 *aligned_pointer = u.pa;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
110 return true;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
111 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
112 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
113
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
114 FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
115 {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
116 FLAC__uint64 *pu; /* unaligned pointer */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
117 union { /* union needed to comply with C99 pointer aliasing rules */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
118 FLAC__uint64 *pa; /* aligned pointer */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
119 void *pv; /* aligned pointer alias */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
120 } u;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
121
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
122 FLAC__ASSERT(elements > 0);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
123 FLAC__ASSERT(0 != unaligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
124 FLAC__ASSERT(0 != aligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
125 FLAC__ASSERT(unaligned_pointer != aligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
126
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
127 pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(FLAC__uint64) * elements, &u.pv);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
128 if(0 == pu) {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
129 return false;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
130 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
131 else {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
132 if(*unaligned_pointer != 0)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
133 free(*unaligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
134 *unaligned_pointer = pu;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
135 *aligned_pointer = u.pa;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
136 return true;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
137 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
138 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
139
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
140 FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned **unaligned_pointer, unsigned **aligned_pointer)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
141 {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
142 unsigned *pu; /* unaligned pointer */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
143 union { /* union needed to comply with C99 pointer aliasing rules */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
144 unsigned *pa; /* aligned pointer */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
145 void *pv; /* aligned pointer alias */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
146 } u;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
147
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
148 FLAC__ASSERT(elements > 0);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
149 FLAC__ASSERT(0 != unaligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
150 FLAC__ASSERT(0 != aligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
151 FLAC__ASSERT(unaligned_pointer != aligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
152
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
153 pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(unsigned) * elements, &u.pv);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
154 if(0 == pu) {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
155 return false;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
156 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
157 else {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
158 if(*unaligned_pointer != 0)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
159 free(*unaligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
160 *unaligned_pointer = pu;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
161 *aligned_pointer = u.pa;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
162 return true;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
163 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
164 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
165
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
166 #ifndef FLAC__INTEGER_ONLY_LIBRARY
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
167
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
168 FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
169 {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
170 FLAC__real *pu; /* unaligned pointer */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
171 union { /* union needed to comply with C99 pointer aliasing rules */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
172 FLAC__real *pa; /* aligned pointer */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
173 void *pv; /* aligned pointer alias */
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
174 } u;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
175
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
176 FLAC__ASSERT(elements > 0);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
177 FLAC__ASSERT(0 != unaligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
178 FLAC__ASSERT(0 != aligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
179 FLAC__ASSERT(unaligned_pointer != aligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
180
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
181 pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(FLAC__real) * elements, &u.pv);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
182 if(0 == pu) {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
183 return false;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
184 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
185 else {
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
186 if(*unaligned_pointer != 0)
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
187 free(*unaligned_pointer);
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
188 *unaligned_pointer = pu;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
189 *aligned_pointer = u.pa;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
190 return true;
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
191 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
192 }
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
193
a9b178bc4ae4 [svn] Import flac. Please test.
js
parents:
diff changeset
194 #endif