Index: /libmpc/branches/r2d/include/mpcdec/mpcdec.h
===================================================================
--- /libmpc/branches/r2d/include/mpcdec/mpcdec.h	(revision 150)
+++ /libmpc/branches/r2d/include/mpcdec/mpcdec.h	(revision 151)
@@ -106,5 +106,5 @@
 void mpc_demux_get_info(mpc_demux * d, mpc_streaminfo * i);
 // seek
-mpc_status mpc_demux_seek_sample(mpc_demux * d, mpc_int64_t destsample);
+mpc_status mpc_demux_seek_sample(mpc_demux * d, mpc_uint64_t destsample);
 mpc_status mpc_demux_seek_second(mpc_demux * d, double seconds);
 
Index: /libmpc/branches/r2d/libmpcdec/decoder.h
===================================================================
--- /libmpc/branches/r2d/libmpcdec/decoder.h	(revision 150)
+++ /libmpc/branches/r2d/libmpcdec/decoder.h	(revision 151)
@@ -65,5 +65,5 @@
     //@{
 	mpc_uint32_t stream_version;     ///< Streamversion of stream
-	mpc_uint32_t max_band;           ///< Maximum band-index used in stream (0...31)
+	mpc_int32_t max_band;           ///< Maximum band-index used in stream (0...31)
 	mpc_uint32_t ms;                 ///< Mid/side stereo (0: off, 1: on)
 	mpc_uint32_t channels;           ///< Number of channels in stream
Index: /libmpc/branches/r2d/libmpcdec/mpc_decoder.c
===================================================================
--- /libmpc/branches/r2d/libmpcdec/mpc_decoder.c	(revision 150)
+++ /libmpc/branches/r2d/libmpcdec/mpc_decoder.c	(revision 151)
@@ -158,6 +158,6 @@
 
 	samples_left = d->samples - d->decoded_samples + MPC_DECODER_SYNTH_DELAY;
-	i->samples = samples_left > MPC_FRAME_LENGTH ? MPC_FRAME_LENGTH : samples_left < 0 ? 0 : samples_left;
-	i->bits = ((r->buff - r_sav.buff) << 3) + r_sav.count - r->count;
+	i->samples = samples_left > MPC_FRAME_LENGTH ? MPC_FRAME_LENGTH : samples_left < 0 ? 0 : (mpc_uint32_t) samples_left;
+	i->bits = (mpc_uint32_t) (((r->buff - r_sav.buff) << 3) + r_sav.count - r->count);
 
 	if (d->samples_to_skip) {
Index: /libmpc/branches/r2d/libmpcdec/mpc_demux.c
===================================================================
--- /libmpc/branches/r2d/libmpcdec/mpc_demux.c	(revision 150)
+++ /libmpc/branches/r2d/libmpcdec/mpc_demux.c	(revision 151)
@@ -33,4 +33,5 @@
 */
 
+#include <string.h>
 #include <mpcdec/streaminfo.h>
 #include <mpcdec/mpcdec.h>
@@ -114,7 +115,7 @@
  */
 static void
-mpc_demux_seek(mpc_demux * d, mpc_uint32_t fpos, mpc_uint32_t min_bytes) {
+mpc_demux_seek(mpc_demux * d, mpc_size_t fpos, mpc_uint32_t min_bytes) {
 // 	mpc_uint32_t cur_pos = d->r->tell(d->r);
-	mpc_uint32_t next_pos;
+	mpc_size_t next_pos;
 	mpc_int_t bit_offset;
 
@@ -123,9 +124,9 @@
 	next_pos = fpos >> 3;
 	if (d->si.stream_version == 7)
-		next_pos &= (-1u << 2);
-	bit_offset = fpos - (next_pos << 3);
+		next_pos &= (-1 << 2);
+	bit_offset = (int) (fpos - (next_pos << 3));
 	next_pos += d->si.header_position; // add id3 offset
 
-	d->r->seek(d->r, next_pos);
+	d->r->seek(d->r, (mpc_int32_t) next_pos);
 	mpc_demux_clear_buff(d);
 	if (d->si.stream_version == 7)
@@ -155,8 +156,8 @@
 	if (d->si.block_pwr > d->seek_pwr)
 		d->seek_pwr = d->si.block_pwr;
-	d->seek_table = malloc((1 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr)) * sizeof(mpc_uint32_t));
+	d->seek_table = malloc((size_t)(1 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr)) * sizeof(mpc_uint32_t));
 	if (d->seek_table == 0)
 		return MPC_STATUS_FILE;
-	d->seek_table[0] = mpc_demux_pos(d);
+	d->seek_table[0] = (mpc_uint32_t)mpc_demux_pos(d);
 	d->seek_table_size = 1;
 
@@ -175,11 +176,11 @@
 
 	mpc_bits_get_size(&r, &tmp);
-	d->seek_table_size = tmp;
+	d->seek_table_size = (mpc_uint32_t) tmp;
 	d->seek_pwr = d->si.block_pwr + mpc_bits_read(&r, 4);
-	d->seek_table = malloc((1 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr)) * sizeof(mpc_uint32_t));
+	d->seek_table = malloc((size_t)(1 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr)) * sizeof(mpc_uint32_t));
 
 	table = d->seek_table;
 	mpc_bits_get_size(&r, &tmp);
