V2: Use a single definition of MIN and MAX in sources

This commit is contained in:
Cristian Rodríguez
2012-04-05 19:39:37 -03:00
committed by Erik de Castro Lopo
parent d30fe60fc6
commit f029625591
11 changed files with 77 additions and 91 deletions

View File

@@ -59,16 +59,7 @@
#include "FLAC/stream_decoder.h"
#include "share/alloc.h"
#include "share/compat.h"
#ifdef max
#undef max
#endif
#define max(a,b) ((a)>(b)?(a):(b))
#ifdef min
#undef min
#endif
#define min(a,b) ((a)<(b)?(a):(b))
#include "private/macros.h"
/****************************************************************************
*
@@ -2634,7 +2625,7 @@ FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, F
const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8;
FLAC__byte buffer[4]; /* magic number is asserted below */
FLAC__ASSERT(max(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN, FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8 == sizeof(buffer));
FLAC__ASSERT(flac_max(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN, FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8 == sizeof(buffer));
pack_uint32_little_endian_(block->vendor_string.length, buffer, entry_length_len);
if(write_cb(buffer, 1, entry_length_len, handle) != entry_length_len)
@@ -3134,7 +3125,7 @@ FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, FLAC
FLAC__ASSERT(bytes >= 0);
while(bytes > 0) {
n = min(sizeof(buffer), (size_t)bytes);
n = flac_min(sizeof(buffer), (size_t)bytes);
if(fread(buffer, 1, n, file) != n) {
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
return false;
@@ -3156,7 +3147,7 @@ FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Re
FLAC__ASSERT(bytes >= 0);
while(bytes > 0) {
n = min(sizeof(buffer), (size_t)bytes);
n = flac_min(sizeof(buffer), (size_t)bytes);
if(read_cb(buffer, 1, n, handle) != n) {
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
return false;