and other best pracitces like:
capacity and "index" are ints and not unsigned int (google's recomendation).
It is easier to detect underflow bugs like this
plus other minor improvements
... instead of sharedXXX / purgeXXX.
They are more C++ friendly, and also easier to remember.
common files + Mac files + iOS files + tests/samples files were updated.
The old methods are deprecated now.
Updated the TextureAtlasEncryptionTest to show how to use the ccSetPvrEncryptionKey(…) function.
Updated the notes and header docs for improved clarity.
Rename PVR decryption functions and variables to better fit in the Cocos2DX framework.
Improve log error notes.
Update TextureAtlasEncryptionTest to match revised function call in ZipUtils.
Update ccSetPvrEncryptionKeyPart documentation to clarify that encryption is never 100% secure.
unzip.h/.cpp - unzGoToFirstFile/unzGoToNextFile retrieves information
about the current file, so it is possible to remove redundant calls
to unzGetCurrentFileInfo and speed up general execution.
unzip.h/.cpp are modified accordingly by creation unzGoToFirstFile64
and unzGoToNextFile64 with file info (unz_file_info64) and name as
possible output parameters.
ZipFile::setFilter (it is used to create a file list at ZipFile
constructor) - redundant calls to unzGetCurrentFileInfo64 are removed,
so briefly the time required to generate a zip file list is something
like 1 average old unzLocateFile call.
A fix for changes at 75ae8d2201
- unzOpenCurrentFile3 has set pfile_in_zip_read_info->crc32_wait
just in case if Zip file has unknown structure / might not be
unpacked, so almost any unpacked file was considered as having
UNZ_CRCERROR.
Open APK file just once and cache a file list information (name and
position inside archive). Also a general ZipFile helper class is
created to read multiple files from Zip archives - might be used
for another platforms if needed.
Previously it was so for each separate file access operation:
- Open zip archive, initially parse its structure (unzOpen)
- Locate the particular file there by a linear search through
full archive (unzLocateFile).
So if file does not exist - still an archive has to be handled
fully, even slower than a file exists.
- Read file.
- Close zip archive
After this commit:
- Once - open zip/apk file and collect file list information
(average consumed time - the same like a search for 2 different
files by unzLocateFile)
- When needed - directly retrieve file position inside the archive,
setting it up to the zip reader and reading file
ZipFile class is located in support/zip_support/ZipUtils.h and .cpp
to prevent creation of a new files and adding them to multiple
project files.
with four spaces. Also,
1. Used macro NS_CC_BEGIN instead of namespace cocos2d {, NS_CC_END instead
of }.
2. Removed some unused files.
3. Renamed the name of some folders, for example,
"test.android"-->"proj.android" .