-	table[0] = (tmp + d->si.header_position) * 8;
+	table[0] = (mpc_uint32_t) (tmp + d->si.header_position) * 8;
 
 	if (d->seek_table_size == 1)
@@ -187,10 +188,10 @@
 
 	mpc_bits_get_size(&r, &tmp);
-	table[1] = (tmp + d->si.header_position) * 8;
+	table[1] = (mpc_uint32_t) (tmp + d->si.header_position) * 8;
 
 	for (i = 2; i < d->seek_table_size; i++) {
 		int code = mpc_bits_golomb_dec(&r, 12);
 		if (code & 1)
-			code = -(code & (-1u << 1));
+			code = -(code & (-1 << 1));
 		code <<= 2;
 		table[i] = code + 2 * table[i-1] - table[i-2];
@@ -209,5 +210,5 @@
 	mpc_bits_get_block(&d->bits_reader, &b);
 	if (memcmp(b.key, "ST", 2) == 0) {
-		mpc_demux_fill(d, b.size, 0);
+		mpc_demux_fill(d, (mpc_uint32_t) b.size, 0);
 		mpc_demux_ST(d);
 	}
@@ -253,12 +254,12 @@
 		size = mpc_bits_get_block(&d->bits_reader, &b);
 		while( memcmp(b.key, "AD", 2) != 0 ){ // scan all blocks until audio
-			mpc_demux_fill(d, 11 + b.size, 0);
+			mpc_demux_fill(d, 11 + (mpc_uint32_t) b.size, 0);
 			if (memcmp(b.key, "SI", 2) == 0){
-				int ret = streaminfo_read_header_sv8(&d->si, &d->bits_reader, b.size);
+				int ret = streaminfo_read_header_sv8(&d->si, &d->bits_reader, (mpc_uint32_t) b.size);
 				if (ret != MPC_STATUS_OK) return ret;
 			} else if (memcmp(b.key, "EI", 2) == 0)
 				streaminfo_encoder_info(&d->si, &d->bits_reader);
 			else if (memcmp(b.key, "SP", 2) == 0)
-				mpc_demux_SP(d, size, b.size);
+				mpc_demux_SP(d, size, (mpc_uint32_t) b.size);
 			else if (memcmp(b.key, "ST", 2) == 0)
 				mpc_demux_ST(d);
@@ -315,5 +316,5 @@
 			d->bits_reader.count &= -8;
 			if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) {
-				d->seek_table[d->seek_table_size] = mpc_demux_pos(d);
+				d->seek_table[d->seek_table_size] = (mpc_uint32_t) mpc_demux_pos(d);
 				d->seek_table_size ++;
 			}
@@ -325,9 +326,9 @@
 					break;
 				}
-				mpc_demux_fill(d, 11 + b.size, 0);
+				mpc_demux_fill(d, 11 + (mpc_uint32_t) b.size, 0);
 				d->bits_reader.buff += b.size;
 				mpc_bits_get_block(&d->bits_reader, &b);
 			}
-			d->block_bits = b.size * 8;
+			d->block_bits = (mpc_uint32_t) b.size * 8;
 		}
 		// FIXME : this is not good if block size > buffer size
@@ -337,9 +338,9 @@
 		d->block_bits -= ((d->bits_reader.buff - r.buff) << 3) + r.count - d->bits_reader.count;
 	} else {
+		mpc_bits_reader r;
 		if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) {
-			d->seek_table[d->seek_table_size] = mpc_demux_pos(d);
+			d->seek_table[d->seek_table_size] = (mpc_uint32_t) mpc_demux_pos(d);
 			d->seek_table_size ++;
 		}
