| 168 * @param value The 16-bit value |
168 * @param value The 16-bit value |
| 169 * @return The number of bytes extracted |
169 * @return The number of bytes extracted |
| 170 */ |
170 */ |
| 171 static int get_int16( const char* chunkdata, short* value ) |
171 static int get_int16( const char* chunkdata, short* value ) |
| 172 { |
172 { |
| 173 *value = ntohs( *( (const short*) chunkdata ) ); /* host byte-order */ |
173 gint16 value_v; |
| 174 |
174 |
| 175 return sizeof( short ); |
175 memcpy(&value_v, chunkdata, sizeof(value_v)); |
| |
176 |
| |
177 *value = ntohs(value_v); /* host byte-order */ |
| |
178 |
| |
179 return sizeof(value_v); |
| 176 } |
180 } |
| 177 |
181 |
| 178 /*------------------------------------------------------------------------ |
182 /*------------------------------------------------------------------------ |
| 179 * Extract a 32-bit value from the chunked data. |
183 * Extract a 32-bit value from the chunked data. |
| 180 * |
184 * |
| 182 * @param value The 32-bit value |
186 * @param value The 32-bit value |
| 183 * @return The number of bytes extracted |
187 * @return The number of bytes extracted |
| 184 */ |
188 */ |
| 185 static int get_int32( const char* chunkdata, int* value ) |
189 static int get_int32( const char* chunkdata, int* value ) |
| 186 { |
190 { |
| 187 *value = ntohl( *( (const int*) chunkdata ) ); /* host byte-order */ |
191 gint32 value_v; |
| 188 |
192 |
| 189 return sizeof( int ); |
193 memcpy(&value_v, chunkdata, sizeof(value_v)); |
| |
194 |
| |
195 *value = ntohl(value_v); /* host byte-order */ |
| |
196 |
| |
197 return sizeof(value_v); |
| 190 } |
198 } |
| 191 |
199 |
| 192 #if 0 |
200 #if 0 |
| 193 /*------------------------------------------------------------------------ |
201 /*------------------------------------------------------------------------ |
| 194 * Extract a 64-bit value from the chunked data. |
202 * Extract a 64-bit value from the chunked data. |