Fixed some "shadowed variables", as pointed out by John Smith.
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 23 Jun 2008 20:06:20 +0000 (20:06 +0000)
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 23 Jun 2008 20:06:20 +0000 (20:06 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25539 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/k12.c
wiretap/mpeg.c

index a14feb665d6dd0cf095700ad94fb69a3062c6125..91d1b9552d2e7e1b0b0c6bdd44374123bc05995e 100644 (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) {
index 8ec9e65fbefc4827371751b7cad26dc8a6a0ab9c..fd0c7f8fe2766138cedf2eed62b54d273a7a7be6 100644 (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);