Index: mppenc/branches/r2d/libmpcenc/bitstream.c
===================================================================
--- mppenc/branches/r2d/libmpcenc/bitstream.c	(revision 67)
+++ mppenc/branches/r2d/libmpcenc/bitstream.c	(revision 71)
@@ -17,4 +17,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
+#include <unistd.h>
 
 #include "libmpcenc.h"
@@ -62,5 +64,7 @@
     mpc_size_t           WrittenDwords = 0;
     const mpc_uint32_t*  p             = buffer;
+#if ENDIAN == HAVE_BIG_ENDIAN
     mpc_size_t           CC            = words32bit;
+#endif
 
 #if ENDIAN == HAVE_BIG_ENDIAN
@@ -72,5 +76,7 @@
         WrittenDwords = fwrite ( p, sizeof(*buffer), words32bit, fp );
         if ( WrittenDwords == 0 ) {
-            stderr_printf ( "\b\n WARNING: Disk full?, retry after 10 sec ...\a" );
+			// FIXME : move stderr_printf to common
+//             stderr_printf ( "\b\n WARNING: Disk full?, retry after 10 sec ...\a" );
+			sprintf(stderr, "\b\n WARNING: Disk full?, retry after 10 sec ...\a");
             sleep (10);
         }
Index: mppenc/branches/r2d/libmpcenc/encode_sv7.c
===================================================================
--- mppenc/branches/r2d/libmpcenc/encode_sv7.c	(revision 67)
+++ mppenc/branches/r2d/libmpcenc/encode_sv7.c	(revision 71)
@@ -19,8 +19,10 @@
 
 #include <stdlib.h>
+#include <stdio.h>
 
 #include "libmpcenc.h"
 
 void  WriteBits         ( mpc_encoder_t*, const mpc_uint32_t input, const unsigned int bits );
+void       Init_Huffman_Encoder_SV7   ( void );
 
 // huffsv7.c
@@ -93,5 +95,5 @@
 		case 37800: WriteBits ( e, 2, 2 ); break;
 		case 32000: WriteBits ( e, 3, 2 ); break;
-        default   : stderr_printf ( "Internal error\n");
+		default   : sprintf(stderr, "Internal error\n");// FIXME : stderr_printf ( "Internal error\n");
                     exit (1);
     }
Index: mppenc/branches/r2d/libmpcenc/huffsv7.c
===================================================================
--- mppenc/branches/r2d/libmpcenc/huffsv7.c	(revision 67)
+++ mppenc/branches/r2d/libmpcenc/huffsv7.c	(revision 71)
@@ -332,4 +332,10 @@
 #endif
 
+
+// FIXME : remove the functions from tools.c
+void Make_HuffTable ( Huffman_t* dst, const HuffSrc_t* src, mpc_size_t len );
+void Resort_HuffTable ( Huffman_t* const Table, const mpc_size_t elements, mpc_int_t offset );
+void Make_LookupTable ( mpc_uint8_t* LUT, mpc_size_t LUT_len, const Huffman_t* const Table, const mpc_size_t elements );
+
 #define MAKE(d,s)     Make_HuffTable   ( (d), (s), sizeof(s)/sizeof(*(s)) )
 #define SORT(x,o)     Resort_HuffTable ( (x), sizeof(x)/sizeof(*(x)), -(Int)(o) )
Index: mppenc/branches/r2d/libmpcenc/libmpcenc.h
===================================================================
--- mppenc/branches/r2d/libmpcenc/libmpcenc.h	(revision 67)
+++ mppenc/branches/r2d/libmpcenc/libmpcenc.h	(revision 71)
@@ -56,11 +56,11 @@
 // just the same struct as below, dup ?
 typedef struct {
+	mpc_uint16_t	Code;  // >= 14 bit
 	mpc_uint16_t	Length;  // >=  4 bit
-	mpc_uint16_t	Code;  // >= 14 bit
 } HuffSrc_t ;
 
 typedef struct {
+	mpc_uint16_t	Code;        // >= 14 bit
 	mpc_uint16_t	Length;      // >=  4 bit
-	mpc_uint16_t	Code;        // >= 14 bit
 } Huffman_t ;
 
