mirror of https://github.com/axmolengine/axmol.git
fix compile error for vs project
This commit is contained in:
parent
7c97ed2bcd
commit
abef5b59fa
|
@ -272,7 +272,7 @@ tImageTGA* tgaLoadBuffer(unsigned char* buffer, long size)
|
||||||
// this is the function to call when we want to load an image
|
// this is the function to call when we want to load an image
|
||||||
tImageTGA * tgaLoad(const char *filename)
|
tImageTGA * tgaLoad(const char *filename)
|
||||||
{
|
{
|
||||||
long size = 0;
|
ssize_t size = 0;
|
||||||
unsigned char* buffer = FileUtils::getInstance()->getFileData(filename, "rb", &size);
|
unsigned char* buffer = FileUtils::getInstance()->getFileData(filename, "rb", &size);
|
||||||
|
|
||||||
if (buffer != nullptr)
|
if (buffer != nullptr)
|
||||||
|
|
|
@ -306,7 +306,7 @@ bool ZipUtils::isCCZFile(const char *path)
|
||||||
// load file into memory
|
// load file into memory
|
||||||
unsigned char* compressed = NULL;
|
unsigned char* compressed = NULL;
|
||||||
|
|
||||||
long fileLen = 0;
|
ssize_t fileLen = 0;
|
||||||
compressed = FileUtils::getInstance()->getFileData(path, "rb", &fileLen);
|
compressed = FileUtils::getInstance()->getFileData(path, "rb", &fileLen);
|
||||||
|
|
||||||
if(compressed == NULL || fileLen == 0)
|
if(compressed == NULL || fileLen == 0)
|
||||||
|
@ -321,7 +321,7 @@ bool ZipUtils::isCCZFile(const char *path)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZipUtils::isCCZBuffer(const unsigned char *buffer, long len)
|
bool ZipUtils::isCCZBuffer(const unsigned char *buffer, ssize_t len)
|
||||||
{
|
{
|
||||||
if (static_cast<size_t>(len) < sizeof(struct CCZHeader))
|
if (static_cast<size_t>(len) < sizeof(struct CCZHeader))
|
||||||
{
|
{
|
||||||
|
@ -338,7 +338,7 @@ bool ZipUtils::isGZipFile(const char *path)
|
||||||
// load file into memory
|
// load file into memory
|
||||||
unsigned char* compressed = NULL;
|
unsigned char* compressed = NULL;
|
||||||
|
|
||||||
long fileLen = 0;
|
ssize_t fileLen = 0;
|
||||||
compressed = FileUtils::getInstance()->getFileData(path, "rb", &fileLen);
|
compressed = FileUtils::getInstance()->getFileData(path, "rb", &fileLen);
|
||||||
|
|
||||||
if(NULL == compressed || 0 == fileLen)
|
if(NULL == compressed || 0 == fileLen)
|
||||||
|
@ -352,7 +352,7 @@ bool ZipUtils::isGZipFile(const char *path)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZipUtils::isGZipBuffer(const unsigned char *buffer, long len)
|
bool ZipUtils::isGZipBuffer(const unsigned char *buffer, ssize_t len)
|
||||||
{
|
{
|
||||||
if (len < 2)
|
if (len < 2)
|
||||||
{
|
{
|
||||||
|
@ -461,7 +461,7 @@ int ZipUtils::inflateCCZFile(const char *path, unsigned char **out)
|
||||||
// load file into memory
|
// load file into memory
|
||||||
unsigned char* compressed = NULL;
|
unsigned char* compressed = NULL;
|
||||||
|
|
||||||
long fileLen = 0;
|
ssize_t fileLen = 0;
|
||||||
compressed = FileUtils::getInstance()->getFileData(path, "rb", &fileLen);
|
compressed = FileUtils::getInstance()->getFileData(path, "rb", &fileLen);
|
||||||
|
|
||||||
if(NULL == compressed || 0 == fileLen)
|
if(NULL == compressed || 0 == fileLen)
|
||||||
|
|
|
@ -31,6 +31,8 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
#include "platform/android/CCFileUtilsAndroid.h"
|
#include "platform/android/CCFileUtilsAndroid.h"
|
||||||
|
#elif(CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||||
|
#include "CCStdC.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace cocos2d
|
namespace cocos2d
|
||||||
|
|
|
@ -121,7 +121,7 @@ bool FileUtilsWin32::isAbsolutePath(const std::string& strPath) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mode, long* size)
|
unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mode, ssize_t* size)
|
||||||
{
|
{
|
||||||
unsigned char * pBuffer = NULL;
|
unsigned char * pBuffer = NULL;
|
||||||
CCASSERT(filename != NULL && size != NULL && mode != NULL, "Invalid parameters.");
|
CCASSERT(filename != NULL && size != NULL && mode != NULL, "Invalid parameters.");
|
||||||
|
|
|
@ -58,7 +58,7 @@ protected:
|
||||||
* @return Upon success, a pointer to the data is returned, otherwise NULL.
|
* @return Upon success, a pointer to the data is returned, otherwise NULL.
|
||||||
* @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.
|
* @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.
|
||||||
*/
|
*/
|
||||||
virtual unsigned char* getFileData(const char* filename, const char* mode, long * size) override;
|
virtual unsigned char* getFileData(const char* filename, const char* mode, ssize_t * size) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets full path for filename, resolution directory and search path.
|
* Gets full path for filename, resolution directory and search path.
|
||||||
|
|
|
@ -25,6 +25,11 @@ THE SOFTWARE.
|
||||||
#ifndef __CC_STD_C_H__
|
#ifndef __CC_STD_C_H__
|
||||||
#define __CC_STD_C_H__
|
#define __CC_STD_C_H__
|
||||||
|
|
||||||
|
//typedef SSIZE_T ssize_t;
|
||||||
|
// ssize_t was redefined as int in libwebsockets.h.
|
||||||
|
// Therefore, to avoid conflict, we needs the same definition.
|
||||||
|
typedef int ssize_t;
|
||||||
|
|
||||||
#include "CCPlatformMacros.h"
|
#include "CCPlatformMacros.h"
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ void AutoreleasePool::clear()
|
||||||
int nIndex = _managedObjectArray.size() - 1;
|
int nIndex = _managedObjectArray.size() - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_managedObjectArray.forEachReverse([](Object* obj){
|
_managedObjectArray.forEachReverse([&](Object* obj){
|
||||||
--(obj->_autoReleaseCount);
|
--(obj->_autoReleaseCount);
|
||||||
//(*it)->release();
|
//(*it)->release();
|
||||||
//delete (*it);
|
//delete (*it);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
reserve(capacity);
|
reserve(capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~Vector<T>()
|
~Vector<T>()
|
||||||
{
|
{
|
||||||
CCLOGINFO("In the destructor of Vector.");
|
CCLOGINFO("In the destructor of Vector.");
|
||||||
clear();
|
clear();
|
||||||
|
|
|
@ -218,7 +218,7 @@ Node* CCBReader::readNodeGraphFromFile(const char *pCCBFileName, Object *pOwner,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string strPath = FileUtils::getInstance()->fullPathForFilename(strCCBFileName.c_str());
|
std::string strPath = FileUtils::getInstance()->fullPathForFilename(strCCBFileName.c_str());
|
||||||
long size = 0;
|
ssize_t size = 0;
|
||||||
|
|
||||||
unsigned char * pBytes = FileUtils::getInstance()->getFileData(strPath.c_str(), "rb", &size);
|
unsigned char * pBytes = FileUtils::getInstance()->getFileData(strPath.c_str(), "rb", &size);
|
||||||
Data *data = new Data(pBytes, size);
|
Data *data = new Data(pBytes, size);
|
||||||
|
|
|
@ -923,7 +923,7 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
|
||||||
|
|
||||||
// Load sub file
|
// Load sub file
|
||||||
std::string path = FileUtils::getInstance()->fullPathForFilename(ccbFileName.c_str());
|
std::string path = FileUtils::getInstance()->fullPathForFilename(ccbFileName.c_str());
|
||||||
long size = 0;
|
ssize_t size = 0;
|
||||||
unsigned char * pBytes = FileUtils::getInstance()->getFileData(path.c_str(), "rb", &size);
|
unsigned char * pBytes = FileUtils::getInstance()->getFileData(path.c_str(), "rb", &size);
|
||||||
|
|
||||||
CCBReader * reader = new CCBReader(pCCBReader);
|
CCBReader * reader = new CCBReader(pCCBReader);
|
||||||
|
|
|
@ -291,7 +291,7 @@ void DataReaderHelper::addDataFromFile(const char *filePath)
|
||||||
size_t startPos = filePathStr.find_last_of(".");
|
size_t startPos = filePathStr.find_last_of(".");
|
||||||
std::string str = &filePathStr[startPos];
|
std::string str = &filePathStr[startPos];
|
||||||
|
|
||||||
long size;
|
ssize_t size;
|
||||||
std::string fullPath = CCFileUtils::getInstance()->fullPathForFilename(filePath);
|
std::string fullPath = CCFileUtils::getInstance()->fullPathForFilename(filePath);
|
||||||
char *pFileContent = (char *)CCFileUtils::getInstance()->getFileData(fullPath.c_str() , "r", &size);
|
char *pFileContent = (char *)CCFileUtils::getInstance()->getFileData(fullPath.c_str() , "r", &size);
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ void DataReaderHelper::addDataFromFileAsync(const char *imagePath, const char *p
|
||||||
std::string str = &filePathStr[startPos];
|
std::string str = &filePathStr[startPos];
|
||||||
|
|
||||||
std::string fullPath = CCFileUtils::getInstance()->fullPathForFilename(filePath);
|
std::string fullPath = CCFileUtils::getInstance()->fullPathForFilename(filePath);
|
||||||
long size;
|
ssize_t size;
|
||||||
|
|
||||||
// XXX fileContent is being leaked
|
// XXX fileContent is being leaked
|
||||||
data->fileContent = (char *)CCFileUtils::getInstance()->getFileData(fullPath.c_str() , "r", &size);
|
data->fileContent = (char *)CCFileUtils::getInstance()->getFileData(fullPath.c_str() , "r", &size);
|
||||||
|
|
|
@ -128,7 +128,7 @@ UIWidget* GUIReader::widgetFromJsonFile(const char *fileName)
|
||||||
jsonpath = CCFileUtils::getInstance()->fullPathForFilename(fileName);
|
jsonpath = CCFileUtils::getInstance()->fullPathForFilename(fileName);
|
||||||
int pos = jsonpath.find_last_of('/');
|
int pos = jsonpath.find_last_of('/');
|
||||||
m_strFilePath = jsonpath.substr(0,pos+1);
|
m_strFilePath = jsonpath.substr(0,pos+1);
|
||||||
long size = 0;
|
ssize_t size = 0;
|
||||||
des = (char*)(CCFileUtils::getInstance()->getFileData(jsonpath.c_str(),"r" , &size));
|
des = (char*)(CCFileUtils::getInstance()->getFileData(jsonpath.c_str(),"r" , &size));
|
||||||
if(nullptr == des || strcmp(des, "") == 0)
|
if(nullptr == des || strcmp(des, "") == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace cocostudio {
|
||||||
|
|
||||||
cocos2d::Node* SceneReader::createNodeWithSceneFile(const char* pszFileName)
|
cocos2d::Node* SceneReader::createNodeWithSceneFile(const char* pszFileName)
|
||||||
{
|
{
|
||||||
long size = 0;
|
ssize_t size = 0;
|
||||||
char* pData = 0;
|
char* pData = 0;
|
||||||
cocos2d::Node *pNode = nullptr;
|
cocos2d::Node *pNode = nullptr;
|
||||||
do
|
do
|
||||||
|
@ -215,7 +215,7 @@ namespace cocostudio {
|
||||||
{
|
{
|
||||||
file_path = reDir.substr(0, pos+1);
|
file_path = reDir.substr(0, pos+1);
|
||||||
}
|
}
|
||||||
long size = 0;
|
ssize_t size = 0;
|
||||||
char *des = (char*)(cocos2d::FileUtils::getInstance()->getFileData(pPath.c_str(),"r" , &size));
|
char *des = (char*)(cocos2d::FileUtils::getInstance()->getFileData(pPath.c_str(),"r" , &size));
|
||||||
JsonDictionary *jsonDict = new JsonDictionary();
|
JsonDictionary *jsonDict = new JsonDictionary();
|
||||||
jsonDict->initWithDescription(des);
|
jsonDict->initWithDescription(des);
|
||||||
|
@ -285,7 +285,7 @@ namespace cocostudio {
|
||||||
if (nResType == 0)
|
if (nResType == 0)
|
||||||
{
|
{
|
||||||
pAttribute = ComAttribute::create();
|
pAttribute = ComAttribute::create();
|
||||||
long size = 0;
|
ssize_t size = 0;
|
||||||
char* pData = 0;
|
char* pData = 0;
|
||||||
pData = (char*)(cocos2d::FileUtils::getInstance()->getFileData(pPath.c_str(), "r", &size));
|
pData = (char*)(cocos2d::FileUtils::getInstance()->getFileData(pPath.c_str(), "r", &size));
|
||||||
if(pData != nullptr && strcmp(pData, "") != 0)
|
if(pData != nullptr && strcmp(pData, "") != 0)
|
||||||
|
|
|
@ -54,6 +54,10 @@
|
||||||
#ifndef SPINE_EXTENSION_H_
|
#ifndef SPINE_EXTENSION_H_
|
||||||
#define SPINE_EXTENSION_H_
|
#define SPINE_EXTENSION_H_
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#include "CCStdC.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* All allocation uses these. */
|
/* All allocation uses these. */
|
||||||
#define MALLOC(TYPE,COUNT) ((TYPE*)_malloc(sizeof(TYPE) * COUNT))
|
#define MALLOC(TYPE,COUNT) ((TYPE*)_malloc(sizeof(TYPE) * COUNT))
|
||||||
#define CALLOC(TYPE,COUNT) ((TYPE*)_calloc(1, sizeof(TYPE) * COUNT))
|
#define CALLOC(TYPE,COUNT) ((TYPE*)_calloc(1, sizeof(TYPE) * COUNT))
|
||||||
|
|
Loading…
Reference in New Issue