gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r10593: don't let eof let us assume


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10593: don't let eof let us assume there is no data to parse.
Date: Wed, 18 Feb 2009 18:01:32 -0700
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10593
committer: address@hidden
branch nick: trunk
timestamp: Wed 2009-02-18 18:01:32 -0700
message:
  don't let eof let us assume there is no data to parse.
modified:
  utilities/flvdumper.cpp
    ------------------------------------------------------------
    revno: 10592.1.1
    committer: address@hidden
    branch nick: release_0_8_5
    timestamp: Wed 2009-02-18 17:57:44 -0700
    message:
      don't let eof let us assume there is no data to parse.
    modified:
      utilities/flvdumper.cpp
=== modified file 'utilities/flvdumper.cpp'
--- a/utilities/flvdumper.cpp   2009-02-17 03:18:15 +0000
+++ b/utilities/flvdumper.cpp   2009-02-19 00:57:44 +0000
@@ -212,14 +212,21 @@
            }
             // Extract all the Tags
             size_t total = st.st_size - sizeof(Flv::flv_header_t);
-             while (total) {
+             while (!ifs.eof()) {
                 ifs.read(reinterpret_cast<char *>(&previous), 
sizeof(Flv::previous_size_t));
+                if (ifs.gcount() != sizeof(Flv::previous_size_t)) {
+                    log_error("Couldn't read the entire header");
+                }
+                
                 previous = ntohl(previous);
                 total -= sizeof(Flv::previous_size_t);
                 if (all) {   
                     cout << "FLV Previous Tag Size was: " << previous << endl;
                 }
                 ifs.read(reinterpret_cast<char *>(buf->reference()), 
sizeof(Flv::flv_tag_t));
+                if (ifs.gcount() != sizeof(Flv::flv_tag_t)) {
+                    log_error("Couldn't read the entire tag");
+                }
                 tag  = flv.decodeTagHeader(buf);
                 flv.dump();
                 total -= sizeof(Flv::previous_size_t);
@@ -234,11 +241,9 @@
                 }
                 buf->resize(bodysize);
                 ifs.read(reinterpret_cast<char *>(buf->reference()), bodysize);
-                // Got to the end of the file
-                if (ifs.eof()) {
-                    cerr << "end of file" << endl;
-                    break;
-                }
+//              if (ifs.gcount() != bodysize) {
+//                  log_error("Couldn't read the entire body");
+//              }
                 total -= bodysize;
                 switch (tag->type) {
                   case Flv::TAG_AUDIO:


reply via email to

[Prev in Thread] Current Thread [Next in Thread]