Index: mppenc/branches/r2d/libmpcenc/tools.c
===================================================================
--- mppenc/branches/r2d/libmpcenc/tools.c	(revision 67)
+++ mppenc/branches/r2d/libmpcenc/tools.c	(revision 71)
@@ -40,9 +40,9 @@
 #if defined HAVE_INCOMPLETE_READ  &&  FILEIO != 1
 
-size_t
-complete_read ( int fd, void* dest, size_t bytes )
-{
-    size_t  bytesread = 0;
-    size_t  ret;
+mpc_size_t
+complete_read ( int fd, void* dest, mpc_size_t bytes )
+{
+    mpc_size_t  bytesread = 0;
+    mpc_size_t  ret;
 
     while ( bytes > 0 ) {
@@ -52,5 +52,5 @@
         ret = read ( fd, dest, bytes );
 #endif
-        if ( ret == 0  ||  ret == (size_t)-1 )
+        if ( ret == 0  ||  ret == (mpc_size_t)-1 )
             break;
         dest       = (void*)(((char*)dest) + ret);
@@ -75,5 +75,5 @@
 
 static void
-Change_Endian32 ( mpc_uint32_t* dst, size_t words32bit )
+Change_Endian32 ( mpc_uint32_t* dst, mpc_size_t words32bit )
 {
 
@@ -107,8 +107,8 @@
  */
 
-size_t
-Read_LittleEndians ( FILE* fp, mpc_uint32_t* dst, size_t words32bit )
-{
-    size_t  wordsread;
+mpc_size_t
+Read_LittleEndians ( FILE* fp, mpc_uint32_t* dst, mpc_size_t words32bit )
+{
+    mpc_size_t  wordsread;
     wordsread = READ ( fp, dst, words32bit * sizeof(*dst) ) / sizeof(*dst);
 
@@ -195,7 +195,7 @@
 
 void
-Requantize_MidSideStereo ( Int Stop_Band, const Bool_t* used_MS )
-{
-    Int    Band;  // 0...Stop_Band
+Requantize_MidSideStereo ( mpc_int_t Stop_Band, const mpc_bool_t* used_MS )
+{
+    mpc_int_t    Band;  // 0...Stop_Band
     Uint   k;     // 0...35
     Float  ML;
@@ -412,7 +412,7 @@
 
 void
-Requantize_IntensityStereo ( Int Start_Band, Int Stop_Band )
-{
-    Int    Band;  // Start_Band...Stop_Band
+Requantize_IntensityStereo ( mpc_int_t Start_Band, mpc_int_t Stop_Band )
+{
+    mpc_int_t    Band;  // Start_Band...Stop_Band
     Uint   k;     // 0...35
     Float  ML;
@@ -479,7 +479,7 @@
 
 void
-Resort_HuffTable ( Huffman_t* const Table, const size_t elements, Int offset )
-{
-    size_t  i;
+Resort_HuffTable ( Huffman_t* const Table, const mpc_size_t elements, mpc_int_t offset )
+{
+    mpc_size_t  i;
 
     for ( i = 0; i < elements; i++ ) {
@@ -505,7 +505,7 @@
 
 void
-Make_HuffTable ( Huffman_t* dst, const HuffSrc_t* src, size_t len )
-{
-    size_t  i;
+Make_HuffTable ( Huffman_t* dst, const HuffSrc_t* src, mpc_size_t len )
+{
+    mpc_size_t  i;
 
     for ( i = 0; i < len; i++,src++,dst++ ) {
@@ -530,8 +530,8 @@
 
 void
-Make_LookupTable ( mpc_uint8_t* LUT, size_t LUT_len, const Huffman_t* const Table, const size_t elements )
-{
-    size_t    i;
-    size_t    idx  = elements;
+Make_LookupTable ( mpc_uint8_t* LUT, mpc_size_t LUT_len, const Huffman_t* const Table, const mpc_size_t elements )
+{
+    mpc_size_t    i;
+    mpc_size_t    idx  = elements;
     mpc_uint32_t  dval = (mpc_uint32_t)0x80000000L / LUT_len * 2;
     mpc_uint32_t  val  = dval - 1;
