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
|
// Read version
|
||||||
unsigned char ver[2];
|
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) {
|
if (ver[0] != 0) {
|
||||||
clear();
|
clear();
|
||||||
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
|
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]);
|
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Read ref table size
|
// Read ref table size
|
||||||
if (_binaryReader.read(&_referenceCount, 4, 1) != 1)
|
if (_binaryReader.read(&_referenceCount, 4, 1) != 1)
|
||||||
|
|
|
@ -65,7 +65,7 @@ char* BundleReader::readLine(int num,char* line)
|
||||||
char* p = line;
|
char* p = line;
|
||||||
char c;
|
char c;
|
||||||
ssize_t readNum = 0;
|
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 = c;
|
||||||
p++;
|
p++;
|
||||||
|
@ -91,7 +91,7 @@ ssize_t BundleReader::length()
|
||||||
return m_length;
|
return m_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
long int BundleReader::tell()
|
ssize_t BundleReader::tell()
|
||||||
{
|
{
|
||||||
if (!m_buffer)
|
if (!m_buffer)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
bool readMatrix(float* m);
|
bool readMatrix(float* m);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
long int m_position;
|
ssize_t m_position;
|
||||||
ssize_t m_length;
|
ssize_t m_length;
|
||||||
char* m_buffer;
|
char* m_buffer;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue