From 74ba46f22511897a59b5dc19f8e29654b72e90b7 Mon Sep 17 00:00:00 2001 From: cpascal Date: Sun, 9 Nov 2014 07:38:44 +0900 Subject: [PATCH] Fixed "warning: bundle reader out of range" This warning was displayed even if it's valid c3b file.. Changed "validLength <= needLength" to "validLength < needLength". --- cocos/3d/CCBundleReader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cocos/3d/CCBundleReader.cpp b/cocos/3d/CCBundleReader.cpp index 5bc99e8499..33ba3acfb2 100644 --- a/cocos/3d/CCBundleReader.cpp +++ b/cocos/3d/CCBundleReader.cpp @@ -49,13 +49,16 @@ void BundleReader::init(char* buffer, ssize_t length) ssize_t BundleReader::read(void* ptr, ssize_t size, ssize_t count) { if (!_buffer || eof()) + { + CCLOG("warning: bundle reader out of range"); return 0; + } ssize_t validCount; ssize_t validLength = _length - _position; ssize_t needLength = size*count; char* ptr1 = (char*)ptr; - if(validLength <= needLength) + if(validLength < needLength) { validCount = validLength/size; ssize_t readLength = size*validCount;