mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
consistent code with panda
This commit is contained in:
parent
87776490b4
commit
df671dc334
@ -160,21 +160,16 @@ read_header(const string &pathname) {
|
||||
|
||||
char this_header[_header_size];
|
||||
_in.seekg(0);
|
||||
_in.read(this_header, _header_size);
|
||||
if (_in.fail() || _in.gcount() != (unsigned)_header_size) {
|
||||
nout
|
||||
<< "Unable to read Multifile header " << pathname << ".\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Here's a special case: if the multifile begins with a hash
|
||||
// character, then we skip at least 6 characters, and continue
|
||||
// reading and discarding lines of ASCII text, until we come across
|
||||
// a nonempty line that does not begin with a hash character. This
|
||||
// allows a P3D application (which is a multifile) to be run
|
||||
// directly on the command line on Unix-based systems.
|
||||
if (this_header[0] == '#') {
|
||||
int ch = '#';
|
||||
// character, then we continue reading and discarding lines of ASCII
|
||||
// text, until we come across a nonempty line that does not begin
|
||||
// with a hash character. This allows a P3D application (which is a
|
||||
// multifile) to be run directly on the command line on Unix-based
|
||||
// systems.
|
||||
int ch = _in.get();
|
||||
|
||||
if (ch == '#') {
|
||||
while (ch != EOF && ch == '#') {
|
||||
// Skip to the end of the line.
|
||||
while (ch != EOF && ch != '\n') {
|
||||
@ -185,10 +180,14 @@ read_header(const string &pathname) {
|
||||
ch = _in.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now fill up the header.
|
||||
this_header[0] = ch;
|
||||
_in.read(this_header + 1, _header_size - 1);
|
||||
// Now read the actual Multifile header.
|
||||
this_header[0] = ch;
|
||||
_in.read(this_header + 1, _header_size - 1);
|
||||
if (_in.fail() || _in.gcount() != (unsigned)(_header_size - 1)) {
|
||||
nout << "Unable to read Multifile header: " << pathname << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (memcmp(this_header, _header, _header_size) != 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user