Fixed some "shadowed variables", as pointed out by John Smith.

svn path=/trunk/; revision=25539
This commit is contained in:
Stig Bjørlykke 2008-06-23 20:06:20 +00:00
parent 926e31da26
commit cb91244d0b
2 changed files with 21 additions and 22 deletions

View File

@ -210,9 +210,9 @@ typedef struct _k12_src_desc_t {
static gint get_record(guint8** bufferp, FILE* fh, gint64 file_offset) {
static guint8* buffer = NULL;
static guint buffer_len = 0x2000 ;
guint read;
guint bytes_read;
guint last_read;
guint actual_len, left;
guint actual_len, left;
guint8 junk[0x14];
guint8* writep;
@ -231,12 +231,12 @@ static gint get_record(guint8** bufferp, FILE* fh, gint64 file_offset) {
if ( junky_offset == 0x2000 ) {
/* the length of the record is 0x10 bytes ahead from we are reading */
read = file_read(junk,1,0x14,fh);
bytes_read = file_read(junk,1,0x14,fh);
if (read == 2 && junk[0] == 0xff && junk[1] == 0xff) {
if (bytes_read == 2 && junk[0] == 0xff && junk[1] == 0xff) {
K12_DBG(1,("get_record: EOF"));
return 0;
} else if ( read < 0x14 ){
} else if ( bytes_read < 0x14 ){
K12_DBG(1,("get_record: SHORT READ"));
return -1;
}
@ -244,12 +244,12 @@ static gint get_record(guint8** bufferp, FILE* fh, gint64 file_offset) {
memcpy(buffer,&(junk[0x10]),4);
} else {
/* the length of the record is right where we are reading */
read = file_read(buffer,1, 0x4, fh);
bytes_read = file_read(buffer,1, 0x4, fh);
if (read == 2 && buffer[0] == 0xff && buffer[1] == 0xff) {
if (bytes_read == 2 && buffer[0] == 0xff && buffer[1] == 0xff) {
K12_DBG(1,("get_record: EOF"));
return 0;
} else if ( read != 0x4 ) {
} else if ( bytes_read != 0x4 ) {
K12_DBG(1,("get_record: SHORT READ"));
return -1;
}
@ -271,17 +271,17 @@ static gint get_record(guint8** bufferp, FILE* fh, gint64 file_offset) {
K12_DBG(6,("get_record: looping left=%d junky_offset=%" G_GINT64_MODIFIER "d",left,junky_offset));
if (junky_offset > left) {
read += last_read = file_read(writep,1, left, fh);
bytes_read += last_read = file_read(writep,1, left, fh);
if ( last_read != left ) {
K12_DBG(1,("get_record: SHORT READ"));
return -1;
} else {
K12_HEXDMP(5,file_offset, "GOT record", buffer, actual_len);
return read;
return bytes_read;
}
} else {
read += last_read = file_read(writep,1, junky_offset, fh);
bytes_read += last_read = file_read(writep,1, junky_offset, fh);
if ( last_read != junky_offset ) {
K12_DBG(1,("get_record: SHORT READ, read=%d expected=%d",last_read, junky_offset));
@ -290,7 +290,7 @@ static gint get_record(guint8** bufferp, FILE* fh, gint64 file_offset) {
writep += last_read;
read += last_read = file_read(junk,1, 0x10, fh);
bytes_read += last_read = file_read(junk,1, 0x10, fh);
if ( last_read != 0x10 ) {
K12_DBG(1,("get_record: SHORT READ"));
@ -304,7 +304,7 @@ static gint get_record(guint8** bufferp, FILE* fh, gint64 file_offset) {
} while(left);
K12_HEXDMP(5,file_offset, "GOT record", buffer, actual_len);
return read;
return bytes_read;
}
static gboolean k12_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset) {

View File

@ -53,15 +53,15 @@ mpeg_resync(wtap *wth, int *err, gchar **err_info _U_)
{
gint64 offset = file_tell(wth->fh);
size_t count = 0;
int sync = file_getc(wth->fh);
int byte = file_getc(wth->fh);
while (sync != EOF) {
if (sync == 0xff && count > 0) {
sync = file_getc(wth->fh);
if (sync != EOF && (sync & 0xe0) == 0xe0)
while (byte != EOF) {
if (byte == 0xff && count > 0) {
byte = file_getc(wth->fh);
if (byte != EOF && (byte & 0xe0) == 0xe0)
break;
} else
sync = file_getc(wth->fh);
byte = file_getc(wth->fh);
count++;
}
file_seek(wth->fh, offset, SEEK_SET, err);
@ -121,7 +121,6 @@ mpeg_read(wtap *wth, int *err, gchar **err_info _U_,
if (PES_VALID(n)) {
gint64 offset = file_tell(wth->fh);
guint8 stream;
int bytes_read;
if (offset == -1)
return -1;
@ -171,12 +170,12 @@ mpeg_read(wtap *wth, int *err, gchar **err_info _U_,
{
guint64 bytes = pack >> 16;
guint64 ts =
guint64 ts_val =
(bytes >> 43 & 0x0007) << 30 |
(bytes >> 27 & 0x7fff) << 15 |
(bytes >> 11 & 0x7fff) << 0;
unsigned ext = (unsigned)((bytes >> 1) & 0x1ff);
guint64 cr = 300 * ts + ext;
guint64 cr = 300 * ts_val + ext;
unsigned rem = (unsigned)(cr % SCRHZ);
wth->capture.mpeg->now.secs
= wth->capture.mpeg->t0 + (time_t)(cr / SCRHZ);