Index: libmpc/trunk/libmpcdec/mpc_demux.c
===================================================================
--- libmpc/trunk/libmpcdec/mpc_demux.c	(revision 358)
+++ libmpc/trunk/libmpcdec/mpc_demux.c	(revision 376)
@@ -115,7 +115,6 @@
  */
 static void
-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_size_t next_pos;
+mpc_demux_seek(mpc_demux * d, mpc_seek_t fpos, mpc_uint32_t min_bytes) {
+	mpc_seek_t next_pos;
 	mpc_int_t bit_offset;
 
@@ -142,7 +141,8 @@
  * @return current stream position in bits
  */
-mpc_size_t mpc_demux_pos(mpc_demux * d)
-{
-	return ((d->r->tell(d->r) - d->bytes_total + d->bits_reader.buff - d->buffer) << 3) + 8 - d->bits_reader.count;
+mpc_seek_t mpc_demux_pos(mpc_demux * d)
+{
+	return (((mpc_seek_t)(d->r->tell(d->r)) - d->bytes_total +
+	         d->bits_reader.buff - d->buffer) << 3) + 8 - d->bits_reader.count;
 }
 
@@ -208,8 +208,8 @@
 	if (d->si.block_pwr > d->seek_pwr)
 		d->seek_pwr = d->si.block_pwr;
-	d->seek_table = malloc((size_t)(2 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr)) * sizeof(mpc_uint32_t));
+	d->seek_table = malloc((size_t)(2 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr)) * sizeof(mpc_seek_t));
 	if (d->seek_table == 0)
 		return MPC_STATUS_FILE;
-	d->seek_table[0] = (mpc_uint32_t)mpc_demux_pos(d);
+	d->seek_table[0] = (mpc_seek_t)mpc_demux_pos(d);
 	d->seek_table_size = 1;
 
@@ -220,5 +220,5 @@
 {
 	mpc_uint64_t tmp;
-	mpc_uint32_t * table;
+	mpc_seek_t * table;
 	mpc_bits_reader r = d->bits_reader;
 	mpc_uint_t i;
@@ -228,13 +228,13 @@
 
 	mpc_bits_get_size(&r, &tmp);
-	d->seek_table_size = (mpc_uint32_t) tmp;
+	d->seek_table_size = (mpc_seek_t) tmp;
 	d->seek_pwr = d->si.block_pwr + mpc_bits_read(&r, 4);
 	tmp = 2 + d->si.samples / (MPC_FRAME_LENGTH << d->seek_pwr);
 	if (tmp < d->seek_table_size) tmp = d->seek_table_size;
-	d->seek_table = malloc((size_t)(tmp * sizeof(mpc_uint32_t)));
+	d->seek_table = malloc((size_t)(tmp * sizeof(mpc_seek_t)));
 
 	table = d->seek_table;
 	mpc_bits_get_size(&r, &tmp);
-	table[0] = (mpc_uint32_t) (tmp + d->si.header_position) * 8;
+	table[0] = (mpc_seek_t) (tmp + d->si.header_position) * 8;
 
 	if (d->seek_table_size == 1)
@@ -242,5 +242,5 @@
 
 	mpc_bits_get_size(&r, &tmp);
-	table[1] = (mpc_uint32_t) (tmp + d->si.header_position) * 8;
+	table[1] = (mpc_seek_t) (tmp + d->si.header_position) * 8;
 
 	for (i = 2; i < d->seek_table_size; i++) {
@@ -255,5 +255,5 @@
 static void mpc_demux_SP(mpc_demux * d, int size, int block_size)
 {
-	mpc_size_t cur;
+	mpc_seek_t cur;
 	mpc_uint64_t ptr;
 	mpc_block b;
@@ -376,5 +376,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_uint32_t) mpc_demux_pos(d);
+				d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d);
 				d->seek_table_size ++;
 			}
@@ -407,5 +407,5 @@
 	} else {
 		if (d->d->decoded_samples == (d->seek_table_size << d->seek_pwr) * MPC_FRAME_LENGTH) {
-			d->seek_table[d->seek_table_size] = (mpc_uint32_t) mpc_demux_pos(d);
+			d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d);
 			d->seek_table_size ++;
 		}
@@ -434,6 +434,7 @@
 mpc_status mpc_demux_seek_sample(mpc_demux * d, mpc_uint64_t destsample)
 {
-	mpc_uint32_t fwd, samples_to_skip, fpos, i;
+	mpc_uint32_t fwd, samples_to_skip, i;
 	mpc_uint32_t block_samples = MPC_FRAME_LENGTH << d->si.block_pwr;
+	mpc_seek_t fpos;
 
 	destsample += d->si.beg_silence;
@@ -467,5 +468,5 @@
 			if (memcmp(b.key, "AP", 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_uint32_t) mpc_demux_pos(d) - 8 * size;
+					d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d) - 8 * size;
 					d->seek_table_size ++;
 				}
@@ -483,5 +484,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_uint32_t) mpc_demux_pos(d);
+				d->seek_table[d->seek_table_size] = (mpc_seek_t) mpc_demux_pos(d);
 				d->seek_table_size ++;
 			}
