*** empty log message ***

This commit is contained in:
David Rose 2000-11-09 19:06:18 +00:00
parent 1ae907ef31
commit 35af988627
6 changed files with 23 additions and 8 deletions

View File

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

View File

@ -6,6 +6,12 @@
#ifndef CONFIG_FLT_H #ifndef CONFIG_FLT_H
#define 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; extern const bool flt_error_abort;
#endif #endif

View File

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

View File

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

View File

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

View File

@ -76,7 +76,11 @@ update_datagram() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
FltError FltRecordWriter:: FltError FltRecordWriter::
advance() { 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. // Build a mini-datagram to write the header.
static const int header_size = 4; static const int header_size = 4;