diff -uNr Source.orig/Console/Console.cpp Source/Console/Console.cpp
--- Source.orig/Console/Console.cpp	Sat May  1 23:12:00 2004
+++ Source/Console/Console.cpp	Sun May 30 00:33:02 2004
@@ -74,7 +74,7 @@
 	CSmartPtr<wchar_t> spInputFilename; CSmartPtr<wchar_t> spOutputFilename;
 	int nRetVal = ERROR_UNDEFINED;
 	int nMode = UNDEFINED_MODE;
-	int nCompressionLevel;
+	int nCompressionLevel = 1000;
 	int nPercentageDone;
 		
 	// output the header
Binary files Source.orig/Console/Console.o and Source/Console/Console.o differ
Binary files Source.orig/MACLib/APECompress.o and Source/MACLib/APECompress.o differ
diff -uNr Source.orig/MACLib/APECompressCore.cpp Source/MACLib/APECompressCore.cpp
--- Source.orig/MACLib/APECompressCore.cpp	Wed May  5 22:34:00 2004
+++ Source/MACLib/APECompressCore.cpp	Sun May 30 00:38:47 2004
@@ -123,4 +123,5 @@
     }
     
     return 0;
-}
\ No newline at end of file
+}
+
Binary files Source.orig/MACLib/APECompressCore.o and Source/MACLib/APECompressCore.o differ
Binary files Source.orig/MACLib/APECompressCreate.o and Source/MACLib/APECompressCreate.o differ
diff -uNr Source.orig/MACLib/APEDecompress.cpp Source/MACLib/APEDecompress.cpp
--- Source.orig/MACLib/APEDecompress.cpp	Tue May 11 08:16:00 2004
+++ Source/MACLib/APEDecompress.cpp	Sun May 30 00:39:03 2004
@@ -444,7 +444,7 @@
         case APE_INFO_WAV_HEADER_DATA:
         {
             char * pBuffer = (char *) nParam1;
-            int nMaxBytes = nParam2;
+            unsigned int nMaxBytes = nParam2;
             
             if (sizeof(WAVE_HEADER) > nMaxBytes)
             {
Binary files Source.orig/MACLib/APEDecompress.o and Source/MACLib/APEDecompress.o differ
diff -uNr Source.orig/MACLib/APEHeader.cpp Source/MACLib/APEHeader.cpp
--- Source.orig/MACLib/APEHeader.cpp	Wed May  5 22:34:00 2004
+++ Source/MACLib/APEHeader.cpp	Sun May 30 01:17:17 2004
@@ -31,7 +31,7 @@
     if (cID3v2Header[0] == 'I' && cID3v2Header[1] == 'D' && cID3v2Header[2] == '3') 
     {
         // why is it so hard to figure the lenght of an ID3v2 tag ?!?
-        unsigned int nLength = *((unsigned int *) &cID3v2Header[6]);
+        //unsigned int nLength = *((unsigned int *) &cID3v2Header[6]);
 
         unsigned int nSyncSafeLength = 0;
         nSyncSafeLength = (cID3v2Header[6] & 127) << 21;
@@ -114,7 +114,7 @@
 {
     // error check
     if ((m_pIO == NULL) || (pInfo == NULL))
-        return ERROR_INVALID_PARAMETER;
+        return ERROR_INVALID_FUNCTION_PARAMETER;
 
     // variables
     unsigned int nBytesRead = 0;
@@ -277,4 +277,4 @@
     }
 
     return ERROR_SUCCESS;
-}
\ No newline at end of file
+}
Binary files Source.orig/MACLib/APEHeader.o and Source/MACLib/APEHeader.o differ
diff -uNr Source.orig/MACLib/APEInfo.cpp Source/MACLib/APEInfo.cpp
--- Source.orig/MACLib/APEInfo.cpp	Tue May 11 08:10:00 2004
+++ Source/MACLib/APEInfo.cpp	Sun May 30 00:48:03 2004
@@ -248,7 +248,7 @@
         
         if (m_APEFileInfo.nFormatFlags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)
         {
-            if (sizeof(WAVE_HEADER) > nMaxBytes)
+            if ((signed) sizeof(WAVE_HEADER) > nMaxBytes)
             {
                 nRetVal = -1;
             }
@@ -355,7 +355,9 @@
     case APE_INTERNAL_INFO:
         nRetVal = (int) &m_APEFileInfo;
         break;
+    default:
+	break;
     }
 
     return nRetVal;
-}
\ No newline at end of file
+}
Binary files Source.orig/MACLib/APEInfo.o and Source/MACLib/APEInfo.o differ
diff -uNr Source.orig/MACLib/APELink.cpp Source/MACLib/APELink.cpp
--- Source.orig/MACLib/APELink.cpp	Wed May  5 22:43:00 2004
+++ Source/MACLib/APELink.cpp	Sun May 30 00:42:51 2004
@@ -76,7 +76,7 @@
                     cImageFile[nIndex++] = *pImageCharacter++;
                 cImageFile[nIndex] = 0;
 
-                CSmartPtr<str_utf16> spImageFileUTF16(GetUTF16FromUTF8((UCHAR *) cImageFile), TRUE);
+                CSmartPtr<str_utf16> spImageFileUTF16(GetUTF16FromUTF8((unsigned char *) cImageFile), TRUE);
 
                 // process the path
                 if (wcsrchr(spImageFileUTF16, '\\') == NULL)
Binary files Source.orig/MACLib/APELink.o and Source/MACLib/APELink.o differ
Binary files Source.orig/MACLib/APESimple.o and Source/MACLib/APESimple.o differ
diff -uNr Source.orig/MACLib/APETag.cpp Source/MACLib/APETag.cpp
--- Source.orig/MACLib/APETag.cpp	Wed May  5 23:18:00 2004
+++ Source/MACLib/APETag.cpp	Sun May 30 00:49:20 2004
@@ -740,4 +740,4 @@
     CAPETagField * pFieldB = *((CAPETagField **) pB);
 
     return (pFieldA->GetFieldSize() - pFieldB->GetFieldSize());
-}
\ No newline at end of file
+}
Binary files Source.orig/MACLib/APETag.o and Source/MACLib/APETag.o differ
Binary files Source.orig/MACLib/Assembly/Assembly.obj and Source/MACLib/Assembly/Assembly.obj differ
diff -uNr Source.orig/MACLib/BitArray.cpp Source/MACLib/BitArray.cpp
--- Source.orig/MACLib/BitArray.cpp	Wed May  5 22:34:00 2004
+++ Source/MACLib/BitArray.cpp	Sun May 30 00:55:44 2004
@@ -72,7 +72,7 @@
     // write the entire file to disk
     unsigned int nBytesWritten = 0;
     unsigned int nBytesToWrite = 0;
-    unsigned int nRetVal = 0;
+    //unsigned int nRetVal = 0;
     
     if (bFinalize)
     {
@@ -220,7 +220,7 @@
     int nOriginalKSum = BitArrayState.nKSum;
 
     // get the working k
-    int nTempK = (BitArrayState.k) ? BitArrayState.k - 1 : 0;
+    //int nTempK = (BitArrayState.k) ? BitArrayState.k - 1 : 0;
     
     // update nKSum
     BitArrayState.nKSum += ((nEncode + 1) / 2) - ((BitArrayState.nKSum + 16) >> 5);
Binary files Source.orig/MACLib/BitArray.o and Source/MACLib/BitArray.o differ
diff -uNr Source.orig/MACLib/MACLib.cpp Source/MACLib/MACLib.cpp
--- Source.orig/MACLib/MACLib.cpp	Wed May  5 22:43:00 2004
+++ Source/MACLib/MACLib.cpp	Sun May 30 00:55:57 2004
@@ -154,4 +154,5 @@
         return ERROR_SUCCESS;
     }
     catch(...) { return ERROR_UNDEFINED; }
-}
\ No newline at end of file
+}
+
diff -uNr Source.orig/MACLib/MACLib.h Source/MACLib/MACLib.h
--- Source.orig/MACLib/MACLib.h	Wed May  5 22:43:00 2004
+++ Source/MACLib/MACLib.h	Sun May 30 00:31:53 2004
@@ -205,7 +205,7 @@
     APE_DECOMPRESS_CURRENT_BITRATE = 2004,      // current bitrate [ignored, ignored]
     APE_DECOMPRESS_AVERAGE_BITRATE = 2005,      // average bitrate (works with ranges) [ignored, ignored]
 
-    APE_INTERNAL_INFO = 3000,                   // for internal use -- don't use (returns APE_FILE_INFO *) [ignored, ignored]
+    APE_INTERNAL_INFO = 3000                   // for internal use -- don't use (returns APE_FILE_INFO *) [ignored, ignored]
 };
 
 /*************************************************************************************************
Binary files Source.orig/MACLib/MACLib.o and Source/MACLib/MACLib.o differ
Binary files Source.orig/MACLib/MACProgressHelper.o and Source/MACLib/MACProgressHelper.o differ
diff -uNr Source.orig/MACLib/MD5.cpp Source/MACLib/MD5.cpp
--- Source.orig/MACLib/MD5.cpp	Wed May  5 22:34:00 2004
+++ Source/MACLib/MD5.cpp	Sun May 30 01:34:07 2004
@@ -52,7 +52,7 @@
    For other targets, we need to use the C versions below.
 */
 
-#if !(defined (__i386__) || ((defined (__arm__) && (__BYTE_ORDER == __LITTLE_ENDIAN))))
+//#if !(defined (__i386__) || ((defined (__arm__) && (__BYTE_ORDER == __LITTLE_ENDIAN))))
 
 /*
    Initialise the MD5 context.
@@ -228,7 +228,7 @@
     memcpy ( (context -> buffer) + byteIndex, input + i, inputBytes - i );
 }
 
-#endif
+//#endif
 
 
 void 
diff -uNr Source.orig/MACLib/MD5.h Source/MACLib/MD5.h
--- Source.orig/MACLib/MD5.h	Thu Jan  1 01:00:00 1970
+++ Source/MACLib/MD5.h	Sun May 30 01:23:56 2004
@@ -0,0 +1,79 @@
+/*
+ *  Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.
+ *  
+ *  License to copy and use this software is granted provided that it is identified 
+ *  as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material 
+ *  mentioning or referencing this software or this function.
+ *
+ *  License is also granted to make and use derivative works provided that such 
+ *  works are identified as "derived from the RSA Data Security, Inc. MD5 Message-
+ *  Digest Algorithm" in all material mentioning or referencing the derived work.
+ *  
+ *  RSA Data Security, Inc. makes no representations concerning either the 
+ *  merchantability of this software or the suitability of this software for any 
+ *  particular purpose. It is provided "as is" without express or implied warranty 
+ *  of any kind. These notices must be retained in any copies of any part of this
+ *  documentation and/or software.
+ */
+
+#ifndef MD5SUM_MD5_H
+#define MD5SUM_MD5_H
+
+typedef unsigned int uint32_t;
+typedef unsigned char uint8_t;
+
+/*
+ *  Define the MD5 context structure
+ *  Please DO NOT change the order or contents of the structure as various assembler files depend on it !!
+ */
+ 
+typedef struct {
+   uint32_t  state  [ 4];     /* state (ABCD) */
+   uint32_t  count  [ 2];     /* number of bits, modulo 2^64 (least sig word first) */
+   uint8_t   buffer [64];     /* input buffer for incomplete buffer data */
+} MD5_CTX;
+
+void   MD5Init   ( MD5_CTX* ctx );
+void   MD5Update ( MD5_CTX* ctx, const uint8_t* buf, size_t len );
+void   MD5Final  ( uint8_t digest [16], MD5_CTX* ctx );
+
+class CMD5Helper
+{
+public:
+
+    CMD5Helper(BOOL bInitialize = TRUE)
+    {
+        if (bInitialize)
+            Initialize();
+    }
+
+    BOOL Initialize()
+    {
+        memset(&m_MD5Context, 0, sizeof(m_MD5Context));
+        MD5Init(&m_MD5Context);
+        m_nTotalBytes = 0;
+        return TRUE;
+    }
+
+    inline void AddData(const void * pData, int nBytes)
+    {
+        MD5Update(&m_MD5Context, (const uint8_t *) pData, nBytes);
+        m_nTotalBytes += nBytes;
+    }
+
+    BOOL GetResult(unsigned char cResult[16])
+    {
+        memset(cResult, 0, 16);
+        MD5Final(cResult, &m_MD5Context);
+        return TRUE;
+    }
+
+protected:
+
+    MD5_CTX m_MD5Context;
+    BOOL m_bStopped;
+    int m_nTotalBytes;
+};
+
+
+#endif /* MD5SUM_MD5_H */
Binary files Source.orig/MACLib/MD5.o and Source/MACLib/MD5.o differ
Binary files Source.orig/MACLib/NNFilter.o and Source/MACLib/NNFilter.o differ
Binary files Source.orig/MACLib/NewPredictor.o and Source/MACLib/NewPredictor.o differ
diff -uNr Source.orig/MACLib/Old/APEDecompressCore.cpp Source/MACLib/Old/APEDecompressCore.cpp
--- Source.orig/MACLib/Old/APEDecompressCore.cpp	Wed May  5 22:45:00 2004
+++ Source/MACLib/Old/APEDecompressCore.cpp	Sun May 30 01:41:04 2004
@@ -50,7 +50,7 @@
 
 void CAPEDecompressCore::GenerateDecodedArrays(int nBlocks, int nSpecialCodes, int nFrameIndex, int nCPULoadBalancingFactor)
 {
-    CUnBitArray * pBitArray = (CUnBitArray *) m_pUnBitArray;
+    //CUnBitArray * pBitArray = (CUnBitArray *) m_pUnBitArray;
     
     if (m_pAPEDecompress->GetInfo(APE_INFO_CHANNELS) == 2)
     {
diff -uNr Source.orig/MACLib/Old/APEDecompressCore.h Source/MACLib/Old/APEDecompressCore.h
--- Source.orig/MACLib/Old/APEDecompressCore.h	Wed May  5 22:45:00 2004
+++ Source/MACLib/Old/APEDecompressCore.h	Sun May 30 01:40:47 2004
@@ -34,4 +34,5 @@
 };
 
 
-#endif // #ifndef APE_DECOMPRESS_CORE_H
\ No newline at end of file
+#endif // #ifndef APE_DECOMPRESS_CORE_H
+
Binary files Source.orig/MACLib/Old/APEDecompressCore.o and Source/MACLib/Old/APEDecompressCore.o differ
diff -uNr Source.orig/MACLib/Old/APEDecompressOld.cpp Source/MACLib/Old/APEDecompressOld.cpp
--- Source.orig/MACLib/Old/APEDecompressOld.cpp	Wed May  5 22:34:00 2004
+++ Source/MACLib/Old/APEDecompressOld.cpp	Sun May 30 01:18:08 2004
@@ -244,7 +244,7 @@
             char * pBuffer = (char *) nParam1;
             int nMaxBytes = nParam2;
             
-            if (sizeof(WAVE_HEADER) > nMaxBytes)
+            if ((signed) sizeof(WAVE_HEADER) > nMaxBytes)
             {
                 nRetVal = -1;
             }
Binary files Source.orig/MACLib/Old/APEDecompressOld.o and Source/MACLib/Old/APEDecompressOld.o differ
diff -uNr Source.orig/MACLib/Old/Anti-Predictor.h Source/MACLib/Old/Anti-Predictor.h
--- Source.orig/MACLib/Old/Anti-Predictor.h	Wed May  5 22:34:00 2004
+++ Source/MACLib/Old/Anti-Predictor.h	Sun May 30 01:40:38 2004
@@ -14,7 +14,7 @@
 
     // construction/destruction
     CAntiPredictor();
-    ~CAntiPredictor();
+    virtual ~CAntiPredictor();
 
     // functions
     virtual void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements);
@@ -250,4 +250,4 @@
 
 #endif // #ifdef ENABLE_COMPRESSION_MODE_EXTRA_HIGH
 
-#endif // #ifndef APE_ANTIPREDICTOR_H
\ No newline at end of file
+#endif // #ifndef APE_ANTIPREDICTOR_H
Binary files Source.orig/MACLib/Old/Anti-Predictor.o and Source/MACLib/Old/Anti-Predictor.o differ
diff -uNr Source.orig/MACLib/Old/AntiPredictorExtraHigh.cpp Source/MACLib/Old/AntiPredictorExtraHigh.cpp
--- Source.orig/MACLib/Old/AntiPredictorExtraHigh.cpp	Wed May  5 22:34:00 2004
+++ Source/MACLib/Old/AntiPredictorExtraHigh.cpp	Sun May 30 01:43:03 2004
@@ -29,7 +29,7 @@
 
     memcpy(Output_Array, Input_Array, Max_Order * 4);
     
-    int m = 512;
+    //int m = 512;
 
     if (dm > 0)
         for (q = Max_Order; q < Number_of_Elements; q++) {
@@ -208,7 +208,7 @@
     int *op = &pOutputArray[nFirstElement];
     int *ip = &pInputArray[nFirstElement];
     int IPP2 = ip[-2];
-    int IPP1 = ip[-1];
+    //int IPP1 = ip[-1];
     int p7 = 2 * ip[-1] - ip[-2];
     int opp = op[-1];
     int Original;
Binary files Source.orig/MACLib/Old/AntiPredictorExtraHigh.o and Source/MACLib/Old/AntiPredictorExtraHigh.o differ
Binary files Source.orig/MACLib/Old/AntiPredictorFast.o and Source/MACLib/Old/AntiPredictorFast.o differ
diff -uNr Source.orig/MACLib/Old/AntiPredictorHigh.cpp Source/MACLib/Old/AntiPredictorHigh.cpp
--- Source.orig/MACLib/Old/AntiPredictorHigh.cpp	Wed May  5 22:34:00 2004
+++ Source/MACLib/Old/AntiPredictorHigh.cpp	Sun May 30 01:42:31 2004
@@ -127,7 +127,7 @@
     int m3 = 28;
     int m4 = 16;
     int OP0;
-    int OP1 = pOutputArray[12];
+    //int OP1 = pOutputArray[12];
     int p4 = pInputArray[12];
     int p3 = (pInputArray[12] - pInputArray[11]) << 1;
     int p2 = pInputArray[12] + ((pInputArray[10] - pInputArray[11]) << 3);// - pInputArray[3] + pInputArray[2];
@@ -219,7 +219,7 @@
     }
     
     m4 = 370;
-    int m5 = 3900;
+    //int m5 = 3900;
 
     pOutputArray[1] = pInputArray[1] + pOutputArray[0];
     pOutputArray[2] = pInputArray[2] + pOutputArray[1];
@@ -261,8 +261,8 @@
     // the frame to start prediction on
     #define FIRST_ELEMENT    16
 
-    int x = 100;
-    int y = -25;
+    //int x = 100;
+    //int y = -25;
 
     // short frame handling
     if (NumberOfElements < 20) 
@@ -302,40 +302,40 @@
         if (Original > 0) 
         {
             bm[0] -= ip[-1] > 0 ? 1 : -1;
-            bm[1] += ((unsigned int(ip[-2]) >> 30) & 2) - 1;
+            bm[1] += (((unsigned int)(ip[-2]) >> 30) & 2) - 1;
             bm[2] -= ip[-3] > 0 ? 1 : -1;
-            bm[3] += ((unsigned int(ip[-4]) >> 30) & 2) - 1;
+            bm[3] += (((unsigned int)(ip[-4]) >> 30) & 2) - 1;
             bm[4] -= ip[-5] > 0 ? 1 : -1;
-            bm[5] += ((unsigned int(ip[-6]) >> 30) & 2) - 1;
+            bm[5] += (((unsigned int)(ip[-6]) >> 30) & 2) - 1;
             bm[6] -= ip[-7] > 0 ? 1 : -1;
-            bm[7] += ((unsigned int(ip[-8]) >> 30) & 2) - 1;
+            bm[7] += (((unsigned int)(ip[-8]) >> 30) & 2) - 1;
             bm[8] -= ip[-9] > 0 ? 1 : -1;
-            bm[9] += ((unsigned int(ip[-10]) >> 30) & 2) - 1;
+            bm[9] += (((unsigned int)(ip[-10]) >> 30) & 2) - 1;
             bm[10] -= ip[-11] > 0 ? 1 : -1;
-            bm[11] += ((unsigned int(ip[-12]) >> 30) & 2) - 1;
+            bm[11] += (((unsigned int)(ip[-12]) >> 30) & 2) - 1;
             bm[12] -= ip[-13] > 0 ? 1 : -1;
-            bm[13] += ((unsigned int(ip[-14]) >> 30) & 2) - 1;
+            bm[13] += (((unsigned int)(ip[-14]) >> 30) & 2) - 1;
             bm[14] -= ip[-15] > 0 ? 1 : -1;
-            bm[15] += ((unsigned int(ip[-16]) >> 30) & 2) - 1;
+            bm[15] += (((unsigned int)(ip[-16]) >> 30) & 2) - 1;
         }
         else if (Original < 0) 
         {
             bm[0] -= ip[-1] <= 0 ? 1 : -1;
-            bm[1] -= ((unsigned int(ip[-2]) >> 30) & 2) - 1;
+            bm[1] -= (((unsigned int)(ip[-2]) >> 30) & 2) - 1;
             bm[2] -= ip[-3] <= 0 ? 1 : -1;
-            bm[3] -= ((unsigned int(ip[-4]) >> 30) & 2) - 1;
+            bm[3] -= (((unsigned int)(ip[-4]) >> 30) & 2) - 1;
             bm[4] -= ip[-5] <= 0 ? 1 : -1;
-            bm[5] -= ((unsigned int(ip[-6]) >> 30) & 2) - 1;
+            bm[5] -= (((unsigned int)(ip[-6]) >> 30) & 2) - 1;
             bm[6] -= ip[-7] <= 0 ? 1 : -1;
-            bm[7] -= ((unsigned int(ip[-8]) >> 30) & 2) - 1;
+            bm[7] -= (((unsigned int)(ip[-8]) >> 30) & 2) - 1;
             bm[8] -= ip[-9] <= 0 ? 1 : -1;
-            bm[9] -= ((unsigned int(ip[-10]) >> 30) & 2) - 1;
+            bm[9] -= (((unsigned int)(ip[-10]) >> 30) & 2) - 1;
             bm[10] -= ip[-11] <= 0 ? 1 : -1;
-            bm[11] -= ((unsigned int(ip[-12]) >> 30) & 2) - 1;
+            bm[11] -= (((unsigned int)(ip[-12]) >> 30) & 2) - 1;
             bm[12] -= ip[-13] <= 0 ? 1 : -1;
-            bm[13] -= ((unsigned int(ip[-14]) >> 30) & 2) - 1;
+            bm[13] -= (((unsigned int)(ip[-14]) >> 30) & 2) - 1;
             bm[14] -= ip[-15] <= 0 ? 1 : -1;
-            bm[15] -= ((unsigned int(ip[-16]) >> 30) & 2) - 1;
+            bm[15] -= (((unsigned int)(ip[-16]) >> 30) & 2) - 1;
         }
 
         /////////////////////////////////////////////
@@ -399,7 +399,7 @@
     int *op = &pOutputArray[FIRST_ELEMENT];
     int *ip = &pInputArray[FIRST_ELEMENT];
     int IPP2 = ip[-2];
-    int IPP1 = ip[-1];
+    //int IPP1 = ip[-1];
     int p7 = 2 * ip[-1] - ip[-2];
     int opp = op[-1];
     
Binary files Source.orig/MACLib/Old/AntiPredictorHigh.o and Source/MACLib/Old/AntiPredictorHigh.o differ
diff -uNr Source.orig/MACLib/Old/AntiPredictorNormal.cpp Source/MACLib/Old/AntiPredictorNormal.cpp
--- Source.orig/MACLib/Old/AntiPredictorNormal.cpp	Wed May  5 22:34:00 2004
+++ Source/MACLib/Old/AntiPredictorNormal.cpp	Sun May 30 01:41:19 2004
@@ -128,7 +128,7 @@
     int m2 = 64;
     int m3 = 28;
     int OP0;
-    int OP1 = pOutputArray[4];
+    //int OP1 = pOutputArray[4];
 
     int p3 = (3 * (pOutputArray[4] - pOutputArray[3])) + pOutputArray[2];
     int p2 = pInputArray[4] + ((pInputArray[2] - pInputArray[3]) << 3) - pInputArray[1] + pInputArray[0];
Binary files Source.orig/MACLib/Old/AntiPredictorNormal.o and Source/MACLib/Old/AntiPredictorNormal.o differ
diff -uNr Source.orig/MACLib/Old/UnBitArrayOld.cpp Source/MACLib/Old/UnBitArrayOld.cpp
--- Source.orig/MACLib/Old/UnBitArrayOld.cpp	Wed May  5 22:34:00 2004
+++ Source/MACLib/Old/UnBitArrayOld.cpp	Sun May 30 01:40:10 2004
@@ -2,18 +2,18 @@
 #ifdef BACKWARDS_COMPATIBILITY
 
 #include "../APEInfo.h"
-#include "UnBitarrayOld.h"
+#include "UnBitArrayOld.h"
 #include "../BitArray.h"
 
-const uint32 K_SUM_MIN_BOUNDARY_OLD[32] = {0,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,0,0,0,0,0,0};
-const uint32 K_SUM_MAX_BOUNDARY_OLD[32] = {128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,0,0,0,0,0,0,0};
-const uint32 Powers_of_Two[32] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648};
-const uint32 Powers_of_Two_Reversed[32] = {2147483648,1073741824,536870912,268435456,134217728,67108864,33554432,16777216,8388608,4194304,2097152,1048576,524288,262144,131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1};
-const uint32 Powers_of_Two_Minus_One[33] = {0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295};
-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};
+const uint32 K_SUM_MIN_BOUNDARY_OLD[32] = {0,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648U,0,0,0,0,0,0};
+const uint32 K_SUM_MAX_BOUNDARY_OLD[32] = {128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648U,0,0,0,0,0,0,0};
+const uint32 Powers_of_Two[32] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648U};
+const uint32 Powers_of_Two_Reversed[32] = {2147483648U,1073741824,536870912,268435456,134217728,67108864,33554432,16777216,8388608,4194304,2097152,1048576,524288,262144,131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1};
+const uint32 Powers_of_Two_Minus_One[33] = {0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647U,4294967295U};
+const uint32 Powers_of_Two_Minus_One_Reversed[33] = {4294967295U,2147483647U,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};
 
-const uint32 K_SUM_MIN_BOUNDARY[32] = {0,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,0,0,0,0};
-const uint32 K_SUM_MAX_BOUNDARY[32] = {32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,0,0,0,0,0};
+const uint32 K_SUM_MIN_BOUNDARY[32] = {0,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648U,0,0,0,0};
+const uint32 K_SUM_MAX_BOUNDARY[32] = {32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648U,0,0,0,0,0};
 
 /***********************************************************************************
 Construction
Binary files Source.orig/MACLib/Old/UnBitArrayOld.o and Source/MACLib/Old/UnBitArrayOld.o differ
Binary files Source.orig/MACLib/Old/UnMAC.o and Source/MACLib/Old/UnMAC.o differ
Binary files Source.orig/MACLib/Prepare.o and Source/MACLib/Prepare.o differ
diff -uNr Source.orig/MACLib/UnBitArray.cpp Source/MACLib/UnBitArray.cpp
--- Source.orig/MACLib/UnBitArray.cpp	Wed May  5 22:34:00 2004
+++ Source/MACLib/UnBitArray.cpp	Sun May 30 00:57:21 2004
@@ -45,6 +45,8 @@
     {
     case DECODE_VALUE_METHOD_UNSIGNED_INT:
         return DecodeValueXBits(32);
+    default:
+	break;
     }
     
     return 0;
@@ -114,7 +116,7 @@
         int nOverflow = 0;
         {
             // decode
-            int nRangeTotal = RangeDecodeFast(RANGE_OVERFLOW_SHIFT);
+            unsigned int nRangeTotal = RangeDecodeFast(RANGE_OVERFLOW_SHIFT);
             
             // lookup the symbol (must be a faster way than this)
             while (nRangeTotal >= RANGE_TOTAL_2[nOverflow + 1]) { nOverflow++; }
@@ -135,7 +137,7 @@
         // get the value
         int nBase = 0;
         {
-            int nShift = 0;
+           // int nShift = 0;
             if (nPivotValue >= (1 << 16))
             {
                 int nPivotValueBits = 0;
@@ -194,7 +196,7 @@
     else
     {
         // decode
-        int nRangeTotal = RangeDecodeFast(RANGE_OVERFLOW_SHIFT);
+        unsigned int nRangeTotal = RangeDecodeFast(RANGE_OVERFLOW_SHIFT);
         
         // lookup the symbol (must be a faster way than this)
         int nOverflow = 0;
Binary files Source.orig/MACLib/UnBitArray.o and Source/MACLib/UnBitArray.o differ
Binary files Source.orig/MACLib/UnBitArrayBase.o and Source/MACLib/UnBitArrayBase.o differ
Binary files Source.orig/MACLib/WAVInputSource.o and Source/MACLib/WAVInputSource.o differ
diff -uNr Source.orig/MACLib/md5.h Source/MACLib/md5.h
--- Source.orig/MACLib/md5.h	Wed May  5 22:34:00 2004
+++ Source/MACLib/md5.h	Thu Jan  1 01:00:00 1970
@@ -1,79 +0,0 @@
-/*
- *  Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.
- *  
- *  License to copy and use this software is granted provided that it is identified 
- *  as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material 
- *  mentioning or referencing this software or this function.
- *
- *  License is also granted to make and use derivative works provided that such 
- *  works are identified as "derived from the RSA Data Security, Inc. MD5 Message-
- *  Digest Algorithm" in all material mentioning or referencing the derived work.
- *  
- *  RSA Data Security, Inc. makes no representations concerning either the 
- *  merchantability of this software or the suitability of this software for any 
- *  particular purpose. It is provided "as is" without express or implied warranty 
- *  of any kind. These notices must be retained in any copies of any part of this
- *  documentation and/or software.
- */
-
-#ifndef MD5SUM_MD5_H
-#define MD5SUM_MD5_H
-
-typedef unsigned int uint32_t;
-typedef unsigned char uint8_t;
-
-/*
- *  Define the MD5 context structure
- *  Please DO NOT change the order or contents of the structure as various assembler files depend on it !!
- */
- 
-typedef struct {
-   uint32_t  state  [ 4];     /* state (ABCD) */
-   uint32_t  count  [ 2];     /* number of bits, modulo 2^64 (least sig word first) */
-   uint8_t   buffer [64];     /* input buffer for incomplete buffer data */
-} MD5_CTX;
-
-void   MD5Init   ( MD5_CTX* ctx );
-void   MD5Update ( MD5_CTX* ctx, const uint8_t* buf, size_t len );
-void   MD5Final  ( uint8_t digest [16], MD5_CTX* ctx );
-
-class CMD5Helper
-{
-public:
-
-    CMD5Helper(BOOL bInitialize = TRUE)
-    {
-        if (bInitialize)
-            Initialize();
-    }
-
-    BOOL Initialize()
-    {
-        memset(&m_MD5Context, 0, sizeof(m_MD5Context));
-        MD5Init(&m_MD5Context);
-        m_nTotalBytes = 0;
-        return TRUE;
-    }
-
-    inline void AddData(const void * pData, int nBytes)
-    {
-        MD5Update(&m_MD5Context, (const unsigned char *) pData, nBytes);
-        m_nTotalBytes += nBytes;
-    }
-
-    BOOL GetResult(unsigned char cResult[16])
-    {
-        memset(cResult, 0, 16);
-        MD5Final(cResult, &m_MD5Context);
-        return TRUE;
-    }
-
-protected:
-
-    MD5_CTX m_MD5Context;
-    BOOL m_bStopped;
-    int m_nTotalBytes;
-};
-
-
-#endif /* MD5SUM_MD5_H */
diff -uNr Source.orig/Makefile Source/Makefile
--- Source.orig/Makefile	Tue Apr 23 13:52:00 2002
+++ Source/Makefile	Sun May 30 01:42:51 2004
@@ -6,42 +6,58 @@
 
 TARGET   = mac
 INCLUDES = -IShared -IMACLib -IConsole
-CPPOPT   = -s -O3 -Wall -pedantic -D__GNUC_IA32__
-COMPILER = gcc
+CPPOPT   = -s -O3 -Wall -D__GNUC_IA32__ -D__BYTE_ORDER=__LITTLE_ENDIAN
+COMPILER = g++
 
-SOURCEFILES = \
-Console/Console.cpp		\
-MACLib/APECompress.cpp		\
-MACLib/APECompressCore.cpp	\
-MACLib/APECompressCreate.cpp	\
-MACLib/APEDecompress.cpp	\
-MACLib/APEInfo.cpp		\
-MACLib/APELink.cpp		\
-MACLib/APESimple.cpp		\
-MACLib/APETag.cpp		\
-MACLib/BitArray.cpp		\
-MACLib/MACLib.cpp		\
-MACLib/MACProgressHelper.cpp	\
-MACLib/NNFilter.cpp		\
-MACLib/NewPredictor.cpp		\
-MACLib/Prepare.cpp		\
-MACLib/UnBitArray.cpp		\
-MACLib/UnBitArrayBase.cpp	\
-MACLib/WAVInputSource.cpp	\
-Shared/GlobalFunctions.cpp	\
-Shared/StdLibFileIO.cpp		\
-Shared/WinFileIO.cpp		\
-MACLib/NNFilterAsm.o
+OBJECTS = \
+Console/Console.o		\
+MACLib/APECompress.o		\
+MACLib/APECompressCore.o	\
+MACLib/APECompressCreate.o	\
+MACLib/APEDecompress.o	\
+MACLib/APEInfo.o		\
+MACLib/APELink.o		\
+MACLib/APESimple.o		\
+MACLib/APETag.o		\
+MACLib/BitArray.o		\
+MACLib/MACLib.o		\
+MACLib/MACProgressHelper.o	\
+MACLib/NNFilter.o		\
+MACLib/NewPredictor.o		\
+MACLib/Prepare.o		\
+MACLib/UnBitArray.o		\
+MACLib/UnBitArrayBase.o	\
+MACLib/WAVInputSource.o	\
+Shared/GlobalFunctions.o	\
+Shared/StdLibFileIO.o		\
+Shared/WinFileIO.o		\
+Shared/CharacterHelper.o	\
+Shared/CircleBuffer.o		\
+MACLib/Assembly/Assembly.o	\
+MACLib/APEHeader.o		\
+MACLib/MD5.o			\
+MACLib/Old/APEDecompressOld.o	\
+MACLib/Old/UnBitArrayOld.o	\
+MACLib/Old/UnMAC.o		\
+MACLib/Old/APEDecompressCore.o	\
+MACLib/Old/Anti-Predictor.o	\
+MACLib/Old/AntiPredictorFast.o	\
+MACLib/Old/AntiPredictorNormal.o	\
+MACLib/Old/AntiPredictorHigh.o	\
+MACLib/Old/AntiPredictorExtraHigh.o	\
 
 
 
-$(TARGET): $(SOURCEFILES)
-	$(COMPILER) -static $(CPPOPT) $(INCLUDES) -o $(TARGET)-static $(SOURCEFILES)
-	$(COMPILER)         $(CPPOPT) $(INCLUDES) -o $(TARGET)        $(SOURCEFILES)
-
-MACLib/NNFilterAsm.o : MACLib/NNFilterAsm.nas
-	nasm -f elf -o MACLib/NNFilterAsm.o MACLib/NNFilterAsm.nas -l MACLib/NNFilterAsm.lst
-
+%.o:	%.cpp
+	$(COMPILER) $(CPPOPT) $(INCLUDES) -o $@ -c $<
+
+$(TARGET): $(OBJECTS)
+#	$(COMPILER) -static $(CPPOPT) $(INCLUDES) -o $(TARGET)-static $(OBJECTS)
+	$(COMPILER)         $(CPPOPT) $(INCLUDES) -o $(TARGET)        $(OBJECTS)
+
+MACLib/Assembly/Assembly.o: MACLib/Assembly/Assembly.nas
+	cd MACLib/Assembly; nasm -f elf -o Assembly.o Assembly.nas -l Assembly.lst
+ 
 APE_Source.tar.bz2:
 	@sh ./MakeSourceBall
 
diff -uNr Source.orig/Shared/All.h Source/Shared/All.h
--- Source.orig/Shared/All.h	Mon May 10 21:38:00 2004
+++ Source/Shared/All.h	Sun May 30 00:31:24 2004
@@ -4,7 +4,7 @@
 /*****************************************************************************************
 Cross platform building switch
 *****************************************************************************************/
