Permalink
Browse files

remove wrong override function in Android and win32, make xxtea file …

…decode correctly.
  • Loading branch information...
u0u0
u0u0 committed Nov 12, 2015
1 parent 1ec1925 commit 01c61278651a2f69c82baeaf1f8f6da35d700ee3
@@ -534,7 +534,7 @@ void FileUtils::purgeCachedEntries()
_fullPathCache.clear();
}
static Data getData(const std::string& filename, bool forString)
Data FileUtils::getData(const std::string& filename, bool forString)
{
if (filename.empty())
{
@@ -80,14 +80,16 @@ class CC_DLL FileUtils
/**
* Gets string from a file.
* IMPORTANT: DO NOT OVERRIDE ME!
*/
virtual std::string getStringFromFile(const std::string& filename);
std::string getStringFromFile(const std::string& filename);
/**
* Creates binary data from a file.
* IMPORTANT: DO NOT OVERRIDE ME!
* @return A data object.
*/
virtual Data getDataFromFile(const std::string& filename);
Data getDataFromFile(const std::string& filename);
/**
* Gets resource file data
@@ -100,6 +102,14 @@ class CC_DLL FileUtils
*/
CC_DEPRECATED_ATTRIBUTE virtual unsigned char* getFileData(const std::string& filename, const char* mode, ssize_t *size);
/**
* Get File date from file.
* OVERRIDE ME, if not use fopen to get file data
* @param[in] forString, openfile with string mode or not.
* @return A data object
*/
virtual Data getData(const std::string& filename, bool forString);
/**
* Gets resource file data from a zip file.
*
@@ -292,21 +292,6 @@ Data FileUtilsAndroid::getData(const std::string& filename, bool forString)
return ret;
}
std::string FileUtilsAndroid::getStringFromFile(const std::string& filename)
{
Data data = getData(filename, true);
if (data.isNull())
return "";
std::string ret((const char*)data.getBytes());
return ret;
}
Data FileUtilsAndroid::getDataFromFile(const std::string& filename)
{
return getData(filename, false);
}
unsigned char* FileUtilsAndroid::getFileData(const std::string& filename, const char* mode, ssize_t * size)
{
unsigned char * data = 0;
@@ -62,27 +62,16 @@ class CC_DLL FileUtilsAndroid : public FileUtils
bool init();
virtual std::string getNewFilename(const std::string &filename) const override;
virtual Data getData(const std::string& filename, bool forString) override;
/** @deprecated Please use FileUtils::getDataFromFile or FileUtils::getStringFromFile instead. */
CC_DEPRECATED_ATTRIBUTE virtual unsigned char* getFileData(const std::string& filename, const char* mode, ssize_t * size) override;
/**
* Gets string from a file.
*/
virtual std::string getStringFromFile(const std::string& filename) override;
/**
* Creates binary data from a file.
* @return A data object.
*/
virtual Data getDataFromFile(const std::string& filename) override;
virtual std::string getWritablePath() const;
virtual bool isAbsolutePath(const std::string& strPath) const;
private:
virtual bool isFileExistInternal(const std::string& strFilePath) const;
Data getData(const std::string& filename, bool forString);
static AAssetManager* assetmanager;
};
@@ -143,7 +143,7 @@ bool FileUtilsWin32::isAbsolutePath(const std::string& strPath) const
return false;
}
static Data getData(const std::string& filename, bool forString)
Data FileUtilsWin32::getData(const std::string& filename, bool forString)
{
if (filename.empty())
{
@@ -207,23 +207,6 @@ static Data getData(const std::string& filename, bool forString)
return ret;
}
std::string FileUtilsWin32::getStringFromFile(const std::string& filename)
{
Data data = getData(filename, true);
if (data.isNull())
{
return "";
}
std::string ret((const char*)data.getBytes());
return ret;
}
Data FileUtilsWin32::getDataFromFile(const std::string& filename)
{
return getData(filename, false);
}
unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const char* mode, ssize_t* size)
{
unsigned char * pBuffer = nullptr;
@@ -55,28 +55,14 @@ class CC_DLL FileUtilsWin32 : public FileUtils
virtual bool isFileExistInternal(const std::string& strFilePath) const;
/**
* Gets resource file data
*
* @param[in] filename The resource file name which contains the path.
* @param[in] mode The read mode of the file.
* @param[out] size If the file read operation succeeds, it will be the data size, otherwise 0.
* @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.
*/
virtual unsigned char* getFileData(const std::string& filename, const char* mode, ssize_t * size) override;
/**
* Gets string from a file.
*/
virtual std::string getStringFromFile(const std::string& filename) override;
/**
* Creates binary data from a file.
* @return A data object.
*/
virtual Data getDataFromFile(const std::string& filename) override;
virtual Data getData(const std::string& filename, bool forString) override;
/**
* Gets full path for filename, resolution directory and search path.
*

0 comments on commit 01c6127

Please sign in to comment.