-		mpc_bits_reader r;
 		mpc_demux_fill(d, MAX_FRAME_SIZE, MPC_BUFFER_FULL | MPC_BUFFER_SWAP);
 		mpc_bits_read(&d->bits_reader, 20); // read frame size
@@ -354,5 +355,5 @@
 }
 
-mpc_status mpc_demux_seek_sample(mpc_demux * d, mpc_int64_t destsample)
+mpc_status mpc_demux_seek_sample(mpc_demux * d, mpc_uint64_t destsample)
 {
 	mpc_uint32_t fwd, samples_to_skip, fpos, i;
@@ -388,5 +389,5 @@
 			if (memcmp(b.key, "AD", 2) == 0) {
 				if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) {
-					d->seek_table[d->seek_table_size] = mpc_demux_pos(d) - 8 * size;
+					d->seek_table[d->seek_table_size] = (mpc_uint32_t) mpc_demux_pos(d) - 8 * size;
 					d->seek_table_size ++;
 				}
@@ -394,5 +395,5 @@
 				i++;
 			}
-			fpos += (b.size + size) * 8;
+			fpos += ((mpc_uint32_t)b.size + size) * 8;
 			mpc_demux_seek(d, fpos, 11);
 			size = mpc_bits_get_block(&d->bits_reader, &b);
@@ -404,5 +405,5 @@
 		for( ; i < fwd; i++){
 			if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) {
-				d->seek_table[d->seek_table_size] = mpc_demux_pos(d);
+				d->seek_table[d->seek_table_size] = (mpc_uint32_t) mpc_demux_pos(d);
 				d->seek_table_size ++;
 			}
Index: /libmpc/branches/r2d/libmpcdec/streaminfo.c
===================================================================
--- /libmpc/branches/r2d/libmpcdec/streaminfo.c	(revision 150)
+++ /libmpc/branches/r2d/libmpcdec/streaminfo.c	(revision 151)
@@ -163,5 +163,5 @@
 
 	CRC = mpc_bits_read(&r, 32);
-	if (CRC != crc32(r.buff + 1 - (r.count >> 3), block_size - 4))
+	if (CRC != crc32(r.buff + 1 - (r.count >> 3), (int)block_size - 4))
 		return MPC_STATUS_FILE;
 
Index: /libmpc/branches/r2d/win32/libmpcdec.vcproj
===================================================================
--- /libmpc/branches/r2d/win32/libmpcdec.vcproj	(revision 150)
+++ /libmpc/branches/r2d/win32/libmpcdec.vcproj	(revision 151)
@@ -2,5 +2,5 @@
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="8,00"
+	Version="8.00"
 	Name="libmpcdec"
 	ProjectGUID="{4C5362CD-0BF2-4B3B-971B-8293EB1A1DC3}"
@@ -153,21 +153,21 @@
 			>
 			<File
-				RelativePath="..\src\decoder.h"
-				>
-			</File>
-			<File
-				RelativePath="..\src\huffman.h"
-				>
-			</File>
-			<File
-				RelativePath="..\src\internal.h"
-				>
-			</File>
-			<File
-				RelativePath="..\src\math.h"
-				>
-			</File>
-			<File
-				RelativePath="..\src\requant.h"
+				RelativePath="..\libmpcdec\decoder.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\huffman.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\internal.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\math.h"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\requant.h"
 				>
 			</File>
@@ -177,25 +177,33 @@
 			>
 			<File
-				RelativePath="..\src\huffman.c"
-				>
-			</File>
-			<File
-				RelativePath="..\src\mpc_decoder.c"
-				>
-			</File>
-			<File
-				RelativePath="..\src\mpc_reader.c"
-				>
-			</File>
-			<File
-				RelativePath="..\src\requant.c"
-				>
-			</File>
-			<File
-				RelativePath="..\src\streaminfo.c"
-				>
-			</File>
-			<File
-				RelativePath="..\src\synth_filter.c"
+				RelativePath="..\common\crc32.c"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\huffman.c"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\mpc_decoder.c"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\mpc_demux.c"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\mpc_reader.c"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\requant.c"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\streaminfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\libmpcdec\synth_filter.c"
 				>
 			</File>
@@ -205,5 +213,5 @@
 			>
 			<File
-				RelativePath="..\include\mpcdec\mpc_types.h"
+				RelativePath="..\include\mpc\mpc_types.h"
 				>
 			</File>
