mirror of https://github.com/xiph/flac
put a FLAC__ASSERT wrapper around assert()
This commit is contained in:
parent
88f94d0fb3
commit
1b68982b0e
|
@ -1,6 +1,7 @@
|
|||
includedir = ${prefix}/include/FLAC
|
||||
|
||||
include_HEADERS = all.h \
|
||||
assert.h \
|
||||
encoder.h \
|
||||
file_decoder.h \
|
||||
format.h \
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#ifndef FLAC__ALL_H
|
||||
#define FLAC__ALL_H
|
||||
|
||||
#include "assert.h"
|
||||
#include "encoder.h"
|
||||
#include "file_decoder.h"
|
||||
#include "format.h"
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/* libFLAC - Free Lossless Audio Codec library
|
||||
* Copyright (C) 2001 Josh Coalson
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef FLAC__ASSERT_H
|
||||
#define FLAC__ASSERT_H
|
||||
|
||||
/* we need this since some compilers (like MSVC) leave asserts on release code (and we don't want to use their ASSERT) */
|
||||
#ifdef DEBUG
|
||||
#include <assert.h>
|
||||
#define FLAC__ASSERT(x) assert(x)
|
||||
#else
|
||||
#define FLAC__ASSERT(x)
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -16,7 +16,6 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <assert.h> /* for FILE */
|
||||
#include <stdio.h> /* for FILE */
|
||||
#include <string.h> /* for strcmp() */
|
||||
#include "FLAC/all.h"
|
||||
|
@ -78,7 +77,7 @@ int decode_wav(const char *infile, const char *outfile, bool analysis_mode, anal
|
|||
stream_info.frame_counter = 0;
|
||||
stream_info.fout = 0; /* initialized with an open file later if necessary */
|
||||
|
||||
assert(!(stream_info.test_only && stream_info.analysis_mode));
|
||||
FLAC__ASSERT(!(stream_info.test_only && stream_info.analysis_mode));
|
||||
|
||||
if(!stream_info.test_only) {
|
||||
if(0 == strcmp(outfile, "-")) {
|
||||
|
@ -191,7 +190,7 @@ int decode_raw(const char *infile, const char *outfile, bool analysis_mode, anal
|
|||
stream_info.frame_counter = 0;
|
||||
stream_info.fout = 0; /* initialized with an open file later if necessary */
|
||||
|
||||
assert(!(stream_info.test_only && stream_info.analysis_mode));
|
||||
FLAC__ASSERT(!(stream_info.test_only && stream_info.analysis_mode));
|
||||
|
||||
if(!stream_info.test_only) {
|
||||
if(0 == strcmp(outfile, "-")) {
|
||||
|
@ -441,7 +440,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__FileDecoder *decoder,
|
|||
return FLAC__STREAM_DECODER_WRITE_ABORT;
|
||||
}
|
||||
else {
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
return FLAC__STREAM_DECODER_WRITE_CONTINUE;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
/*@@@ need to "_finish()" the verify decoder */
|
||||
|
||||
#include <assert.h>
|
||||
#if defined _WIN32 && !defined __CYGWIN__
|
||||
/* where MSVC puts unlink() */
|
||||
# include <io.h>
|
||||
|
@ -592,7 +591,7 @@ bool convert_to_seek_table(char *requested_seek_points, int num_requested_seek_p
|
|||
real_points = placeholders = 0;
|
||||
for(i = 0; i < (unsigned)num_requested_seek_points; i++) {
|
||||
q = strchr(pt, '<');
|
||||
assert(0 != q);
|
||||
FLAC__ASSERT(0 != q);
|
||||
*q = '\0';
|
||||
|
||||
if(0 == strcmp(pt, "X")) { /* -S X */
|
||||
|
@ -624,7 +623,7 @@ bool convert_to_seek_table(char *requested_seek_points, int num_requested_seek_p
|
|||
|
||||
for(i = 0; i < (unsigned)num_requested_seek_points; i++) {
|
||||
q = strchr(pt, '<');
|
||||
assert(0 != q);
|
||||
FLAC__ASSERT(0 != q);
|
||||
*q++ = '\0';
|
||||
|
||||
if(0 == strcmp(pt, "X")) { /* -S X */
|
||||
|
@ -753,14 +752,14 @@ void format_input(unsigned wide_samples, bool is_big_endian, bool is_unsigned_sa
|
|||
}
|
||||
}
|
||||
else {
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
if(encoder_wrapper->verify) {
|
||||
for(channel = 0; channel < channels; channel++)
|
||||
memcpy(&encoder_wrapper->verify_fifo.original[channel][encoder_wrapper->verify_fifo.tail], &input[channel][0], sizeof(int32) * wide_samples);
|
||||
encoder_wrapper->verify_fifo.tail += wide_samples;
|
||||
assert(encoder_wrapper->verify_fifo.tail <= encoder_wrapper->verify_fifo.size);
|
||||
FLAC__ASSERT(encoder_wrapper->verify_fifo.tail <= encoder_wrapper->verify_fifo.size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -829,7 +828,7 @@ void metadata_callback(const FLAC__Encoder *encoder, const FLAC__StreamMetaData
|
|||
const unsigned min_framesize = metadata->data.stream_info.min_framesize;
|
||||
const unsigned max_framesize = metadata->data.stream_info.max_framesize;
|
||||
|
||||
assert(metadata->type == FLAC__METADATA_TYPE_STREAMINFO);
|
||||
FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO);
|
||||
|
||||
/*
|
||||
* we get called by the encoder when the encoding process has
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -290,7 +289,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
assert(blocksize >= 0 || mode_decode);
|
||||
FLAC__ASSERT(blocksize >= 0 || mode_decode);
|
||||
|
||||
if(format_channels >= 0) {
|
||||
if(format_channels == 0 || (unsigned)format_channels > FLAC__MAX_CHANNELS)
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h> /* for malloc() */
|
||||
#include <string.h> /* for memcpy(), memset() */
|
||||
#include "private/bitbuffer.h"
|
||||
#include "private/bitmath.h"
|
||||
#include "private/crc.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
/*
|
||||
* Along the way you will see two versions of some functions, selected
|
||||
|
@ -50,8 +50,8 @@ static bool bitbuffer_resize_(FLAC__BitBuffer *bb, unsigned new_capacity)
|
|||
{
|
||||
byte *new_buffer;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
if(bb->capacity == new_capacity)
|
||||
return true;
|
||||
|
@ -80,7 +80,7 @@ static bool bitbuffer_grow_(FLAC__BitBuffer *bb, unsigned min_bytes_to_add)
|
|||
{
|
||||
unsigned new_capacity;
|
||||
|
||||
assert(min_bytes_to_add > 0);
|
||||
FLAC__ASSERT(min_bytes_to_add > 0);
|
||||
|
||||
new_capacity = max(bb->capacity * 4, bb->capacity + min_bytes_to_add);
|
||||
return bitbuffer_resize_(bb, new_capacity);
|
||||
|
@ -88,8 +88,8 @@ static bool bitbuffer_grow_(FLAC__BitBuffer *bb, unsigned min_bytes_to_add)
|
|||
|
||||
static bool bitbuffer_ensure_size_(FLAC__BitBuffer *bb, unsigned bits_to_add)
|
||||
{
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
if((bb->capacity<<3) < bb->total_bits + bits_to_add)
|
||||
return bitbuffer_grow_(bb, (bits_to_add>>3)+2);
|
||||
else
|
||||
|
@ -128,7 +128,8 @@ static bool bitbuffer_read_from_client_(FLAC__BitBuffer *bb, bool (*read_callbac
|
|||
|
||||
void FLAC__bitbuffer_init(FLAC__BitBuffer *bb)
|
||||
{
|
||||
assert(bb != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
|
||||
bb->buffer = 0;
|
||||
bb->capacity = 0;
|
||||
bb->bytes = bb->bits = bb->total_bits = 0;
|
||||
|
@ -137,12 +138,13 @@ void FLAC__bitbuffer_init(FLAC__BitBuffer *bb)
|
|||
|
||||
bool FLAC__bitbuffer_init_from(FLAC__BitBuffer *bb, const byte buffer[], unsigned bytes)
|
||||
{
|
||||
assert(bb != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__bitbuffer_init(bb);
|
||||
|
||||
if(bytes == 0)
|
||||
return true;
|
||||
else {
|
||||
assert(buffer != 0);
|
||||
FLAC__ASSERT(buffer != 0);
|
||||
bb->buffer = (byte*)malloc(sizeof(byte)*bytes);
|
||||
if(bb->buffer == 0)
|
||||
return false;
|
||||
|
@ -157,7 +159,7 @@ bool FLAC__bitbuffer_init_from(FLAC__BitBuffer *bb, const byte buffer[], unsigne
|
|||
|
||||
void FLAC__bitbuffer_init_read_crc16(FLAC__BitBuffer *bb, uint16 seed)
|
||||
{
|
||||
assert(bb != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
|
||||
bb->read_crc16 = seed;
|
||||
}
|
||||
|
@ -167,8 +169,8 @@ bool FLAC__bitbuffer_concatenate_aligned(FLAC__BitBuffer *dest, const FLAC__BitB
|
|||
static const byte mask_[9] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
|
||||
unsigned bits_to_add = src->total_bits - src->total_consumed_bits;
|
||||
|
||||
assert(dest != 0);
|
||||
assert(src != 0);
|
||||
FLAC__ASSERT(dest != 0);
|
||||
FLAC__ASSERT(src != 0);
|
||||
|
||||
if(bits_to_add == 0)
|
||||
return true;
|
||||
|
@ -197,7 +199,8 @@ bool FLAC__bitbuffer_concatenate_aligned(FLAC__BitBuffer *dest, const FLAC__BitB
|
|||
|
||||
void FLAC__bitbuffer_free(FLAC__BitBuffer *bb)
|
||||
{
|
||||
assert(bb != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
|
||||
if(bb->buffer != 0)
|
||||
free(bb->buffer);
|
||||
bb->buffer = 0;
|
||||
|
@ -243,8 +246,8 @@ bool FLAC__bitbuffer_write_zeroes(FLAC__BitBuffer *bb, unsigned bits)
|
|||
{
|
||||
unsigned n, k;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
if(bits == 0)
|
||||
return true;
|
||||
|
@ -269,14 +272,17 @@ bool FLAC__bitbuffer_write_raw_uint32(FLAC__BitBuffer *bb, uint32 val, unsigned
|
|||
{
|
||||
unsigned n, k;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(bits <= 32);
|
||||
FLAC__ASSERT(bits <= 32);
|
||||
if(bits == 0)
|
||||
return true;
|
||||
if(!bitbuffer_ensure_size_(bb, bits))
|
||||
return false;
|
||||
/* inline the size check so we don't incure a function call unnecessarily */
|
||||
if((bb->capacity<<3) < bb->total_bits + bits) {
|
||||
if(!bitbuffer_ensure_size_(bb, bits))
|
||||
return false;
|
||||
}
|
||||
if(bits < 32) /* @@@ gcc seems to require this because the following line causes incorrect results when bits==32; investigate */
|
||||
val &= (~(0xffffffff << bits)); /* zero-out unused bits */
|
||||
bb->total_bits += bits;
|
||||
|
@ -352,10 +358,10 @@ bool FLAC__bitbuffer_write_raw_uint64(FLAC__BitBuffer *bb, uint64 val, unsigned
|
|||
};
|
||||
unsigned n, k;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(bits <= 64);
|
||||
FLAC__ASSERT(bits <= 64);
|
||||
if(bits == 0)
|
||||
return true;
|
||||
if(!bitbuffer_ensure_size_(bb, bits))
|
||||
|
@ -440,7 +446,7 @@ unsigned FLAC__bitbuffer_golomb_bits_signed(int val, unsigned parameter)
|
|||
unsigned bits, msbs, uval;
|
||||
unsigned k;
|
||||
|
||||
assert(parameter > 0);
|
||||
FLAC__ASSERT(parameter > 0);
|
||||
|
||||
/* convert signed to unsigned */
|
||||
if(val < 0)
|
||||
|
@ -454,7 +460,7 @@ unsigned FLAC__bitbuffer_golomb_bits_signed(int val, unsigned parameter)
|
|||
|
||||
k = FLAC__bitmath_ilog2(parameter);
|
||||
if(parameter == 1u<<k) {
|
||||
assert(k <= 30);
|
||||
FLAC__ASSERT(k <= 30);
|
||||
|
||||
msbs = uval >> k;
|
||||
bits = 1 + k + msbs;
|
||||
|
@ -478,11 +484,11 @@ unsigned FLAC__bitbuffer_golomb_bits_unsigned(unsigned uval, unsigned parameter)
|
|||
unsigned bits, msbs;
|
||||
unsigned k;
|
||||
|
||||
assert(parameter > 0);
|
||||
FLAC__ASSERT(parameter > 0);
|
||||
|
||||
k = FLAC__bitmath_ilog2(parameter);
|
||||
if(parameter == 1u<<k) {
|
||||
assert(k <= 30);
|
||||
FLAC__ASSERT(k <= 30);
|
||||
|
||||
msbs = uval >> k;
|
||||
bits = 1 + k + msbs;
|
||||
|
@ -506,9 +512,9 @@ bool FLAC__bitbuffer_write_symmetric_rice_signed(FLAC__BitBuffer *bb, int val, u
|
|||
unsigned total_bits, interesting_bits, msbs;
|
||||
uint32 pattern;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(parameter <= 31);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(parameter <= 31);
|
||||
|
||||
/* init pattern with the unary end bit and the sign bit */
|
||||
if(val < 0) {
|
||||
|
@ -544,9 +550,9 @@ bool FLAC__bitbuffer_write_symmetric_rice_signed_guarded(FLAC__BitBuffer *bb, in
|
|||
unsigned total_bits, interesting_bits, msbs;
|
||||
uint32 pattern;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(parameter <= 31);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(parameter <= 31);
|
||||
|
||||
*overflow = false;
|
||||
|
||||
|
@ -588,9 +594,9 @@ bool FLAC__bitbuffer_write_symmetric_rice_signed_escape(FLAC__BitBuffer *bb, int
|
|||
unsigned total_bits, val_bits;
|
||||
uint32 pattern;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(parameter <= 31);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(parameter <= 31);
|
||||
|
||||
val_bits = FLAC__bitmath_silog2(val);
|
||||
total_bits = 2 + parameter + 5 + val_bits;
|
||||
|
@ -623,9 +629,9 @@ bool FLAC__bitbuffer_write_rice_signed(FLAC__BitBuffer *bb, int val, unsigned pa
|
|||
unsigned total_bits, interesting_bits, msbs, uval;
|
||||
uint32 pattern;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(parameter <= 30);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(parameter <= 30);
|
||||
|
||||
/* convert signed to unsigned */
|
||||
if(val < 0)
|
||||
|
@ -663,9 +669,9 @@ bool FLAC__bitbuffer_write_rice_signed_guarded(FLAC__BitBuffer *bb, int val, uns
|
|||
unsigned total_bits, interesting_bits, msbs, uval;
|
||||
uint32 pattern;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(parameter <= 30);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(parameter <= 30);
|
||||
|
||||
*overflow = false;
|
||||
|
||||
|
@ -709,9 +715,9 @@ bool FLAC__bitbuffer_write_golomb_signed(FLAC__BitBuffer *bb, int val, unsigned
|
|||
unsigned total_bits, msbs, uval;
|
||||
unsigned k;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(parameter > 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(parameter > 0);
|
||||
|
||||
/* convert signed to unsigned */
|
||||
if(val < 0)
|
||||
|
@ -727,7 +733,7 @@ bool FLAC__bitbuffer_write_golomb_signed(FLAC__BitBuffer *bb, int val, unsigned
|
|||
if(parameter == 1u<<k) {
|
||||
unsigned pattern;
|
||||
|
||||
assert(k <= 30);
|
||||
FLAC__ASSERT(k <= 30);
|
||||
|
||||
msbs = uval >> k;
|
||||
total_bits = 1 + k + msbs;
|
||||
|
@ -777,15 +783,15 @@ bool FLAC__bitbuffer_write_golomb_unsigned(FLAC__BitBuffer *bb, unsigned uval, u
|
|||
unsigned total_bits, msbs;
|
||||
unsigned k;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(parameter > 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(parameter > 0);
|
||||
|
||||
k = FLAC__bitmath_ilog2(parameter);
|
||||
if(parameter == 1u<<k) {
|
||||
unsigned pattern;
|
||||
|
||||
assert(k <= 30);
|
||||
FLAC__ASSERT(k <= 30);
|
||||
|
||||
msbs = uval >> k;
|
||||
total_bits = 1 + k + msbs;
|
||||
|
@ -834,10 +840,10 @@ bool FLAC__bitbuffer_write_utf8_uint32(FLAC__BitBuffer *bb, uint32 val)
|
|||
{
|
||||
bool ok = 1;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(!(val & 0x80000000)); /* this version only handles 31 bits */
|
||||
FLAC__ASSERT(!(val & 0x80000000)); /* this version only handles 31 bits */
|
||||
|
||||
if(val < 0x80) {
|
||||
return FLAC__bitbuffer_write_raw_uint32(bb, val, 8);
|
||||
|
@ -880,10 +886,10 @@ bool FLAC__bitbuffer_write_utf8_uint64(FLAC__BitBuffer *bb, uint64 val)
|
|||
{
|
||||
bool ok = 1;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(!(val & 0xFFFFFFF000000000)); /* this version only handles 36 bits */
|
||||
FLAC__ASSERT(!(val & 0xFFFFFFF000000000)); /* this version only handles 36 bits */
|
||||
|
||||
if(val < 0x80) {
|
||||
return FLAC__bitbuffer_write_raw_uint32(bb, (uint32)val, 8);
|
||||
|
@ -943,9 +949,9 @@ bool FLAC__bitbuffer_zero_pad_to_byte_boundary(FLAC__BitBuffer *bb)
|
|||
bool FLAC__bitbuffer_peek_bit(FLAC__BitBuffer *bb, unsigned *val, bool (*read_callback)(byte buffer[], unsigned *bytes, void *client_data), void *client_data)
|
||||
{
|
||||
/* to avoid a drastic speed penalty we don't:
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(bb->bits == 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb->bits == 0);
|
||||
*/
|
||||
|
||||
while(1) {
|
||||
|
@ -963,9 +969,9 @@ bool FLAC__bitbuffer_peek_bit(FLAC__BitBuffer *bb, unsigned *val, bool (*read_ca
|
|||
bool FLAC__bitbuffer_read_bit(FLAC__BitBuffer *bb, unsigned *val, bool (*read_callback)(byte buffer[], unsigned *bytes, void *client_data), void *client_data)
|
||||
{
|
||||
/* to avoid a drastic speed penalty we don't:
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(bb->bits == 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb->bits == 0);
|
||||
*/
|
||||
|
||||
while(1) {
|
||||
|
@ -990,9 +996,9 @@ bool FLAC__bitbuffer_read_bit(FLAC__BitBuffer *bb, unsigned *val, bool (*read_ca
|
|||
bool FLAC__bitbuffer_read_bit_to_uint32(FLAC__BitBuffer *bb, uint32 *val, bool (*read_callback)(byte buffer[], unsigned *bytes, void *client_data), void *client_data)
|
||||
{
|
||||
/* to avoid a drastic speed penalty we don't:
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(bb->bits == 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb->bits == 0);
|
||||
*/
|
||||
|
||||
while(1) {
|
||||
|
@ -1018,9 +1024,9 @@ bool FLAC__bitbuffer_read_bit_to_uint32(FLAC__BitBuffer *bb, uint32 *val, bool (
|
|||
bool FLAC__bitbuffer_read_bit_to_uint64(FLAC__BitBuffer *bb, uint64 *val, bool (*read_callback)(byte buffer[], unsigned *bytes, void *client_data), void *client_data)
|
||||
{
|
||||
/* to avoid a drastic speed penalty we don't:
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(bb->bits == 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb->bits == 0);
|
||||
*/
|
||||
|
||||
while(1) {
|
||||
|
@ -1048,10 +1054,10 @@ bool FLAC__bitbuffer_read_raw_uint32(FLAC__BitBuffer *bb, uint32 *val, const uns
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(bits <= 32);
|
||||
FLAC__ASSERT(bits <= 32);
|
||||
|
||||
*val = 0;
|
||||
for(i = 0; i < bits; i++) {
|
||||
|
@ -1065,11 +1071,11 @@ bool FLAC__bitbuffer_read_raw_uint32(FLAC__BitBuffer *bb, uint32 *val, const uns
|
|||
unsigned i, bits_ = bits;
|
||||
uint32 v = 0;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(bits <= 32);
|
||||
assert((bb->capacity*8) * 2 >= bits);
|
||||
FLAC__ASSERT(bits <= 32);
|
||||
FLAC__ASSERT((bb->capacity*8) * 2 >= bits);
|
||||
|
||||
while(bb->total_consumed_bits + bits > bb->total_bits) {
|
||||
if(!bitbuffer_read_from_client_(bb, read_callback, client_data))
|
||||
|
@ -1119,10 +1125,10 @@ bool FLAC__bitbuffer_read_raw_int32(FLAC__BitBuffer *bb, int32 *val, const unsig
|
|||
unsigned i;
|
||||
uint32 v;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(bits <= 32);
|
||||
FLAC__ASSERT(bits <= 32);
|
||||
|
||||
v = 0;
|
||||
for(i = 0; i < bits; i++) {
|
||||
|
@ -1147,11 +1153,11 @@ bool FLAC__bitbuffer_read_raw_int32(FLAC__BitBuffer *bb, int32 *val, const unsig
|
|||
unsigned i, bits_ = bits;
|
||||
uint32 v = 0;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(bits <= 32);
|
||||
assert((bb->capacity*8) * 2 >= bits);
|
||||
FLAC__ASSERT(bits <= 32);
|
||||
FLAC__ASSERT((bb->capacity*8) * 2 >= bits);
|
||||
|
||||
while(bb->total_consumed_bits + bits > bb->total_bits) {
|
||||
if(!bitbuffer_read_from_client_(bb, read_callback, client_data))
|
||||
|
@ -1214,10 +1220,10 @@ bool FLAC__bitbuffer_read_raw_uint64(FLAC__BitBuffer *bb, uint64 *val, const uns
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(bits <= 64);
|
||||
FLAC__ASSERT(bits <= 64);
|
||||
|
||||
*val = 0;
|
||||
for(i = 0; i < bits; i++) {
|
||||
|
@ -1231,11 +1237,11 @@ bool FLAC__bitbuffer_read_raw_uint64(FLAC__BitBuffer *bb, uint64 *val, const uns
|
|||
unsigned i, bits_ = bits;
|
||||
uint64 v = 0;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(bits <= 64);
|
||||
assert((bb->capacity*8) * 2 >= bits);
|
||||
FLAC__ASSERT(bits <= 64);
|
||||
FLAC__ASSERT((bb->capacity*8) * 2 >= bits);
|
||||
|
||||
while(bb->total_consumed_bits + bits > bb->total_bits) {
|
||||
if(!bitbuffer_read_from_client_(bb, read_callback, client_data))
|
||||
|
@ -1285,10 +1291,10 @@ bool FLAC__bitbuffer_read_raw_int64(FLAC__BitBuffer *bb, int64 *val, const unsig
|
|||
unsigned i;
|
||||
uint64 v;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(bits <= 64);
|
||||
FLAC__ASSERT(bits <= 64);
|
||||
|
||||
v = 0;
|
||||
for(i = 0; i < bits; i++) {
|
||||
|
@ -1312,11 +1318,11 @@ bool FLAC__bitbuffer_read_raw_int64(FLAC__BitBuffer *bb, int64 *val, const unsig
|
|||
unsigned i, bits_ = bits;
|
||||
uint64 v = 0;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
assert(bits <= 64);
|
||||
assert((bb->capacity*8) * 2 >= bits);
|
||||
FLAC__ASSERT(bits <= 64);
|
||||
FLAC__ASSERT((bb->capacity*8) * 2 >= bits);
|
||||
|
||||
while(bb->total_consumed_bits + bits > bb->total_bits) {
|
||||
if(!bitbuffer_read_from_client_(bb, read_callback, client_data))
|
||||
|
@ -1379,8 +1385,8 @@ bool FLAC__bitbuffer_read_unary_unsigned(FLAC__BitBuffer *bb, unsigned *val, boo
|
|||
{
|
||||
unsigned bit, val_ = 0;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
while(1) {
|
||||
if(!FLAC__bitbuffer_read_bit(bb, &bit, read_callback, client_data))
|
||||
|
@ -1399,8 +1405,8 @@ bool FLAC__bitbuffer_read_unary_unsigned(FLAC__BitBuffer *bb, unsigned *val, boo
|
|||
unsigned total_bytes_ = (bb->total_bits + 7) / 8;
|
||||
byte b;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
if(bb->consumed_bits) {
|
||||
b = bb->buffer[bb->consumed_bytes] << bb->consumed_bits;
|
||||
|
@ -1464,9 +1470,9 @@ bool FLAC__bitbuffer_read_symmetric_rice_signed(FLAC__BitBuffer *bb, int *val, u
|
|||
{
|
||||
uint32 sign = 0, lsbs = 0, msbs = 0;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(parameter <= 31);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(parameter <= 31);
|
||||
|
||||
/* read the unary MSBs and end bit */
|
||||
if(!FLAC__bitbuffer_read_unary_unsigned(bb, &msbs, read_callback, client_data))
|
||||
|
@ -1493,9 +1499,9 @@ bool FLAC__bitbuffer_read_rice_signed(FLAC__BitBuffer *bb, int *val, unsigned pa
|
|||
uint32 lsbs = 0, msbs = 0;
|
||||
unsigned uval;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
assert(parameter <= 31);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
FLAC__ASSERT(parameter <= 31);
|
||||
|
||||
/* read the unary MSBs and end bit */
|
||||
if(!FLAC__bitbuffer_read_unary_unsigned(bb, &msbs, read_callback, client_data))
|
||||
|
@ -1520,8 +1526,8 @@ bool FLAC__bitbuffer_read_golomb_signed(FLAC__BitBuffer *bb, int *val, unsigned
|
|||
uint32 lsbs = 0, msbs = 0;
|
||||
unsigned bit, uval, k;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
k = FLAC__bitmath_ilog2(parameter);
|
||||
|
||||
|
@ -1564,8 +1570,8 @@ bool FLAC__bitbuffer_read_golomb_unsigned(FLAC__BitBuffer *bb, unsigned *val, un
|
|||
uint32 lsbs, msbs = 0;
|
||||
unsigned bit, k;
|
||||
|
||||
assert(bb != 0);
|
||||
assert(bb->buffer != 0);
|
||||
FLAC__ASSERT(bb != 0);
|
||||
FLAC__ASSERT(bb->buffer != 0);
|
||||
|
||||
k = FLAC__bitmath_ilog2(parameter);
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "private/bitmath.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
unsigned FLAC__bitmath_ilog2(unsigned v)
|
||||
{
|
||||
unsigned l = 0;
|
||||
assert(v > 0);
|
||||
FLAC__ASSERT(v > 0);
|
||||
while(v >>= 1)
|
||||
l++;
|
||||
return l;
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* for malloc() */
|
||||
#include <string.h> /* for memcpy() */
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/encoder.h"
|
||||
#include "FLAC/seek_table.h"
|
||||
#include "private/bitbuffer.h"
|
||||
|
@ -139,9 +139,9 @@ bool encoder_resize_buffers_(FLAC__Encoder *encoder, unsigned new_size)
|
|||
bool ok;
|
||||
unsigned i, channel;
|
||||
|
||||
assert(new_size > 0);
|
||||
assert(encoder->state == FLAC__ENCODER_OK);
|
||||
assert(encoder->guts->current_sample_number == 0);
|
||||
FLAC__ASSERT(new_size > 0);
|
||||
FLAC__ASSERT(encoder->state == FLAC__ENCODER_OK);
|
||||
FLAC__ASSERT(encoder->guts->current_sample_number == 0);
|
||||
|
||||
/* To avoid excessive malloc'ing, we only grow the buffer; no shrinking. */
|
||||
if(new_size <= encoder->guts->input_capacity)
|
||||
|
@ -194,7 +194,7 @@ FLAC__Encoder *FLAC__encoder_get_new_instance()
|
|||
|
||||
void FLAC__encoder_free_instance(FLAC__Encoder *encoder)
|
||||
{
|
||||
assert(encoder != 0);
|
||||
FLAC__ASSERT(encoder != 0);
|
||||
free(encoder);
|
||||
}
|
||||
|
||||
|
@ -204,12 +204,12 @@ FLAC__EncoderState FLAC__encoder_init(FLAC__Encoder *encoder, FLAC__EncoderWrite
|
|||
FLAC__StreamMetaData padding;
|
||||
FLAC__StreamMetaData seek_table;
|
||||
|
||||
assert(sizeof(int) >= 4); /* we want to die right away if this is not true */
|
||||
assert(encoder != 0);
|
||||
assert(write_callback != 0);
|
||||
assert(metadata_callback != 0);
|
||||
assert(encoder->state == FLAC__ENCODER_UNINITIALIZED);
|
||||
assert(encoder->guts == 0);
|
||||
FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
|
||||
FLAC__ASSERT(encoder != 0);
|
||||
FLAC__ASSERT(write_callback != 0);
|
||||
FLAC__ASSERT(metadata_callback != 0);
|
||||
FLAC__ASSERT(encoder->state == FLAC__ENCODER_UNINITIALIZED);
|
||||
FLAC__ASSERT(encoder->guts == 0);
|
||||
|
||||
encoder->state = FLAC__ENCODER_OK;
|
||||
|
||||
|
@ -331,9 +331,9 @@ FLAC__EncoderState FLAC__encoder_init(FLAC__Encoder *encoder, FLAC__EncoderWrite
|
|||
encoder->guts->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients;
|
||||
/* now override with asm where appropriate */
|
||||
#ifndef FLAC__NO_ASM
|
||||
assert(encoder->guts->cpuinfo.use_asm);
|
||||
FLAC__ASSERT(encoder->guts->cpuinfo.use_asm);
|
||||
#ifdef FLAC__CPU_IA32
|
||||
assert(encoder->guts->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
|
||||
FLAC__ASSERT(encoder->guts->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
|
||||
#ifdef FLAC__HAS_NASM
|
||||
#if 0
|
||||
/* @@@ SSE version not working yet */
|
||||
|
@ -438,8 +438,8 @@ fprintf(stderr,"@@@ got _asm_i386 of lpc_compute_residual_from_qlp_coefficients(
|
|||
return encoder->state = FLAC__ENCODER_FRAMING_ERROR;
|
||||
}
|
||||
|
||||
assert(encoder->guts->frame.bits == 0); /* assert that we're byte-aligned before writing */
|
||||
assert(encoder->guts->frame.total_consumed_bits == 0); /* assert that no reading of the buffer was done */
|
||||
FLAC__ASSERT(encoder->guts->frame.bits == 0); /* assert that we're byte-aligned before writing */
|
||||
FLAC__ASSERT(encoder->guts->frame.total_consumed_bits == 0); /* assert that no reading of the buffer was done */
|
||||
if(encoder->guts->write_callback(encoder, encoder->guts->frame.buffer, encoder->guts->frame.bytes, 0, encoder->guts->current_frame_number, encoder->guts->client_data) != FLAC__ENCODER_WRITE_OK)
|
||||
return encoder->state = FLAC__ENCODER_FATAL_ERROR_WHILE_WRITING;
|
||||
|
||||
|
@ -455,7 +455,7 @@ void FLAC__encoder_finish(FLAC__Encoder *encoder)
|
|||
{
|
||||
unsigned i, channel;
|
||||
|
||||
assert(encoder != 0);
|
||||
FLAC__ASSERT(encoder != 0);
|
||||
if(encoder->state == FLAC__ENCODER_UNINITIALIZED)
|
||||
return;
|
||||
if(encoder->guts->current_sample_number != 0) {
|
||||
|
@ -526,8 +526,8 @@ bool FLAC__encoder_process(FLAC__Encoder *encoder, const int32 *buf[], unsigned
|
|||
int32 x, mid, side;
|
||||
const unsigned channels = encoder->channels, blocksize = encoder->blocksize;
|
||||
|
||||
assert(encoder != 0);
|
||||
assert(encoder->state == FLAC__ENCODER_OK);
|
||||
FLAC__ASSERT(encoder != 0);
|
||||
FLAC__ASSERT(encoder->state == FLAC__ENCODER_OK);
|
||||
|
||||
j = 0;
|
||||
if(encoder->do_mid_side_stereo && channels == 2) {
|
||||
|
@ -581,8 +581,8 @@ bool FLAC__encoder_process_interleaved(FLAC__Encoder *encoder, const int32 buf[]
|
|||
int32 x, mid, side;
|
||||
const unsigned channels = encoder->channels, blocksize = encoder->blocksize;
|
||||
|
||||
assert(encoder != 0);
|
||||
assert(encoder->state == FLAC__ENCODER_OK);
|
||||
FLAC__ASSERT(encoder != 0);
|
||||
FLAC__ASSERT(encoder->state == FLAC__ENCODER_OK);
|
||||
|
||||
j = k = 0;
|
||||
if(encoder->do_mid_side_stereo && channels == 2) {
|
||||
|
@ -631,7 +631,7 @@ bool FLAC__encoder_process_interleaved(FLAC__Encoder *encoder, const int32 buf[]
|
|||
|
||||
bool encoder_process_frame_(FLAC__Encoder *encoder, bool is_last_frame)
|
||||
{
|
||||
assert(encoder->state == FLAC__ENCODER_OK);
|
||||
FLAC__ASSERT(encoder->state == FLAC__ENCODER_OK);
|
||||
|
||||
/*
|
||||
* Accumulate raw signal to the MD5 signature
|
||||
|
@ -661,8 +661,8 @@ bool encoder_process_frame_(FLAC__Encoder *encoder, bool is_last_frame)
|
|||
/*
|
||||
* CRC-16 the whole thing
|
||||
*/
|
||||
assert(encoder->guts->frame.bits == 0); /* assert that we're byte-aligned */
|
||||
assert(encoder->guts->frame.total_consumed_bits == 0); /* assert that no reading of the buffer was done */
|
||||
FLAC__ASSERT(encoder->guts->frame.bits == 0); /* assert that we're byte-aligned */
|
||||
FLAC__ASSERT(encoder->guts->frame.total_consumed_bits == 0); /* assert that no reading of the buffer was done */
|
||||
FLAC__bitbuffer_write_raw_uint32(&encoder->guts->frame, FLAC__crc16(encoder->guts->frame.buffer, encoder->guts->frame.bytes), FLAC__FRAME_FOOTER_CRC_LEN);
|
||||
|
||||
/*
|
||||
|
@ -745,7 +745,7 @@ bool encoder_process_subframes_(FLAC__Encoder *encoder, bool is_last_frame)
|
|||
do_mid_side = false;
|
||||
}
|
||||
|
||||
assert(do_independent || do_mid_side);
|
||||
FLAC__ASSERT(do_independent || do_mid_side);
|
||||
|
||||
/*
|
||||
* Check for wasted bits; set effective bps for each subframe
|
||||
|
@ -760,7 +760,7 @@ bool encoder_process_subframes_(FLAC__Encoder *encoder, bool is_last_frame)
|
|||
}
|
||||
if(do_mid_side) {
|
||||
unsigned w;
|
||||
assert(encoder->channels == 2);
|
||||
FLAC__ASSERT(encoder->channels == 2);
|
||||
for(channel = 0; channel < 2; channel++) {
|
||||
w = encoder_get_wasted_bits_(encoder->guts->integer_signal_mid_side[channel], encoder->blocksize);
|
||||
encoder->guts->subframe_workspace_mid_side[channel][0].wasted_bits = encoder->guts->subframe_workspace_mid_side[channel][1].wasted_bits = w;
|
||||
|
@ -782,7 +782,7 @@ bool encoder_process_subframes_(FLAC__Encoder *encoder, bool is_last_frame)
|
|||
* Now do mid and side channels if requested
|
||||
*/
|
||||
if(do_mid_side) {
|
||||
assert(encoder->channels == 2);
|
||||
FLAC__ASSERT(encoder->channels == 2);
|
||||
|
||||
for(channel = 0; channel < 2; channel++) {
|
||||
if(!encoder_process_subframe_(encoder, min_partition_order, max_partition_order, false, &frame_header, encoder->guts->subframe_bps_mid_side[channel], encoder->guts->integer_signal_mid_side[channel], encoder->guts->real_signal_mid_side[channel], encoder->guts->subframe_workspace_ptr_mid_side[channel], encoder->guts->residual_workspace_mid_side[channel], encoder->guts->best_subframe_mid_side+channel, encoder->guts->best_subframe_bits_mid_side+channel))
|
||||
|
@ -798,7 +798,7 @@ bool encoder_process_subframes_(FLAC__Encoder *encoder, bool is_last_frame)
|
|||
FLAC__Subframe *left_subframe = 0, *right_subframe = 0; /* initialized only to prevent superfluous compiler warning */
|
||||
FLAC__ChannelAssignment channel_assignment;
|
||||
|
||||
assert(encoder->channels == 2);
|
||||
FLAC__ASSERT(encoder->channels == 2);
|
||||
|
||||
if(encoder->loose_mid_side_stereo && encoder->guts->loose_mid_side_stereo_frame_count > 0) {
|
||||
channel_assignment = (encoder->guts->last_channel_assignment == FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT? FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT : FLAC__CHANNEL_ASSIGNMENT_MID_SIDE);
|
||||
|
@ -808,7 +808,7 @@ bool encoder_process_subframes_(FLAC__Encoder *encoder, bool is_last_frame)
|
|||
unsigned min_bits;
|
||||
FLAC__ChannelAssignment ca;
|
||||
|
||||
assert(do_independent && do_mid_side);
|
||||
FLAC__ASSERT(do_independent && do_mid_side);
|
||||
|
||||
/* We have to figure out which channel assignent results in the smallest frame */
|
||||
bits[FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT] = encoder->guts->best_subframe_bits [0] + encoder->guts->best_subframe_bits [1];
|
||||
|
@ -849,7 +849,7 @@ bool encoder_process_subframes_(FLAC__Encoder *encoder, bool is_last_frame)
|
|||
right_subframe = &encoder->guts->subframe_workspace_mid_side[1][encoder->guts->best_subframe_mid_side[1]];
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
switch(channel_assignment) {
|
||||
|
@ -870,7 +870,7 @@ bool encoder_process_subframes_(FLAC__Encoder *encoder, bool is_last_frame)
|
|||
right_bps = encoder->guts->subframe_bps_mid_side[1];
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
/* note that encoder_add_subframe_ sets the state for us in case of an error */
|
||||
|
@ -1055,7 +1055,7 @@ bool encoder_add_subframe_(FLAC__Encoder *encoder, const FLAC__FrameHeader *fram
|
|||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1154,7 +1154,7 @@ unsigned encoder_find_best_partition_order_(const int32 residual[], uint32 abs_r
|
|||
|
||||
for(partition_order = (int)max_partition_order, sum = 0; partition_order >= (int)min_partition_order; partition_order--) {
|
||||
if(!encoder_set_partitioned_rice_(abs_residual, abs_residual_partition_sums+sum, raw_bits_per_partition+sum, residual_samples, predictor_order, rice_parameter, rice_parameter_search_dist, (unsigned)partition_order, parameters[!best_parameters_index], raw_bits[!best_parameters_index], &residual_bits)) {
|
||||
assert(0); /* encoder_precompute_partition_info_ should keep this from ever happening */
|
||||
FLAC__ASSERT(0); /* encoder_precompute_partition_info_ should keep this from ever happening */
|
||||
}
|
||||
sum += 1u << partition_order;
|
||||
if(best_residual_bits == 0 || residual_bits < best_residual_bits) {
|
||||
|
@ -1166,7 +1166,7 @@ unsigned encoder_find_best_partition_order_(const int32 residual[], uint32 abs_r
|
|||
#else
|
||||
for(partition_order = min_partition_order; partition_order <= max_partition_order; partition_order++) {
|
||||
if(!encoder_set_partitioned_rice_(abs_residual, 0, 0, residual_samples, predictor_order, rice_parameter, rice_parameter_search_dist, partition_order, parameters[!best_parameters_index], raw_bits[!best_parameters_index], &residual_bits)) {
|
||||
assert(best_residual_bits != 0);
|
||||
FLAC__ASSERT(best_residual_bits != 0);
|
||||
break;
|
||||
}
|
||||
if(best_residual_bits == 0 || residual_bits < best_residual_bits) {
|
||||
|
@ -1204,7 +1204,7 @@ unsigned encoder_precompute_partition_info_(const int32 residual[], uint32 abs_r
|
|||
const unsigned default_partition_samples = blocksize >> partition_order;
|
||||
|
||||
if(default_partition_samples <= predictor_order) {
|
||||
assert(max_partition_order > 0);
|
||||
FLAC__ASSERT(max_partition_order > 0);
|
||||
max_partition_order--;
|
||||
}
|
||||
else {
|
||||
|
@ -1296,7 +1296,7 @@ bool encoder_set_partitioned_rice_(const uint32 abs_residual[], const uint32 abs
|
|||
#endif
|
||||
unsigned bits_ = FLAC__ENTROPY_CODING_METHOD_TYPE_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN;
|
||||
|
||||
assert(suggested_rice_parameter < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER);
|
||||
FLAC__ASSERT(suggested_rice_parameter < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER);
|
||||
|
||||
if(partition_order == 0) {
|
||||
unsigned i;
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include "private/encoder_framing.h"
|
||||
#include "private/crc.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
#ifdef max
|
||||
#undef max
|
||||
|
@ -40,34 +40,34 @@ bool FLAC__add_metadata_block(const FLAC__StreamMetaData *metadata, FLAC__BitBuf
|
|||
if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->type, FLAC__STREAM_METADATA_TYPE_LEN))
|
||||
return false;
|
||||
|
||||
assert(metadata->length < (1u << FLAC__STREAM_METADATA_LENGTH_LEN));
|
||||
FLAC__ASSERT(metadata->length < (1u << FLAC__STREAM_METADATA_LENGTH_LEN));
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->length, FLAC__STREAM_METADATA_LENGTH_LEN))
|
||||
return false;
|
||||
|
||||
switch(metadata->type) {
|
||||
case FLAC__METADATA_TYPE_STREAMINFO:
|
||||
assert(metadata->data.stream_info.min_blocksize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN));
|
||||
FLAC__ASSERT(metadata->data.stream_info.min_blocksize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN));
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.min_blocksize, FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN))
|
||||
return false;
|
||||
assert(metadata->data.stream_info.max_blocksize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN));
|
||||
FLAC__ASSERT(metadata->data.stream_info.max_blocksize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN));
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.max_blocksize, FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN))
|
||||
return false;
|
||||
assert(metadata->data.stream_info.min_framesize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN));
|
||||
FLAC__ASSERT(metadata->data.stream_info.min_framesize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN));
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.min_framesize, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN))
|
||||
return false;
|
||||
assert(metadata->data.stream_info.max_framesize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN));
|
||||
FLAC__ASSERT(metadata->data.stream_info.max_framesize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN));
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.max_framesize, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN))
|
||||
return false;
|
||||
assert(metadata->data.stream_info.sample_rate > 0);
|
||||
assert(metadata->data.stream_info.sample_rate < (1u << FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN));
|
||||
FLAC__ASSERT(metadata->data.stream_info.sample_rate > 0);
|
||||
FLAC__ASSERT(metadata->data.stream_info.sample_rate < (1u << FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN));
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.sample_rate, FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN))
|
||||
return false;
|
||||
assert(metadata->data.stream_info.channels > 0);
|
||||
assert(metadata->data.stream_info.channels <= (1u << FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN));
|
||||
FLAC__ASSERT(metadata->data.stream_info.channels > 0);
|
||||
FLAC__ASSERT(metadata->data.stream_info.channels <= (1u << FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN));
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.channels-1, FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN))
|
||||
return false;
|
||||
assert(metadata->data.stream_info.bits_per_sample > 0);
|
||||
assert(metadata->data.stream_info.bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN));
|
||||
FLAC__ASSERT(metadata->data.stream_info.bits_per_sample > 0);
|
||||
FLAC__ASSERT(metadata->data.stream_info.bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN));
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.bits_per_sample-1, FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN))
|
||||
return false;
|
||||
if(!FLAC__bitbuffer_write_raw_uint64(bb, metadata->data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN))
|
||||
|
@ -92,7 +92,7 @@ bool FLAC__add_metadata_block(const FLAC__StreamMetaData *metadata, FLAC__BitBuf
|
|||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -103,7 +103,7 @@ bool FLAC__frame_add_header(const FLAC__FrameHeader *header, bool streamable_sub
|
|||
unsigned u, crc8_start, blocksize_hint, sample_rate_hint;
|
||||
byte crc8;
|
||||
|
||||
assert(bb->bits == 0); /* assert that we're byte-aligned before writing */
|
||||
FLAC__ASSERT(bb->bits == 0); /* assert that we're byte-aligned before writing */
|
||||
|
||||
crc8_start = bb->bytes;
|
||||
|
||||
|
@ -113,7 +113,7 @@ bool FLAC__frame_add_header(const FLAC__FrameHeader *header, bool streamable_sub
|
|||
if(!FLAC__bitbuffer_write_raw_uint32(bb, 0, FLAC__FRAME_HEADER_RESERVED_LEN))
|
||||
return false;
|
||||
|
||||
assert(header->blocksize > 0 && header->blocksize <= FLAC__MAX_BLOCK_SIZE);
|
||||
FLAC__ASSERT(header->blocksize > 0 && header->blocksize <= FLAC__MAX_BLOCK_SIZE);
|
||||
blocksize_hint = 0;
|
||||
switch(header->blocksize) {
|
||||
case 192: u = 1; break;
|
||||
|
@ -143,7 +143,7 @@ bool FLAC__frame_add_header(const FLAC__FrameHeader *header, bool streamable_sub
|
|||
if(!FLAC__bitbuffer_write_raw_uint32(bb, u, FLAC__FRAME_HEADER_BLOCK_SIZE_LEN))
|
||||
return false;
|
||||
|
||||
assert(header->sample_rate > 0 && header->sample_rate < (1u << FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN));
|
||||
FLAC__ASSERT(header->sample_rate > 0 && header->sample_rate < (1u << FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN));
|
||||
sample_rate_hint = 0;
|
||||
switch(header->sample_rate) {
|
||||
case 8000: u = 4; break;
|
||||
|
@ -170,30 +170,30 @@ bool FLAC__frame_add_header(const FLAC__FrameHeader *header, bool streamable_sub
|
|||
if(!FLAC__bitbuffer_write_raw_uint32(bb, u, FLAC__FRAME_HEADER_SAMPLE_RATE_LEN))
|
||||
return false;
|
||||
|
||||
assert(header->channels > 0 && header->channels <= (1u << FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN) && header->channels <= FLAC__MAX_CHANNELS);
|
||||
FLAC__ASSERT(header->channels > 0 && header->channels <= (1u << FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN) && header->channels <= FLAC__MAX_CHANNELS);
|
||||
switch(header->channel_assignment) {
|
||||
case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT:
|
||||
u = header->channels - 1;
|
||||
break;
|
||||
case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
|
||||
assert(header->channels == 2);
|
||||
FLAC__ASSERT(header->channels == 2);
|
||||
u = 8;
|
||||
break;
|
||||
case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
|
||||
assert(header->channels == 2);
|
||||
FLAC__ASSERT(header->channels == 2);
|
||||
u = 9;
|
||||
break;
|
||||
case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
|
||||
assert(header->channels == 2);
|
||||
FLAC__ASSERT(header->channels == 2);
|
||||
u = 10;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, u, FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN))
|
||||
return false;
|
||||
|
||||
assert(header->bits_per_sample > 0 && header->bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN));
|
||||
FLAC__ASSERT(header->bits_per_sample > 0 && header->bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN));
|
||||
switch(header->bits_per_sample) {
|
||||
case 8 : u = 1; break;
|
||||
case 12: u = 2; break;
|
||||
|
@ -231,8 +231,8 @@ bool FLAC__frame_add_header(const FLAC__FrameHeader *header, bool streamable_sub
|
|||
}
|
||||
|
||||
/* write the CRC */
|
||||
assert(bb->buffer[crc8_start] == 0xff); /* MAGIC NUMBER for the first byte of the sync code */
|
||||
assert(bb->bits == 0); /* assert that we're byte-aligned */
|
||||
FLAC__ASSERT(bb->buffer[crc8_start] == 0xff); /* MAGIC NUMBER for the first byte of the sync code */
|
||||
FLAC__ASSERT(bb->bits == 0); /* assert that we're byte-aligned */
|
||||
crc8 = FLAC__crc8(bb->buffer+crc8_start, bb->bytes-crc8_start);
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, crc8, FLAC__FRAME_HEADER_CRC_LEN))
|
||||
return false;
|
||||
|
@ -275,7 +275,7 @@ bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned res
|
|||
return false;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -311,7 +311,7 @@ bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residua
|
|||
return false;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -345,7 +345,7 @@ bool subframe_add_entropy_coding_method_(FLAC__BitBuffer *bb, const FLAC__Entrop
|
|||
return false;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* for malloc() */
|
||||
#include <string.h> /* for strcmp() */
|
||||
#include <sys/stat.h> /* for stat() */
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/file_decoder.h"
|
||||
#include "protected/stream_decoder.h"
|
||||
#include "private/md5.h"
|
||||
|
@ -85,13 +85,13 @@ FLAC__FileDecoderState FLAC__file_decoder_init(
|
|||
void *client_data
|
||||
)
|
||||
{
|
||||
assert(sizeof(int) >= 4); /* we want to die right away if this is not true */
|
||||
assert(decoder != 0);
|
||||
assert(write_callback != 0);
|
||||
assert(metadata_callback != 0);
|
||||
assert(error_callback != 0);
|
||||
assert(decoder->state == FLAC__FILE_DECODER_UNINITIALIZED);
|
||||
assert(decoder->guts == 0);
|
||||
FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
FLAC__ASSERT(write_callback != 0);
|
||||
FLAC__ASSERT(metadata_callback != 0);
|
||||
FLAC__ASSERT(error_callback != 0);
|
||||
FLAC__ASSERT(decoder->state == FLAC__FILE_DECODER_UNINITIALIZED);
|
||||
FLAC__ASSERT(decoder->guts == 0);
|
||||
|
||||
decoder->state = FLAC__FILE_DECODER_OK;
|
||||
|
||||
|
@ -140,7 +140,7 @@ bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder)
|
|||
{
|
||||
bool md5_failed = false;
|
||||
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
if(decoder->state == FLAC__FILE_DECODER_UNINITIALIZED)
|
||||
return true;
|
||||
if(decoder->guts != 0) {
|
||||
|
@ -170,7 +170,7 @@ bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder)
|
|||
bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder)
|
||||
{
|
||||
bool ret;
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(decoder->guts->stream->state == FLAC__STREAM_DECODER_END_OF_STREAM)
|
||||
decoder->state = FLAC__FILE_DECODER_END_OF_FILE;
|
||||
|
@ -178,7 +178,7 @@ bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder)
|
|||
if(decoder->state == FLAC__FILE_DECODER_END_OF_FILE)
|
||||
return true;
|
||||
|
||||
assert(decoder->state == FLAC__FILE_DECODER_OK);
|
||||
FLAC__ASSERT(decoder->state == FLAC__FILE_DECODER_OK);
|
||||
|
||||
ret = FLAC__stream_decoder_process_whole_stream(decoder->guts->stream);
|
||||
if(!ret)
|
||||
|
@ -190,7 +190,7 @@ bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder)
|
|||
bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder)
|
||||
{
|
||||
bool ret;
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(decoder->guts->stream->state == FLAC__STREAM_DECODER_END_OF_STREAM)
|
||||
decoder->state = FLAC__FILE_DECODER_END_OF_FILE;
|
||||
|
@ -198,7 +198,7 @@ bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder)
|
|||
if(decoder->state == FLAC__FILE_DECODER_END_OF_FILE)
|
||||
return true;
|
||||
|
||||
assert(decoder->state == FLAC__FILE_DECODER_OK);
|
||||
FLAC__ASSERT(decoder->state == FLAC__FILE_DECODER_OK);
|
||||
|
||||
ret = FLAC__stream_decoder_process_metadata(decoder->guts->stream);
|
||||
if(!ret)
|
||||
|
@ -210,7 +210,7 @@ bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder)
|
|||
bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder)
|
||||
{
|
||||
bool ret;
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(decoder->guts->stream->state == FLAC__STREAM_DECODER_END_OF_STREAM)
|
||||
decoder->state = FLAC__FILE_DECODER_END_OF_FILE;
|
||||
|
@ -218,7 +218,7 @@ bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder)
|
|||
if(decoder->state == FLAC__FILE_DECODER_END_OF_FILE)
|
||||
return true;
|
||||
|
||||
assert(decoder->state == FLAC__FILE_DECODER_OK);
|
||||
FLAC__ASSERT(decoder->state == FLAC__FILE_DECODER_OK);
|
||||
|
||||
ret = FLAC__stream_decoder_process_one_frame(decoder->guts->stream);
|
||||
if(!ret)
|
||||
|
@ -230,7 +230,7 @@ bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder)
|
|||
bool FLAC__file_decoder_process_remaining_frames(FLAC__FileDecoder *decoder)
|
||||
{
|
||||
bool ret;
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(decoder->guts->stream->state == FLAC__STREAM_DECODER_END_OF_STREAM)
|
||||
decoder->state = FLAC__FILE_DECODER_END_OF_FILE;
|
||||
|
@ -238,7 +238,7 @@ bool FLAC__file_decoder_process_remaining_frames(FLAC__FileDecoder *decoder)
|
|||
if(decoder->state == FLAC__FILE_DECODER_END_OF_FILE)
|
||||
return true;
|
||||
|
||||
assert(decoder->state == FLAC__FILE_DECODER_OK);
|
||||
FLAC__ASSERT(decoder->state == FLAC__FILE_DECODER_OK);
|
||||
|
||||
ret = FLAC__stream_decoder_process_remaining_frames(decoder->guts->stream);
|
||||
if(!ret)
|
||||
|
@ -252,8 +252,8 @@ bool FLAC__file_decoder_seek_absolute(FLAC__FileDecoder *decoder, uint64 sample)
|
|||
long filesize;
|
||||
struct stat filestats;
|
||||
|
||||
assert(decoder != 0);
|
||||
assert(decoder->state == FLAC__FILE_DECODER_OK);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
FLAC__ASSERT(decoder->state == FLAC__FILE_DECODER_OK);
|
||||
|
||||
if(decoder->guts->filename == 0) { /* means the file is stdin... */
|
||||
decoder->state = FLAC__FILE_DECODER_SEEK_ERROR;
|
||||
|
@ -423,7 +423,7 @@ bool seek_to_absolute_sample_(FLAC__FileDecoder *decoder, long filesize, uint64
|
|||
return false;
|
||||
}
|
||||
first_frame_offset -= FLAC__stream_decoder_input_bytes_unconsumed(decoder->guts->stream);
|
||||
assert(first_frame_offset >= 0);
|
||||
FLAC__ASSERT(first_frame_offset >= 0);
|
||||
|
||||
/*
|
||||
* First, we set an upper and lower bound on where in the
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include "private/fixed.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
#ifndef M_LN2
|
||||
/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */
|
||||
|
@ -162,7 +162,7 @@ void FLAC__fixed_compute_residual(const int32 data[], unsigned data_len, unsigne
|
|||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,6 +200,6 @@ void FLAC__fixed_restore_signal(const int32 residual[], unsigned data_len, unsig
|
|||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include "FLAC/format.h"
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ cglobal FLAC__lpc_restore_signal_asm_i386_mmx
|
|||
; unsigned sample, coeff;
|
||||
; const unsigned limit = data_len - lag;
|
||||
;
|
||||
; assert(lag > 0);
|
||||
; assert(lag <= data_len);
|
||||
; FLAC__ASSERT(lag > 0);
|
||||
; FLAC__ASSERT(lag <= data_len);
|
||||
;
|
||||
; for(coeff = 0; coeff < lag; coeff++)
|
||||
; autoc[coeff] = 0.0;
|
||||
|
@ -790,7 +790,7 @@ cident FLAC__lpc_compute_residual_from_qlp_coefficients_asm_i386_mmx
|
|||
; unsigned i, j;
|
||||
; int32 sum;
|
||||
;
|
||||
; assert(order > 0);
|
||||
; FLAC__ASSERT(order > 0);
|
||||
;
|
||||
; for(i = 0; i < data_len; i++) {
|
||||
; sum = 0;
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/format.h"
|
||||
#include "private/lpc.h"
|
||||
|
||||
|
@ -37,8 +37,8 @@ void FLAC__lpc_compute_autocorrelation(const real data[], unsigned data_len, uns
|
|||
real d;
|
||||
unsigned i;
|
||||
|
||||
assert(lag > 0);
|
||||
assert(lag <= data_len);
|
||||
FLAC__ASSERT(lag > 0);
|
||||
FLAC__ASSERT(lag <= data_len);
|
||||
|
||||
while(lag--) {
|
||||
for(i = lag, d = 0.0; i < data_len; i++)
|
||||
|
@ -55,8 +55,8 @@ void FLAC__lpc_compute_autocorrelation(const real data[], unsigned data_len, uns
|
|||
unsigned sample, coeff;
|
||||
const unsigned limit = data_len - lag;
|
||||
|
||||
assert(lag > 0);
|
||||
assert(lag <= data_len);
|
||||
FLAC__ASSERT(lag > 0);
|
||||
FLAC__ASSERT(lag <= data_len);
|
||||
|
||||
for(coeff = 0; coeff < lag; coeff++)
|
||||
autoc[coeff] = 0.0;
|
||||
|
@ -77,9 +77,9 @@ void FLAC__lpc_compute_lp_coefficients(const real autoc[], unsigned max_order, r
|
|||
unsigned i, j;
|
||||
real r, err, ref[FLAC__MAX_LPC_ORDER], lpc[FLAC__MAX_LPC_ORDER];
|
||||
|
||||
assert(0 < max_order);
|
||||
assert(max_order <= FLAC__MAX_LPC_ORDER);
|
||||
assert(autoc[0] != 0.0);
|
||||
FLAC__ASSERT(0 < max_order);
|
||||
FLAC__ASSERT(max_order <= FLAC__MAX_LPC_ORDER);
|
||||
FLAC__ASSERT(autoc[0] != 0.0);
|
||||
|
||||
err = autoc[0];
|
||||
|
||||
|
@ -114,11 +114,11 @@ int FLAC__lpc_quantize_coefficients(const real lp_coeff[], unsigned order, unsig
|
|||
unsigned i;
|
||||
real d, cmax = -1e10;
|
||||
|
||||
assert(bits_per_sample > 0);
|
||||
assert(bits_per_sample <= sizeof(int32)*8);
|
||||
assert(precision > 0);
|
||||
assert(precision >= FLAC__MIN_QLP_COEFF_PRECISION);
|
||||
assert(precision + bits_per_sample < sizeof(int32)*8);
|
||||
FLAC__ASSERT(bits_per_sample > 0);
|
||||
FLAC__ASSERT(bits_per_sample <= sizeof(int32)*8);
|
||||
FLAC__ASSERT(precision > 0);
|
||||
FLAC__ASSERT(precision >= FLAC__MIN_QLP_COEFF_PRECISION);
|
||||
FLAC__ASSERT(precision + bits_per_sample < sizeof(int32)*8);
|
||||
#ifdef NDEBUG
|
||||
(void)bits_per_sample; /* silence compiler warning about unused parameter */
|
||||
#endif
|
||||
|
@ -171,7 +171,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients(const int32 data[], unsign
|
|||
fprintf(stderr,", q[%u]=%d",i,qlp_coeff[i]);
|
||||
fprintf(stderr,"\n");
|
||||
#endif
|
||||
assert(order > 0);
|
||||
FLAC__ASSERT(order > 0);
|
||||
|
||||
for(i = 0; i < data_len; i++) {
|
||||
#ifdef FLAC__OVERFLOW_DETECT
|
||||
|
@ -216,7 +216,7 @@ void FLAC__lpc_restore_signal(const int32 residual[], unsigned data_len, const i
|
|||
fprintf(stderr,", q[%u]=%d",i,qlp_coeff[i]);
|
||||
fprintf(stderr,"\n");
|
||||
#endif
|
||||
assert(order > 0);
|
||||
FLAC__ASSERT(order > 0);
|
||||
|
||||
for(i = 0; i < data_len; i++) {
|
||||
#ifdef FLAC__OVERFLOW_DETECT
|
||||
|
@ -250,7 +250,7 @@ real FLAC__lpc_compute_expected_bits_per_residual_sample(real lpc_error, unsigne
|
|||
{
|
||||
real error_scale;
|
||||
|
||||
assert(total_samples > 0);
|
||||
FLAC__ASSERT(total_samples > 0);
|
||||
|
||||
error_scale = 0.5 * M_LN2 * M_LN2 / (real)total_samples;
|
||||
|
||||
|
@ -291,8 +291,8 @@ unsigned FLAC__lpc_compute_best_order(const real lpc_error[], unsigned max_order
|
|||
unsigned order, best_order;
|
||||
real best_bits, tmp_bits, error_scale;
|
||||
|
||||
assert(max_order > 0);
|
||||
assert(total_samples > 0);
|
||||
FLAC__ASSERT(max_order > 0);
|
||||
FLAC__ASSERT(total_samples > 0);
|
||||
|
||||
error_scale = 0.5 * M_LN2 * M_LN2 / (real)total_samples;
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
* Still in the public domain.
|
||||
*/
|
||||
|
||||
#include <assert.h> /* for assert() */
|
||||
#include <stdlib.h> /* for malloc() */
|
||||
#include <string.h> /* for memcpy() */
|
||||
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "private/memory.h"
|
||||
#include "FLAC/assert.h"
|
||||
|
||||
void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address)
|
||||
{
|
||||
void *x;
|
||||
|
||||
assert(0 != aligned_address);
|
||||
FLAC__ASSERT(0 != aligned_address);
|
||||
|
||||
#ifdef FLAC__ALIGN_MALLOC_DATA
|
||||
/* align on 32-byte (256-bit) boundary */
|
||||
|
@ -41,10 +41,10 @@ bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, int32 **unaligned
|
|||
{
|
||||
int32 *pa, *pu; /* aligned pointer, unaligned pointer */
|
||||
|
||||
assert(elements > 0);
|
||||
assert(0 != unaligned_pointer);
|
||||
assert(0 != aligned_pointer);
|
||||
assert(unaligned_pointer != aligned_pointer);
|
||||
FLAC__ASSERT(elements > 0);
|
||||
FLAC__ASSERT(0 != unaligned_pointer);
|
||||
FLAC__ASSERT(0 != aligned_pointer);
|
||||
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
|
||||
|
||||
pu = (int32*)FLAC__memory_alloc_aligned(sizeof(int32) * elements, (void*)&pa);
|
||||
if(0 == pu) {
|
||||
|
@ -63,10 +63,10 @@ bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, uint32 **unalign
|
|||
{
|
||||
uint32 *pa, *pu; /* aligned pointer, unaligned pointer */
|
||||
|
||||
assert(elements > 0);
|
||||
assert(0 != unaligned_pointer);
|
||||
assert(0 != aligned_pointer);
|
||||
assert(unaligned_pointer != aligned_pointer);
|
||||
FLAC__ASSERT(elements > 0);
|
||||
FLAC__ASSERT(0 != unaligned_pointer);
|
||||
FLAC__ASSERT(0 != aligned_pointer);
|
||||
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
|
||||
|
||||
pu = (uint32*)FLAC__memory_alloc_aligned(sizeof(uint32) * elements, (void*)&pa);
|
||||
if(0 == pu) {
|
||||
|
@ -85,10 +85,10 @@ bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned **una
|
|||
{
|
||||
unsigned *pa, *pu; /* aligned pointer, unaligned pointer */
|
||||
|
||||
assert(elements > 0);
|
||||
assert(0 != unaligned_pointer);
|
||||
assert(0 != aligned_pointer);
|
||||
assert(unaligned_pointer != aligned_pointer);
|
||||
FLAC__ASSERT(elements > 0);
|
||||
FLAC__ASSERT(0 != unaligned_pointer);
|
||||
FLAC__ASSERT(0 != aligned_pointer);
|
||||
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
|
||||
|
||||
pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(unsigned) * elements, (void*)&pa);
|
||||
if(0 == pu) {
|
||||
|
@ -107,10 +107,10 @@ bool FLAC__memory_alloc_aligned_real_array(unsigned elements, real **unaligned_p
|
|||
{
|
||||
real *pa, *pu; /* aligned pointer, unaligned pointer */
|
||||
|
||||
assert(elements > 0);
|
||||
assert(0 != unaligned_pointer);
|
||||
assert(0 != aligned_pointer);
|
||||
assert(unaligned_pointer != aligned_pointer);
|
||||
FLAC__ASSERT(elements > 0);
|
||||
FLAC__ASSERT(0 != unaligned_pointer);
|
||||
FLAC__ASSERT(0 != aligned_pointer);
|
||||
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
|
||||
|
||||
pu = (real*)FLAC__memory_alloc_aligned(sizeof(real) * elements, (void*)&pa);
|
||||
if(0 == pu) {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "FLAC/seek_table.h"
|
||||
|
||||
bool FLAC__seek_table_is_valid(const FLAC__StreamMetaData_SeekTable *seek_table)
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* for malloc() */
|
||||
#include <string.h> /* for memset/memcpy() */
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/stream_decoder.h"
|
||||
#include "private/bitbuffer.h"
|
||||
#include "private/cpu.h"
|
||||
|
@ -124,14 +124,14 @@ FLAC__StreamDecoderState FLAC__stream_decoder_init(
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
assert(sizeof(int) >= 4); /* we want to die right away if this is not true */
|
||||
assert(decoder != 0);
|
||||
assert(read_callback != 0);
|
||||
assert(write_callback != 0);
|
||||
assert(metadata_callback != 0);
|
||||
assert(error_callback != 0);
|
||||
assert(decoder->state == FLAC__STREAM_DECODER_UNINITIALIZED);
|
||||
assert(decoder->guts == 0);
|
||||
FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
FLAC__ASSERT(read_callback != 0);
|
||||
FLAC__ASSERT(write_callback != 0);
|
||||
FLAC__ASSERT(metadata_callback != 0);
|
||||
FLAC__ASSERT(error_callback != 0);
|
||||
FLAC__ASSERT(decoder->state == FLAC__STREAM_DECODER_UNINITIALIZED);
|
||||
FLAC__ASSERT(decoder->guts == 0);
|
||||
|
||||
decoder->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA;
|
||||
|
||||
|
@ -168,9 +168,9 @@ FLAC__StreamDecoderState FLAC__stream_decoder_init(
|
|||
decoder->guts->local_lpc_restore_signal = FLAC__lpc_restore_signal;
|
||||
/* now override with asm where appropriate */
|
||||
#ifndef FLAC__NO_ASM
|
||||
assert(decoder->guts->cpuinfo.use_asm);
|
||||
FLAC__ASSERT(decoder->guts->cpuinfo.use_asm);
|
||||
#ifdef FLAC__CPU_IA32
|
||||
assert(decoder->guts->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
|
||||
FLAC__ASSERT(decoder->guts->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
|
||||
#ifdef FLAC__HAS_NASM
|
||||
#if 0
|
||||
/* @@@ MMX version needs bps check */
|
||||
|
@ -193,7 +193,7 @@ fprintf(stderr,"@@@ got _asm_i386 of lpc_restore_signal()\n");}
|
|||
void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder)
|
||||
{
|
||||
unsigned i;
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
if(decoder->state == FLAC__STREAM_DECODER_UNINITIALIZED)
|
||||
return;
|
||||
if(decoder->guts != 0) {
|
||||
|
@ -220,7 +220,7 @@ void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder)
|
|||
|
||||
bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder)
|
||||
{
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(!FLAC__bitbuffer_clear(&decoder->guts->input)) {
|
||||
decoder->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||
|
@ -232,7 +232,7 @@ bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder)
|
|||
|
||||
bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder)
|
||||
{
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(!FLAC__stream_decoder_flush(decoder)) {
|
||||
decoder->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||
|
@ -248,12 +248,12 @@ bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder)
|
|||
bool FLAC__stream_decoder_process_whole_stream(FLAC__StreamDecoder *decoder)
|
||||
{
|
||||
bool dummy;
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(decoder->state == FLAC__STREAM_DECODER_END_OF_STREAM)
|
||||
return true;
|
||||
|
||||
assert(decoder->state == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA);
|
||||
FLAC__ASSERT(decoder->state == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA);
|
||||
|
||||
if(!FLAC__stream_decoder_reset(decoder)) {
|
||||
decoder->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||
|
@ -281,19 +281,19 @@ bool FLAC__stream_decoder_process_whole_stream(FLAC__StreamDecoder *decoder)
|
|||
case FLAC__STREAM_DECODER_END_OF_STREAM:
|
||||
return true;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool FLAC__stream_decoder_process_metadata(FLAC__StreamDecoder *decoder)
|
||||
{
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(decoder->state == FLAC__STREAM_DECODER_END_OF_STREAM)
|
||||
return true;
|
||||
|
||||
assert(decoder->state == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA);
|
||||
FLAC__ASSERT(decoder->state == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA);
|
||||
|
||||
if(!FLAC__stream_decoder_reset(decoder)) {
|
||||
decoder->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||
|
@ -316,7 +316,7 @@ bool FLAC__stream_decoder_process_metadata(FLAC__StreamDecoder *decoder)
|
|||
case FLAC__STREAM_DECODER_END_OF_STREAM:
|
||||
return true;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -324,12 +324,12 @@ bool FLAC__stream_decoder_process_metadata(FLAC__StreamDecoder *decoder)
|
|||
bool FLAC__stream_decoder_process_one_frame(FLAC__StreamDecoder *decoder)
|
||||
{
|
||||
bool got_a_frame;
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(decoder->state == FLAC__STREAM_DECODER_END_OF_STREAM)
|
||||
return true;
|
||||
|
||||
assert(decoder->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC);
|
||||
FLAC__ASSERT(decoder->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC);
|
||||
|
||||
while(1) {
|
||||
switch(decoder->state) {
|
||||
|
@ -346,7 +346,7 @@ bool FLAC__stream_decoder_process_one_frame(FLAC__StreamDecoder *decoder)
|
|||
case FLAC__STREAM_DECODER_END_OF_STREAM:
|
||||
return true;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -354,12 +354,12 @@ bool FLAC__stream_decoder_process_one_frame(FLAC__StreamDecoder *decoder)
|
|||
bool FLAC__stream_decoder_process_remaining_frames(FLAC__StreamDecoder *decoder)
|
||||
{
|
||||
bool dummy;
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(decoder->state == FLAC__STREAM_DECODER_END_OF_STREAM)
|
||||
return true;
|
||||
|
||||
assert(decoder->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC);
|
||||
FLAC__ASSERT(decoder->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC);
|
||||
|
||||
while(1) {
|
||||
switch(decoder->state) {
|
||||
|
@ -374,14 +374,14 @@ bool FLAC__stream_decoder_process_remaining_frames(FLAC__StreamDecoder *decoder)
|
|||
case FLAC__STREAM_DECODER_END_OF_STREAM:
|
||||
return true;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned FLAC__stream_decoder_input_bytes_unconsumed(FLAC__StreamDecoder *decoder)
|
||||
{
|
||||
assert(decoder != 0);
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
return decoder->guts->input.bytes - decoder->guts->input.consumed_bytes;
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ bool stream_decoder_find_metadata_(FLAC__StreamDecoder *decoder)
|
|||
unsigned i, id;
|
||||
bool first = true;
|
||||
|
||||
assert(decoder->guts->input.consumed_bits == 0); /* make sure we're byte aligned */
|
||||
FLAC__ASSERT(decoder->guts->input.consumed_bits == 0); /* make sure we're byte aligned */
|
||||
|
||||
for(i = id = 0; i < 4; ) {
|
||||
if(decoder->guts->cached) {
|
||||
|
@ -493,7 +493,7 @@ bool stream_decoder_read_metadata_(FLAC__StreamDecoder *decoder)
|
|||
uint32 i, x, last_block, type, length;
|
||||
uint64 xx;
|
||||
|
||||
assert(decoder->guts->input.consumed_bits == 0); /* make sure we're byte aligned */
|
||||
FLAC__ASSERT(decoder->guts->input.consumed_bits == 0); /* make sure we're byte aligned */
|
||||
|
||||
if(!FLAC__bitbuffer_read_raw_uint32(&decoder->guts->input, &last_block, FLAC__STREAM_METADATA_IS_LAST_LEN, read_callback_, decoder))
|
||||
return false; /* the read_callback_ sets the state for us */
|
||||
|
@ -554,7 +554,7 @@ bool stream_decoder_read_metadata_(FLAC__StreamDecoder *decoder)
|
|||
used_bits += i*8;
|
||||
|
||||
/* skip the rest of the block */
|
||||
assert(used_bits % 8 == 0);
|
||||
FLAC__ASSERT(used_bits % 8 == 0);
|
||||
length -= (used_bits / 8);
|
||||
for(i = 0; i < length; i++) {
|
||||
if(!FLAC__bitbuffer_read_raw_uint32(&decoder->guts->input, &x, 8, read_callback_, decoder))
|
||||
|
@ -723,22 +723,22 @@ bool stream_decoder_read_frame_(FLAC__StreamDecoder *decoder, bool *got_a_frame)
|
|||
/* no adjustment needed */
|
||||
break;
|
||||
case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
|
||||
assert(decoder->guts->frame.header.channels == 2);
|
||||
FLAC__ASSERT(decoder->guts->frame.header.channels == 2);
|
||||
if(channel == 1)
|
||||
bps++;
|
||||
break;
|
||||
case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
|
||||
assert(decoder->guts->frame.header.channels == 2);
|
||||
FLAC__ASSERT(decoder->guts->frame.header.channels == 2);
|
||||
if(channel == 0)
|
||||
bps++;
|
||||
break;
|
||||
case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
|
||||
assert(decoder->guts->frame.header.channels == 2);
|
||||
FLAC__ASSERT(decoder->guts->frame.header.channels == 2);
|
||||
if(channel == 1)
|
||||
bps++;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
/*
|
||||
* now read it
|
||||
|
@ -766,17 +766,17 @@ bool stream_decoder_read_frame_(FLAC__StreamDecoder *decoder, bool *got_a_frame)
|
|||
/* do nothing */
|
||||
break;
|
||||
case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE:
|
||||
assert(decoder->guts->frame.header.channels == 2);
|
||||
FLAC__ASSERT(decoder->guts->frame.header.channels == 2);
|
||||
for(i = 0; i < decoder->guts->frame.header.blocksize; i++)
|
||||
decoder->guts->output[1][i] = decoder->guts->output[0][i] - decoder->guts->output[1][i];
|
||||
break;
|
||||
case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE:
|
||||
assert(decoder->guts->frame.header.channels == 2);
|
||||
FLAC__ASSERT(decoder->guts->frame.header.channels == 2);
|
||||
for(i = 0; i < decoder->guts->frame.header.blocksize; i++)
|
||||
decoder->guts->output[0][i] += decoder->guts->output[1][i];
|
||||
break;
|
||||
case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
|
||||
assert(decoder->guts->frame.header.channels == 2);
|
||||
FLAC__ASSERT(decoder->guts->frame.header.channels == 2);
|
||||
for(i = 0; i < decoder->guts->frame.header.blocksize; i++) {
|
||||
mid = decoder->guts->output[0][i];
|
||||
side = decoder->guts->output[1][i];
|
||||
|
@ -790,7 +790,7 @@ bool stream_decoder_read_frame_(FLAC__StreamDecoder *decoder, bool *got_a_frame)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -833,7 +833,7 @@ bool stream_decoder_read_frame_header_(FLAC__StreamDecoder *decoder)
|
|||
const bool is_known_variable_blocksize_stream = (decoder->guts->has_stream_info && decoder->guts->stream_info.data.stream_info.min_blocksize != decoder->guts->stream_info.data.stream_info.max_blocksize);
|
||||
const bool is_known_fixed_blocksize_stream = (decoder->guts->has_stream_info && decoder->guts->stream_info.data.stream_info.min_blocksize == decoder->guts->stream_info.data.stream_info.max_blocksize);
|
||||
|
||||
assert(decoder->guts->input.consumed_bits == 0); /* make sure we're byte aligned */
|
||||
FLAC__ASSERT(decoder->guts->input.consumed_bits == 0); /* make sure we're byte aligned */
|
||||
|
||||
/* init the raw header with the saved bits from synchronization */
|
||||
raw_header[0] = decoder->guts->header_warmup[0];
|
||||
|
@ -901,7 +901,7 @@ bool stream_decoder_read_frame_header_(FLAC__StreamDecoder *decoder)
|
|||
decoder->guts->frame.header.blocksize = 256 << (x-8);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -951,7 +951,7 @@ bool stream_decoder_read_frame_header_(FLAC__StreamDecoder *decoder)
|
|||
decoder->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
|
||||
return true;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
x = (unsigned)(raw_header[3] >> 4);
|
||||
|
@ -1004,7 +1004,7 @@ bool stream_decoder_read_frame_header_(FLAC__StreamDecoder *decoder)
|
|||
is_unparseable = true;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1223,7 +1223,7 @@ bool stream_decoder_read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned
|
|||
return false;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
/* decode the subframe */
|
||||
|
@ -1296,7 +1296,7 @@ bool stream_decoder_read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned ch
|
|||
return false;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
/* decode the subframe */
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
* duplicated here. Look for 'DUPLICATE:' in comments.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -239,7 +238,7 @@ bool list(FILE *f, bool verbose)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
FLAC__ASSERT(0);
|
||||
}
|
||||
|
||||
if(!metadata.is_last)
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <mmreg.h>
|
||||
#include <msacm.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "in2.h"
|
||||
#include "FLAC/all.h"
|
||||
|
@ -395,7 +394,7 @@ void metadata_callback(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaD
|
|||
stream_info_struct *stream_info = (stream_info_struct *)client_data;
|
||||
(void)decoder;
|
||||
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
|
||||
assert(metadata->data.stream_info.total_samples < 0x100000000); /* this plugin can only handle < 4 gigasamples */
|
||||
FLAC__ASSERT(metadata->data.stream_info.total_samples < 0x100000000); /* this plugin can only handle < 4 gigasamples */
|
||||
stream_info->total_samples = (unsigned)(metadata->data.stream_info.total_samples&0xffffffff);
|
||||
stream_info->bits_per_sample = metadata->data.stream_info.bits_per_sample;
|
||||
stream_info->channels = metadata->data.stream_info.channels;
|
||||
|
|
|
@ -346,7 +346,7 @@ FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder,
|
|||
if(file_info->abort_flag)
|
||||
return FLAC__STREAM_DECODER_WRITE_ABORT;
|
||||
|
||||
assert(bps == 16);
|
||||
FLAC__ASSERT(bps == 16);
|
||||
|
||||
for(sample = reservoir_samples_*channels, wide_sample = 0; wide_sample < wide_samples; wide_sample++)
|
||||
for(channel = 0; channel < channels; channel++, sample++)
|
||||
|
@ -362,7 +362,7 @@ void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMeta
|
|||
file_info_struct *file_info = (file_info_struct *)client_data;
|
||||
(void)decoder;
|
||||
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
|
||||
assert(metadata->data.stream_info.total_samples < 0x100000000); /* this plugin can only handle < 4 gigasamples */
|
||||
FLAC__ASSERT(metadata->data.stream_info.total_samples < 0x100000000); /* this plugin can only handle < 4 gigasamples */
|
||||
file_info->total_samples = (unsigned)(metadata->data.stream_info.total_samples&0xffffffff);
|
||||
file_info->bits_per_sample = metadata->data.stream_info.bits_per_sample;
|
||||
file_info->channels = metadata->data.stream_info.channels;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "xmms/plugin.h"
|
||||
|
@ -411,7 +410,7 @@ void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMeta
|
|||
file_info_struct *file_info = (file_info_struct *)client_data;
|
||||
(void)decoder;
|
||||
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
|
||||
assert(metadata->data.stream_info.total_samples < 0x100000000); /* this plugin can only handle < 4 gigasamples */
|
||||
FLAC__ASSERT(metadata->data.stream_info.total_samples < 0x100000000); /* this plugin can only handle < 4 gigasamples */
|
||||
file_info->total_samples = (unsigned)(metadata->data.stream_info.total_samples&0xffffffff);
|
||||
file_info->bits_per_sample = metadata->data.stream_info.bits_per_sample;
|
||||
file_info->channels = metadata->data.stream_info.channels;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <sys/time.h>
|
||||
#include "FLAC/assert.h"
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -151,7 +151,7 @@ static bool generate_fsd8(const char *fn, const int pattern[], unsigned reps)
|
|||
FILE *f;
|
||||
unsigned rep, p;
|
||||
|
||||
assert(pattern != 0);
|
||||
FLAC__ASSERT(pattern != 0);
|
||||
|
||||
if(0 == (f = fopen(fn, mode)))
|
||||
return false;
|
||||
|
@ -177,7 +177,7 @@ static bool generate_fsd16(const char *fn, const int pattern[], unsigned reps)
|
|||
FILE *f;
|
||||
unsigned rep, p;
|
||||
|
||||
assert(pattern != 0);
|
||||
FLAC__ASSERT(pattern != 0);
|
||||
|
||||
if(0 == (f = fopen(fn, mode)))
|
||||
return false;
|
||||
|
@ -231,7 +231,7 @@ static bool generate_fsd24(const char *fn, const int pattern[], unsigned reps)
|
|||
FILE *f;
|
||||
unsigned rep, p;
|
||||
|
||||
assert(pattern != 0);
|
||||
FLAC__ASSERT(pattern != 0);
|
||||
|
||||
if(0 == (f = fopen(fn, mode)))
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue