Index: libmpc/branches/r2d/mpcenc/mpcenc.c
===================================================================
--- libmpc/branches/r2d/mpcenc/mpcenc.c	(revision 194)
+++ libmpc/branches/r2d/mpcenc/mpcenc.c	(revision 195)
@@ -36,6 +36,6 @@
 int           APE_Version     = 2000;
 int           LowDelay        = 0;
-Bool_t        EnableTags      = MPC_FALSE;
-Bool_t        IsEndBeep       = MPC_FALSE;
+mpc_bool_t    EnableTags      = MPC_FALSE;
+mpc_bool_t    IsEndBeep       = MPC_FALSE;
 
 #define MODE_OVERWRITE          0
@@ -48,5 +48,5 @@
 unsigned int  verbose         = 0;      // more information during output
 unsigned int  NoUnicode       = 1;      // console is unicode or not (tag translation)
-UintMax_t     SamplesInWAVE   = 0;      // number of samples per channel in the WAV file
+mpc_uint64_t    SamplesInWAVE   = 0;      // number of samples per channel in the WAV file
 float         MaxOverFlow     = 0.f;    // maximum overflow
 float         ScalingFactorl  = 1.f;    // Scaling the input signal
@@ -57,6 +57,6 @@
 float         SkipTime        = 0.f;    // Skip the beginning of the file (sec)
 double        Duration        = 1.e+99; // Maximum encoded audio length
-Bool_t        FrontendPresent = 0;      // Flag for frontend-detection
-Bool_t        XLevel          = 1;      // Encode extreme levels with relative SCFs
+mpc_bool_t    FrontendPresent = 0;      // Flag for frontend-detection
+mpc_bool_t    XLevel          = 1;      // Encode extreme levels with relative SCFs
 
 #if MPPENC_MINOR % 2 == 0
@@ -115,5 +115,5 @@
 
     echo_off ();
-    ret = READ1 ( STDIN, buff );
+    ret = READ1 ( stdin, buff );
     echo_on ();
     return ret == 1  ?  buff[0]  :  -1;
@@ -430,5 +430,5 @@
     for ( n = 0; n < BLOCK; n++, N++ ) {
         idx           = n + CENTER;
-        fadeout_pos   = UintMAX_FP(SamplesInWAVE - N) * inv_fs;
+        fadeout_pos   = (long double)(SamplesInWAVE - N) * inv_fs;
         scale         = fadeout_pos / FadeOutTime;
         scale         = bump (scale);
@@ -1312,15 +1312,15 @@
 
 static const char*
-PrintTime ( PsyModel* m, UintMax_t samples, int sign )
+PrintTime ( PsyModel* m, mpc_uint64_t samples, int sign )
 {
     static char  ret [32];
-	Ulong        tmp  = (Ulong) ( UintMAX_FP(samples) * 100. / m->SampleFreq );
-    Uint         hour = (Uint)  ( tmp / 360000     );
-    Uint         min  = (Uint)  ( tmp / 6000 %  60 );
-    Uint         sec  = (Uint)  ( tmp / 100  %  60 );
-    Uint         csec = (Uint)  ( tmp        % 100 );
-
-
-	if ( UintMAX_FP(samples) >= m->SampleFreq * 360000. )
+	mpc_uint32_t tmp  = (mpc_uint32_t) ( (long double)(samples) * 100. / m->SampleFreq );
+    mpc_uint_t   hour = (mpc_uint_t)  ( tmp / 360000     );
+    mpc_uint_t   min  = (mpc_uint_t)  ( tmp / 6000 %  60 );
+    mpc_uint_t   sec  = (mpc_uint_t)  ( tmp / 100  %  60 );
+    mpc_uint_t   csec = (mpc_uint_t)  ( tmp        % 100 );
+
+
+	if ( (long double)(samples) >= m->SampleFreq * 360000. )
         return "            ";
     else if ( hour > 9 )
@@ -1340,7 +1340,7 @@
 static void
 ShowProgress ( PsyModel* m,
-			   UintMax_t  samples,
-               UintMax_t  total_samples,
-               UintMax_t  databits )
+			   mpc_uint64_t  samples,
+               mpc_uint64_t  total_samples,
+               mpc_uint64_t  databits )
 {
     static clock_t  start;
@@ -1363,11 +1363,11 @@
         return;
 
-    percent     = 100.f    * UintMAX_FP(samples) / UintMAX_FP(total_samples);
-	kbps        =   1.e-3f * UintMAX_FP(databits) * m->SampleFreq / UintMAX_FP(samples);
-	speed       =   1.f    * UintMAX_FP(samples) * (CLOCKS_PER_SEC / m->SampleFreq) / (unsigned long)(curr - start) ;
-    total_estim =   1.f    * UintMAX_FP(total_samples) / UintMAX_FP(samples) * (unsigned long)(curr - start);
+    percent     = 100.f    * (long double)(samples) / (long double)(total_samples);
+	kbps        =   1.e-3f * (long double)(databits) * m->SampleFreq / (long double)(samples);
+	speed       =   1.f    * (long double)(samples) * (CLOCKS_PER_SEC / m->SampleFreq) / (unsigned long)(curr - start) ;
+    total_estim =   1.f    * (long double)(total_samples) / (long double)(samples) * (unsigned long)(curr - start);
 
     // progress percent
-    if ( total_samples < IntMax_MAX )
+	if ( total_samples < mpc_int64_max )
         stderr_printf ("\r%5.1f ", percent );
     else
@@ -1521,5 +1521,5 @@
     SubbandQuantTyp  Q [32];                    // Subband samples after quantization
     wave_t           Wave;                      // contains WAV-files arguments
-    UintMax_t        AllSamplesRead   =    0;   // overall read Samples per channel
+    mpc_uint64_t        AllSamplesRead   =    0;   // overall read Samples per channel
     unsigned int     CurrentRead      =    0;   // current read Samples per channel
     unsigned int     N;                         // counter for processed frames
@@ -1595,5 +1595,5 @@
         return 1;
 
-    if ( UintMAX_FP(SamplesInWAVE) >= Wave.SampleFreq * (SkipTime + Duration) ) {
+    if ( (long double)(SamplesInWAVE) >= Wave.SampleFreq * (SkipTime + Duration) ) {
         SamplesInWAVE = Wave.SampleFreq * (SkipTime + Duration);
     }
@@ -1602,7 +1602,7 @@
 
     // check fade-length
-    if ( FadeInTime + FadeOutTime > UintMAX_FP(SamplesInWAVE) / Wave.SampleFreq ) {
+    if ( FadeInTime + FadeOutTime > (long double)(SamplesInWAVE) / Wave.SampleFreq ) {
         stderr_printf ( "WARNING: Duration of fade in + out exceeds file length!\n");
-        FadeInTime = FadeOutTime = 0.5 * UintMAX_FP(SamplesInWAVE) / Wave.SampleFreq;
+        FadeInTime = FadeOutTime = 0.5 * (long double)(SamplesInWAVE) / Wave.SampleFreq;
     }
 
@@ -1662,9 +1662,9 @@
     if ( myfeof (Wave.fp) ) {
         stderr_printf ( "WAVE file has incorrect header: header: %.3f s, contents: %.3f s    \n",
-						UintMAX_FP(AllSamplesRead) / m.SampleFreq, UintMAX_FP(SamplesInWAVE) / m.SampleFreq );
+						(long double)(AllSamplesRead) / m.SampleFreq, (long double)(SamplesInWAVE) / m.SampleFreq );
         SamplesInWAVE = AllSamplesRead;
     }
 
-    for ( N = 0; (UintMax_t)N * BLOCK < SamplesInWAVE + DECODER_DELAY; N++ ) {
+    for ( N = 0; (mpc_uint64_t)N * BLOCK < SamplesInWAVE + DECODER_DELAY; N++ ) {
 
         // setting residual data-fields to zero
@@ -1680,8 +1680,8 @@
         /*********************************************************************************/
         if ( FadeInTime  > 0. )
-            if ( FadeInTime  > UintMAX_FP(BLOCK         + (UintMax_t)N*BLOCK) / Wave.SampleFreq )
+            if ( FadeInTime  > (long double)(BLOCK         + (mpc_uint64_t)N*BLOCK) / Wave.SampleFreq )
                 Fading_In  ( &Main, N*BLOCK, Wave.SampleFreq );
         if ( FadeOutTime > 0. )
-            if ( FadeOutTime > UintMAX_FP(SamplesInWAVE - (UintMax_t)N*BLOCK) / Wave.SampleFreq )
+            if ( FadeOutTime > (long double)(SamplesInWAVE - (mpc_uint64_t)N*BLOCK) / Wave.SampleFreq )
                 Fading_Out ( &Main, N*BLOCK, Wave.SampleFreq );
 
@@ -1716,7 +1716,7 @@
         writeBitstream_SV8 ( &e, m.Max_Band, Q );                                                // write SV7-Bitstream
 
-        if ( (Int)(time (NULL) - T) >= 0 ) {                            // output
+        if ( (int)(time (NULL) - T) >= 0 ) {                            // output
             T += labs (DisplayUpdateTime);
-			ShowProgress (&m, (UintMax_t)(N+1) * BLOCK, SamplesInWAVE, e.outputBits );
+			ShowProgress (&m, (mpc_uint64_t)(N+1) * BLOCK, SamplesInWAVE, e.outputBits );
         }
 
@@ -1733,5 +1733,5 @@
         if ( myfeof (Wave.fp) ) {
             stderr_printf ( "WAVE file has incorrect header: header: %.3f s, contents: %.3f s    \n",
-							UintMAX_FP(AllSamplesRead) / m.SampleFreq, UintMAX_FP(SamplesInWAVE) / m.SampleFreq );
+							(long double)(AllSamplesRead) / m.SampleFreq, (long double)(SamplesInWAVE) / m.SampleFreq );
             SamplesInWAVE = AllSamplesRead;
         }
@@ -1769,12 +1769,8 @@
 
 /************ The main() function *****************************/
-int Cdecl
+int mpc_cdecl
 main ( int argc, char** argv )
 {
     int  ret;
-
-#if (defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO)  &&  (defined USE_REALTIME  ||  defined USE_NICE)
-    // DisableSUID ();
-#endif
 
 #ifdef _OS2
