mirror of https://github.com/axmolengine/axmol.git
modify BundleReader and the version read
This commit is contained in:
parent
701a2b60c2
commit
df7ab50062
|
@ -463,8 +463,11 @@ bool Bundle3D::loadBinary(const std::string& path)
|
|||
|
||||
// Read version
|
||||
unsigned char ver[2];
|
||||
if (_binaryReader.read(ver, 1, 2) == 2)
|
||||
{
|
||||
if (_binaryReader.read(ver, 1, 2)!= 2){
|
||||
CCLOG("Failed to read version:");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ver[0] != 0) {
|
||||
clear();
|
||||
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
|
||||
|
@ -476,7 +479,7 @@ bool Bundle3D::loadBinary(const std::string& path)
|
|||
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Read ref table size
|
||||
if (_binaryReader.read(&_referenceCount, 4, 1) != 1)
|
||||
|
|
|
@ -65,7 +65,7 @@ char* BundleReader::readLine(int num,char* line)
|
|||
char* p = line;
|
||||
char c;
|
||||
ssize_t readNum = 0;
|
||||
while((c=*buffer) != 10 && readNum < (ssize_t)num && m_position<(long int)m_length)
|
||||
while((c=*buffer) != 10 && readNum < (ssize_t)num && m_position < m_length)
|
||||
{
|
||||
*p = c;
|
||||
p++;
|
||||
|
@ -91,7 +91,7 @@ ssize_t BundleReader::length()
|
|||
return m_length;
|
||||
}
|
||||
|
||||
long int BundleReader::tell()
|
||||
ssize_t BundleReader::tell()
|
||||
{
|
||||
if (!m_buffer)
|
||||
return -1;
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
bool readMatrix(float* m);
|
||||
|
||||
private:
|
||||
long int m_position;
|
||||
ssize_t m_position;
|
||||
ssize_t m_length;
|
||||
char* m_buffer;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue