mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
*** empty log message ***
This commit is contained in:
parent
26d6e6c12a
commit
1ae907ef31
@ -286,13 +286,6 @@ prompt_user(const string &filename, CVSSourceDirectory *suggested_dir,
|
||||
if (result != (CVSSourceDirectory *)NULL) {
|
||||
return result;
|
||||
}
|
||||
|
||||
} else { // dirs.empty()
|
||||
nassertr(dirs.empty(), (CVSSourceDirectory *)NULL);
|
||||
// The file does not already exist.
|
||||
if (!interactive) {
|
||||
return suggested_dir;
|
||||
}
|
||||
}
|
||||
|
||||
// The file does not already exist, or the user declined to replace
|
||||
|
@ -34,6 +34,13 @@
|
||||
|
||||
Configure(config_flt);
|
||||
|
||||
// Set this true to trigger an assertion failure (and core dump)
|
||||
// immediately when an error is detected on reading or writing a flt
|
||||
// file. This is primarily useful for debugging the flt reader
|
||||
// itself, to generate a stack trace to determine precisely at what
|
||||
// point a flt file failed.
|
||||
const bool flt_error_abort = config_flt.GetBool("flt-error-abort", false);
|
||||
|
||||
ConfigureFn(config_flt) {
|
||||
FltRecord::init_type();
|
||||
FltBead::init_type();
|
||||
@ -61,3 +68,4 @@ ConfigureFn(config_flt) {
|
||||
FltTransformRotateScale::init_type();
|
||||
FltExternalReference::init_type();
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,6 @@
|
||||
#ifndef CONFIG_FLT_H
|
||||
#define CONFIG_FLT_H
|
||||
|
||||
// No configure variables.
|
||||
extern const bool flt_error_abort;
|
||||
|
||||
#endif
|
||||
|
@ -13,6 +13,9 @@
|
||||
#include "fltTransformScale.h"
|
||||
#include "fltTransformTranslate.h"
|
||||
#include "fltTransformRotateScale.h"
|
||||
#include "config_flt.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
TypeHandle FltBead::_type_handle;
|
||||
|
||||
@ -356,6 +359,7 @@ write_transform(FltRecordWriter &writer) const {
|
||||
Transforms::const_iterator ti;
|
||||
for (ti = _transform_steps.begin(); ti != _transform_steps.end(); ++ti) {
|
||||
if (!(*ti)->build_record(writer)) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_invalid_record;
|
||||
}
|
||||
FltError result = writer.advance();
|
||||
|
@ -7,6 +7,9 @@
|
||||
#include "fltRecordReader.h"
|
||||
#include "fltRecordWriter.h"
|
||||
#include "fltUnsupportedRecord.h"
|
||||
#include "config_flt.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
TypeHandle FltHeader::_type_handle;
|
||||
|
||||
@ -76,6 +79,7 @@ read_flt(Filename filename) {
|
||||
|
||||
ifstream in;
|
||||
if (!filename.open_read(in)) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_could_not_open;
|
||||
}
|
||||
|
||||
@ -101,6 +105,7 @@ read_flt(istream &in) {
|
||||
FltRecordReader reader(in);
|
||||
FltError result = reader.advance();
|
||||
if (result == FE_end_of_file) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_empty_file;
|
||||
} else if (result != FE_ok) {
|
||||
return result;
|
||||
@ -112,6 +117,7 @@ read_flt(istream &in) {
|
||||
}
|
||||
|
||||
if (!reader.eof()) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_extra_data;
|
||||
}
|
||||
|
||||
@ -132,6 +138,7 @@ write_flt(Filename filename) {
|
||||
|
||||
ofstream out;
|
||||
if (!filename.open_write(out)) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_could_not_open;
|
||||
}
|
||||
|
||||
@ -151,6 +158,7 @@ write_flt(ostream &out) {
|
||||
FltError result = write_record_and_children(writer);
|
||||
|
||||
if (out.fail()) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_write_error;
|
||||
}
|
||||
return result;
|
||||
@ -1455,6 +1463,7 @@ write_color_palette(FltRecordWriter &writer) const {
|
||||
Colors::const_iterator ci;
|
||||
for (ci = _colors.begin(); num_colors > 0 && ci != _colors.end(); ++ci) {
|
||||
if (!(*ci).build_record(writer)) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_invalid_record;
|
||||
}
|
||||
num_colors--;
|
||||
@ -1466,6 +1475,7 @@ write_color_palette(FltRecordWriter &writer) const {
|
||||
FltPackedColor empty;
|
||||
while (num_colors > 0) {
|
||||
if (!empty.build_record(writer)) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_invalid_record;
|
||||
}
|
||||
num_colors--;
|
||||
@ -1573,6 +1583,7 @@ write_eyepoint_palette(FltRecordWriter &writer) const {
|
||||
int num_eyepoints = get_num_eyepoints();
|
||||
for (i = 0; i < num_eyepoints; i++) {
|
||||
if (!_eyepoints[i].build_record(writer)) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_bad_data;
|
||||
}
|
||||
}
|
||||
@ -1580,6 +1591,7 @@ write_eyepoint_palette(FltRecordWriter &writer) const {
|
||||
int num_trackplanes = get_num_trackplanes();
|
||||
for (i = 0; i < num_trackplanes; i++) {
|
||||
if (!_trackplanes[i].build_record(writer)) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_bad_data;
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,12 @@
|
||||
#include "fltInstanceRef.h"
|
||||
#include "fltUnsupportedRecord.h"
|
||||
#include "fltExternalReference.h"
|
||||
#include "config_flt.h"
|
||||
|
||||
#include <indent.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
TypeHandle FltRecord::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -44,8 +47,8 @@ FltRecord::
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: FltRecord::get_num_children
|
||||
// Access: Public
|
||||
// Description: Returns the number of child records of this record. This
|
||||
// reflects the normal scene graph hierarchy.
|
||||
// Description: Returns the number of child records of this record.
|
||||
// This reflects the normal scene graph hierarchy.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int FltRecord::
|
||||
get_num_children() const {
|
||||
@ -430,6 +433,7 @@ FltError FltRecord::
|
||||
read_record_and_children(FltRecordReader &reader) {
|
||||
if (!extract_record(reader)) {
|
||||
nout << "Could not extract record for " << *this << "\n";
|
||||
assert(!flt_error_abort);
|
||||
return FE_invalid_record;
|
||||
}
|
||||
FltError result = reader.advance();
|
||||
@ -468,6 +472,7 @@ read_record_and_children(FltRecordReader &reader) {
|
||||
}
|
||||
|
||||
if (reader.eof() || reader.error()) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_end_of_file;
|
||||
}
|
||||
}
|
||||
@ -487,6 +492,7 @@ read_record_and_children(FltRecordReader &reader) {
|
||||
}
|
||||
add_subface(subface);
|
||||
if (reader.eof() || reader.error()) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_end_of_file;
|
||||
}
|
||||
}
|
||||
@ -555,6 +561,7 @@ FltError FltRecord::
|
||||
write_record_and_children(FltRecordWriter &writer) const {
|
||||
// First, write the record.
|
||||
if (!build_record(writer)) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_bad_data;
|
||||
}
|
||||
|
||||
@ -571,6 +578,7 @@ write_record_and_children(FltRecordWriter &writer) const {
|
||||
Records::const_iterator ci;
|
||||
for (ci = _ancillary.begin(); ci != _ancillary.end(); ++ci) {
|
||||
if (!(*ci)->build_record(writer)) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_bad_data;
|
||||
}
|
||||
result = writer.advance();
|
||||
|
@ -4,9 +4,12 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fltRecordReader.h"
|
||||
#include "config_flt.h"
|
||||
|
||||
#include <datagramIterator.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: FltRecordReader::Constructor
|
||||
// Access: Public
|
||||
@ -95,9 +98,11 @@ get_record_length() const {
|
||||
FltError FltRecordReader::
|
||||
advance() {
|
||||
if (_state == S_eof) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_end_of_file;
|
||||
}
|
||||
if (_state == S_error) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_read_error;
|
||||
}
|
||||
if (_iterator != (DatagramIterator *)NULL) {
|
||||
@ -113,10 +118,12 @@ advance() {
|
||||
|
||||
if (_in.eof()) {
|
||||
_state = S_eof;
|
||||
assert(!flt_error_abort);
|
||||
return FE_end_of_file;
|
||||
|
||||
} else if (_in.fail()) {
|
||||
_state = S_error;
|
||||
assert(!flt_error_abort);
|
||||
return FE_read_error;
|
||||
}
|
||||
|
||||
@ -137,11 +144,13 @@ advance() {
|
||||
|
||||
if (_in.eof()) {
|
||||
_state = S_eof;
|
||||
assert(!flt_error_abort);
|
||||
return FE_end_of_file;
|
||||
}
|
||||
|
||||
if (_in.fail()) {
|
||||
_state = S_error;
|
||||
assert(!flt_error_abort);
|
||||
return FE_read_error;
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,12 @@
|
||||
#include "fltRecordWriter.h"
|
||||
#include "fltInstanceDefinition.h"
|
||||
#include "fltHeader.h"
|
||||
#include "config_flt.h"
|
||||
|
||||
#include <datagram.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: FltRecordWriter::Constructor
|
||||
// Access: Public
|
||||
@ -86,12 +89,14 @@ advance() {
|
||||
|
||||
_out.write(dg.get_message().data(), dg.get_length());
|
||||
if (_out.fail()) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_write_error;
|
||||
}
|
||||
|
||||
// Now write the rest of the record.
|
||||
_out.write(_datagram.get_message().data(), _datagram.get_length());
|
||||
if (_out.fail()) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_write_error;
|
||||
}
|
||||
|
||||
@ -133,6 +138,7 @@ write_instance_def(FltHeader *header, int instance_index) {
|
||||
|
||||
FltInstanceDefinition *instance = header->get_instance(instance_index);
|
||||
if (instance == (FltInstanceDefinition *)NULL) {
|
||||
assert(!flt_error_abort);
|
||||
return FE_undefined_instance;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user