-//#define BUILD_CROSS_PLATFORM
+#define BUILD_CROSS_PLATFORM
 
 /*****************************************************************************************
 Unicode
@@ -232,4 +232,4 @@
     { ERROR_APE_COMPRESS_TOO_MUCH_DATA            , "APE compress too much data" },             \
     { ERROR_UNDEFINED                             , "undefined" },                              \
 
-#endif // #ifndef APE_ALL_H
\ No newline at end of file
+#endif // #ifndef APE_ALL_H
diff -uNr Source.orig/Shared/CharacterHelper.cpp Source/Shared/CharacterHelper.cpp
--- Source.orig/Shared/CharacterHelper.cpp	Wed May  5 23:15:00 2004
+++ Source/Shared/CharacterHelper.cpp	Sun May 30 01:11:01 2004
@@ -103,7 +103,8 @@
     // get the size(s)
     int nCharacters = wcslen(pUTF16);
     int nUTF8Bytes = 0;
-    for (int z = 0; z < nCharacters; z++)
+    int z;
+    for (z = 0; z < nCharacters; z++)
     {
         if (pUTF16[z] < 0x0080)
             nUTF8Bytes += 1;
@@ -140,4 +141,5 @@
 
     // return the UTF-8 string
     return pUTF8;
-}
\ No newline at end of file
+}
+
diff -uNr Source.orig/Shared/CharacterHelper.h Source/Shared/CharacterHelper.h
--- Source.orig/Shared/CharacterHelper.h	Wed May  5 22:05:00 2004
+++ Source/Shared/CharacterHelper.h	Sun May 30 00:32:16 2004
@@ -12,4 +12,5 @@
 str_utf8 * GetUTF8FromANSI(const str_ansi * pANSI);
 str_utf8 * GetUTF8FromUTF16(const str_utf16 * pUTF16);
 
-#endif // #ifndef CHARACTER_HELPER_H
\ No newline at end of file
+#endif // #ifndef CHARACTER_HELPER_H
+
Binary files Source.orig/Shared/CharacterHelper.o and Source/Shared/CharacterHelper.o differ
Binary files Source.orig/Shared/CircleBuffer.o and Source/Shared/CircleBuffer.o differ
diff -uNr Source.orig/Shared/GlobalFunctions.cpp Source/Shared/GlobalFunctions.cpp
--- Source.orig/Shared/GlobalFunctions.cpp	Wed May  5 22:34:00 2004
+++ Source/Shared/GlobalFunctions.cpp	Sun May 30 00:54:40 2004
@@ -1,5 +1,6 @@
 #include "All.h"
 #include "GlobalFunctions.h"
+#include "CharacterHelper.h"
 #include "IO.h"
 
 /*
@@ -97,4 +98,4 @@
     return TRUE;
 
 #endif
-}
\ No newline at end of file
+}
Binary files Source.orig/Shared/GlobalFunctions.o and Source/Shared/GlobalFunctions.o differ
diff -uNr Source.orig/Shared/NoWindows.h Source/Shared/NoWindows.h
--- Source.orig/Shared/NoWindows.h	Wed May  5 22:34:00 2004
+++ Source/Shared/NoWindows.h	Sun May 30 01:07:58 2004
@@ -3,6 +3,9 @@
 #ifndef APE_NOWINDOWS_H
 #define APE_NOWINDOWS_H
 
+#include <wchar.h>
+#include <stdlib.h>
+
 #define FALSE    0
 #define TRUE    1
 
@@ -31,6 +34,21 @@
 typedef const char *        LPCSTR;
 typedef char *                LPSTR;
 typedef long                LRESULT;
+typedef const wchar_t *     LPCTSTR;
+typedef const wchar_t *     LPCWSTR;
+
+inline const char *wc2c(const wchar_t *w)
+{
+	static char buf[1024];
+	if (wcstombs(buf, w, sizeof(buf) - 1) < 1)
+		return NULL;
+	return buf;
+}
+
+#define wcsicmp wcscasecmp
+#define wcsnicmp wcsncasecmp
+#define _wcsicmp wcscasecmp
+#define _wtoi(x) wcstol(x,NULL,0)
 
 #define ZeroMemory(POINTER, BYTES) memset(POINTER, 0, BYTES);
 #define max(a,b)    (((a) > (b)) ? (a) : (b))
diff -uNr Source.orig/Shared/SmartPtr.h Source/Shared/SmartPtr.h
--- Source.orig/Shared/SmartPtr.h	Wed May  5 22:34:00 2004
+++ Source/Shared/SmartPtr.h	Sun May 30 00:31:34 2004
@@ -84,6 +84,6 @@
 
 #ifdef _MSC_VER
     #pragma warning(pop)
-#endif _MSC_VER
+#endif
 
 #endif // #ifndef APE_SMARTPTR_H
diff -uNr Source.orig/Shared/StdLibFileIO.cpp Source/Shared/StdLibFileIO.cpp
--- Source.orig/Shared/StdLibFileIO.cpp	Wed May  5 22:34:00 2004
+++ Source/Shared/StdLibFileIO.cpp	Sun May 30 01:07:47 2004
@@ -123,26 +123,26 @@
 
     m_bReadOnly = FALSE;
 
-    if (0 == strcmp(pName, "-") || 0 == strcmp(pName, "/dev/stdin")) 
+    if (0 == wcscmp(pName, L"-") || 0 == wcscmp(pName, L"/dev/stdin")) 
     {
         m_pFile = SETBINARY_IN(stdin);
         m_bReadOnly = TRUE;                                                     // ReadOnly
     }
-    else if (0 == strcmp (pName, "/dev/stdout")) 
+    else if (0 == wcscmp (pName, L"/dev/stdout")) 
     {
         m_pFile = SETBINARY_OUT(stdout);
         m_bReadOnly = FALSE;                                                    // WriteOnly
     }
     else 
     {
-        m_pFile = fopen(pName, "rb");
+        m_pFile = fopen(wc2c(pName), "rb");
         m_bReadOnly = FALSE;                                                    // Read/Write
     }
 
     if (!m_pFile)
         return -1;
 
-    strcpy(m_cFileName, pName);
+    wcscpy(m_cFileName, pName);
 
     return 0;
 }
@@ -201,9 +201,9 @@
     return nLength;
 }
 
-int CStdLibFileIO::GetName(char * pBuffer)
+int CStdLibFileIO::GetName(wchar_t * pBuffer)
 {
-    strcpy(pBuffer, m_cFileName);
+    wcscpy(pBuffer, m_cFileName);
     return 0;
 }
 
@@ -211,21 +211,21 @@
 {
     Close();
 
-    if (0 == strcmp (pName, "-") || 0 == strcmp (pName, "/dev/stdout")) 
+    if (0 == wcscmp (pName, L"-") || 0 == wcscmp (pName, L"/dev/stdout")) 
     {
         m_pFile = SETBINARY_OUT(stdout);
         m_bReadOnly = FALSE;                            // WriteOnly
     }
     else 
     {
-        m_pFile = fopen (pName, "wb");                  // Read/Write
+        m_pFile = fopen (wc2c(pName), "wb");                  // Read/Write
         m_bReadOnly = FALSE;
     }
 
     if (!m_pFile)
         return -1;
 
-    strcpy (m_cFileName, pName);
+    wcscpy (m_cFileName, pName);
 
     return 0;
 }
@@ -233,7 +233,7 @@
 int CStdLibFileIO::Delete()
 {
     Close();
-    return unlink (m_cFileName);    // 0 success, -1 error
+    return unlink (wc2c(m_cFileName));    // 0 success, -1 error
 }
 
 #endif // #ifdef IO_USE_STD_LIB_FILE_IO
diff -uNr Source.orig/Shared/StdLibFileIO.h Source/Shared/StdLibFileIO.h
--- Source.orig/Shared/StdLibFileIO.h	Wed May  5 22:34:00 2004
+++ Source/Shared/StdLibFileIO.h	Sun May 30 01:01:35 2004
@@ -28,18 +28,18 @@
     int SetEOF();
 
     // creation / destruction
-    int Create(const char * pName);
+    int Create(const wchar_t * pName);
     int Delete();
 
     // attributes
     int GetPosition();
     int GetSize();
-    int GetName(char * pBuffer);
+    int GetName(wchar_t * pBuffer);
     int GetHandle();
 
 private:
     
-    char m_cFileName[MAX_PATH];
+    wchar_t m_cFileName[MAX_PATH];
     BOOL m_bReadOnly;
     FILE * m_pFile;
 };
Binary files Source.orig/Shared/StdLibFileIO.o and Source/Shared/StdLibFileIO.o differ
Binary files Source.orig/Shared/WinFileIO.o and Source/Shared/WinFileIO.o differ
Binary files Source.orig/mac and Source/mac differ
