mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -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];
|
char this_header[_header_size];
|
||||||
_in.seekg(0);
|
_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
|
// Here's a special case: if the multifile begins with a hash
|
||||||
// character, then we skip at least 6 characters, and continue
|
// character, then we continue reading and discarding lines of ASCII
|
||||||
// reading and discarding lines of ASCII text, until we come across
|
// text, until we come across a nonempty line that does not begin
|
||||||
// a nonempty line that does not begin with a hash character. This
|
// with a hash character. This allows a P3D application (which is a
|
||||||
// allows a P3D application (which is a multifile) to be run
|
// multifile) to be run directly on the command line on Unix-based
|
||||||
// directly on the command line on Unix-based systems.
|
// systems.
|
||||||
if (this_header[0] == '#') {
|
int ch = _in.get();
|
||||||
int ch = '#';
|
|
||||||
|
if (ch == '#') {
|
||||||
while (ch != EOF && ch == '#') {
|
while (ch != EOF && ch == '#') {
|
||||||
// Skip to the end of the line.
|
// Skip to the end of the line.
|
||||||
while (ch != EOF && ch != '\n') {
|
while (ch != EOF && ch != '\n') {
|
||||||
@ -185,10 +180,14 @@ read_header(const string &pathname) {
|
|||||||
ch = _in.get();
|
ch = _in.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now fill up the header.
|
// Now read the actual Multifile header.
|
||||||
this_header[0] = ch;
|
this_header[0] = ch;
|
||||||
_in.read(this_header + 1, _header_size - 1);
|
_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) {
|
if (memcmp(this_header, _header, _header_size) != 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user