Possibly less than ideal, but gets ape_reader building on both gcc2 and 4. (The previous gcc4 fixes broke it again on gcc2). I'm uncertain as to why the include order of <algorithm> seems to matter though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30138 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
#include "All.h"
|
||||
#include "APEDecompress.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "All.h"
|
||||
#include "APEDecompress.h"
|
||||
#include "APEInfo.h"
|
||||
#include "Prepare.h"
|
||||
#include "UnBitArray.h"
|
||||
@@ -10,6 +9,11 @@
|
||||
|
||||
#define DECODE_BLOCK_SIZE 4096
|
||||
|
||||
#if __GNUC__ != 2
|
||||
using std::min;
|
||||
using std::max;
|
||||
#endif
|
||||
|
||||
CAPEDecompress::CAPEDecompress(int * pErrorCode, CAPEInfo * pAPEInfo, int nStartBlock, int nFinishBlock)
|
||||
{
|
||||
*pErrorCode = ERROR_SUCCESS;
|
||||
@@ -38,10 +42,10 @@ CAPEDecompress::CAPEDecompress(int * pErrorCode, CAPEInfo * pAPEInfo, int nStart
|
||||
|
||||
// set the "real" start and finish blocks
|
||||
m_nStartBlock = (nStartBlock < 0)
|
||||
? 0 : std::min(nStartBlock, GetInfo(APE_INFO_TOTAL_BLOCKS));
|
||||
? 0 : min(nStartBlock, GetInfo(APE_INFO_TOTAL_BLOCKS));
|
||||
m_nFinishBlock = (nFinishBlock < 0)
|
||||
? GetInfo(APE_INFO_TOTAL_BLOCKS)
|
||||
: std::min(nFinishBlock, GetInfo(APE_INFO_TOTAL_BLOCKS));
|
||||
: min(nFinishBlock, GetInfo(APE_INFO_TOTAL_BLOCKS));
|
||||
m_bIsRanged = (m_nStartBlock != 0) || (m_nFinishBlock != GetInfo(APE_INFO_TOTAL_BLOCKS));
|
||||
}
|
||||
|
||||
@@ -90,7 +94,7 @@ int CAPEDecompress::GetData(char * pBuffer, int nBlocks, int * pBlocksRetrieved)
|
||||
|
||||
// cap
|
||||
int nBlocksUntilFinish = m_nFinishBlock - m_nCurrentBlock;
|
||||
const int nBlocksToRetrieve = std::min(nBlocks, nBlocksUntilFinish);
|
||||
const int nBlocksToRetrieve = min(nBlocks, nBlocksUntilFinish);
|
||||
|
||||
// get the data
|
||||
unsigned char * pOutputBuffer = (unsigned char *) pBuffer;
|
||||
@@ -104,7 +108,7 @@ int CAPEDecompress::GetData(char * pBuffer, int nBlocks, int * pBlocksRetrieved)
|
||||
|
||||
// analyze how much to remove from the buffer
|
||||
const int nFrameBufferBlocks = m_nFrameBufferFinishedBlocks;
|
||||
nBlocksThisPass = std::min(nBlocksLeft, nFrameBufferBlocks);
|
||||
nBlocksThisPass = min(nBlocksLeft, nFrameBufferBlocks);
|
||||
|
||||
// remove as much as possible
|
||||
if (nBlocksThisPass > 0)
|
||||
@@ -187,7 +191,7 @@ int CAPEDecompress::FillFrameBuffer()
|
||||
|
||||
int nFrameOffsetBlocks = m_nCurrentFrameBufferBlock % GetInfo(APE_INFO_BLOCKS_PER_FRAME);
|
||||
int nFrameBlocksLeft = nFrameBlocks - nFrameOffsetBlocks;
|
||||
int nBlocksThisPass = std::min(nFrameBlocksLeft, nBlocksLeft);
|
||||
int nBlocksThisPass = min(nFrameBlocksLeft, nBlocksLeft);
|
||||
|
||||
// start the frame if we need to
|
||||
if (nFrameOffsetBlocks == 0)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef APE_APEDECOMPRESS_H
|
||||
#define APE_APEDECOMPRESS_H
|
||||
|
||||
#include "APEDecompress.h"
|
||||
|
||||
class CUnBitArray;
|
||||
class CPrepare;
|
||||
class CAPEInfo;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "All.h"
|
||||
#include "APEInfo.h"
|
||||
#include "APECompress.h"
|
||||
@@ -9,15 +11,17 @@
|
||||
#include "MD5.h"
|
||||
#include "CharacterHelper.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#define UNMAC_DECODER_OUTPUT_NONE 0
|
||||
#define UNMAC_DECODER_OUTPUT_WAV 1
|
||||
#define UNMAC_DECODER_OUTPUT_APE 2
|
||||
|
||||
#define BLOCKS_PER_DECODE 9216
|
||||
|
||||
#if __GNUC__ != 2
|
||||
using std::min;
|
||||
using std::max;
|
||||
#endif
|
||||
|
||||
int DecompressCore(const str_utf16 * pInputFilename, const str_utf16 * pOutputFilename, int nOutputMode, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag);
|
||||
|
||||
/*****************************************************************************************
|
||||
@@ -207,7 +211,7 @@ int __stdcall VerifyFileW(const str_utf16 * pInputFilename, int * pPercentageDon
|
||||
nBytesRead = 1;
|
||||
while ((nBytesLeft > 0) && (nBytesRead > 0))
|
||||
{
|
||||
int nBytesToRead = std::min(16384, nBytesLeft);
|
||||
int nBytesToRead = min(16384, nBytesLeft);
|
||||
if (pIO->Read(spBuffer, nBytesToRead, &nBytesRead) != ERROR_SUCCESS)
|
||||
throw(ERROR_IO_READ);
|
||||
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
#include "All.h"
|
||||
#include "APETag.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "All.h"
|
||||
#include "APETag.h"
|
||||
#include "ID3Genres.h"
|
||||
#include "CharacterHelper.h"
|
||||
#include "IO.h"
|
||||
#include IO_HEADER_FILE
|
||||
|
||||
#if __GNUC__ != 2
|
||||
using std::min;
|
||||
using std::max;
|
||||
#endif
|
||||
|
||||
/*****************************************************************************************
|
||||
CAPETagField
|
||||
*****************************************************************************************/
|
||||
@@ -19,7 +23,7 @@ CAPETagField::CAPETagField(const str_utf16 * pFieldName, const void * pFieldValu
|
||||
memcpy(m_spFieldNameUTF16, pFieldName, (wcslen(pFieldName) + 1) * sizeof(str_utf16));
|
||||
|
||||
// data (we'll always allocate two extra bytes and memset to 0 so we're safely NULL terminated)
|
||||
m_nFieldValueBytes = std::max(nFieldBytes, 0);
|
||||
m_nFieldValueBytes = max(nFieldBytes, 0);
|
||||
m_spFieldValue.Assign(new char [m_nFieldValueBytes + 2], TRUE);
|
||||
memset(m_spFieldValue, 0, m_nFieldValueBytes + 2);
|
||||
if (m_nFieldValueBytes > 0)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "All.h"
|
||||
#include "APEInfo.h"
|
||||
#include "UnBitArray.h"
|
||||
#include "BitArray.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
const uint32 POWERS_OF_TWO_MINUS_ONE_REVERSED[33] = {4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0};
|
||||
|
||||
@@ -27,6 +27,11 @@ const uint32 RANGE_WIDTH_2[64] = {19578,16582,12257,7906,4576,2366,1170,536,261,
|
||||
|
||||
#define MODEL_ELEMENTS 64
|
||||
|
||||
#if __GNUC__ != 2
|
||||
using std::min;
|
||||
using std::max;
|
||||
#endif
|
||||
|
||||
/***********************************************************************************
|
||||
Construction
|
||||
***********************************************************************************/
|
||||
@@ -111,7 +116,7 @@ int CUnBitArray::DecodeValueRange(UNBIT_ARRAY_STATE & BitArrayState)
|
||||
if (m_nVersion >= 3990)
|
||||
{
|
||||
// figure the pivot value
|
||||
int nPivotValue = std::max(BitArrayState.nKSum / 32, 1UL);
|
||||
int nPivotValue = max(BitArrayState.nKSum / 32, 1UL);
|
||||
|
||||
// get the overflow
|
||||
int nOverflow = 0;
|
||||
|
||||
Reference in New Issue
Block a user