Browse Source

*** empty log message ***

David Rose 25 years ago
parent
commit
35af988627

+ 1 - 0
pandatool/src/flt/config_flt.cxx

@@ -33,6 +33,7 @@
 #include <dconfig.h>
 
 Configure(config_flt);
+NotifyCategoryDef(flt, "");
 
 // Set this true to trigger an assertion failure (and core dump)
 // immediately when an error is detected on reading or writing a flt

+ 6 - 0
pandatool/src/flt/config_flt.h

@@ -6,6 +6,12 @@
 #ifndef CONFIG_FLT_H
 #define CONFIG_FLT_H
 
+#include <pandatoolbase.h>
+
+#include <notifyCategoryProxy.h>
+
+NotifyCategoryDecl(flt, EXPCL_MISC, EXPTP_MISC);
+
 extern const bool flt_error_abort;
 
 #endif

+ 2 - 4
pandatool/src/flt/fltRecord.cxx

@@ -509,10 +509,8 @@ read_record_and_children(FltRecordReader &reader) {
     }
 
     // Skip to the next record.  If that's the end, fine.
-    result = reader.advance();
-    if (result == FE_end_of_file) {
-      return FE_ok;
-    } else if (result != FE_ok) {
+    result = reader.advance(true);
+    if (reader.eof() || result != FE_ok) {
       return result;
     }
   }

+ 8 - 2
pandatool/src/flt/fltRecordReader.cxx

@@ -96,7 +96,7 @@ get_record_length() const {
 //               file has been reached.
 ////////////////////////////////////////////////////////////////////
 FltError FltRecordReader::
-advance() {
+advance(bool ok_eof) {
   if (_state == S_eof) {
     assert(!flt_error_abort);
     return FE_end_of_file;
@@ -118,6 +118,9 @@ advance() {
 
   if (_in.eof()) {
     _state = S_eof;
+    if (ok_eof) {
+      return FE_ok;
+    }
     assert(!flt_error_abort);
     return FE_end_of_file;
 
@@ -133,7 +136,10 @@ advance() {
   _opcode = (FltOpcode)dgi.get_be_int16();
   _record_length = dgi.get_be_uint16();
 
-  //  cerr << "Reading " << _opcode << " of length " << _record_length << "\n";
+  if (flt_cat.is_debug()) {
+    flt_cat.debug()
+      << "Reading " << _opcode << " of length " << _record_length << "\n";
+  }
 
   // And now read the full record based on the length.
   int length = _record_length - header_size;

+ 1 - 1
pandatool/src/flt/fltRecordReader.h

@@ -32,7 +32,7 @@ public:
   const Datagram &get_datagram();
   int get_record_length() const;
 
-  FltError advance();
+  FltError advance(bool ok_eof = false);
 
   bool eof() const;
   bool error() const;

+ 5 - 1
pandatool/src/flt/fltRecordWriter.cxx

@@ -76,7 +76,11 @@ update_datagram() {
 ////////////////////////////////////////////////////////////////////
 FltError FltRecordWriter::
 advance() {
-  //  cerr << "Writing " << _opcode << " of length " << _datagram.get_length() << "\n";
+  if (flt_cat.is_debug()) {
+    flt_cat.debug()
+      << "Writing " << _opcode << " of length "
+      << _datagram.get_length() << "\n";
+  }
 
   // Build a mini-datagram to write the header.
   static const int header_size = 4;