mirror of https://github.com/axmolengine/axmol.git
fixes to local storage
This commit is contained in:
parent
8c691430c1
commit
ca5ef5795e
|
@ -42,7 +42,7 @@
|
|||
USING_NS_CC;
|
||||
static int _initialized = 0;
|
||||
|
||||
static className = "org/cocos2dx/lib/Cocos2dxLocalStorage";
|
||||
static std::string className = "org/cocos2dx/lib/Cocos2dxLocalStorage";
|
||||
|
||||
static void splitFilename (std::string& str)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ void localStorageInit( const std::string& fullpath)
|
|||
{
|
||||
std::string strDBFilename = fullpath;
|
||||
splitFilename(strDBFilename);
|
||||
if (JniHelper::CallStaticBooleanMethod(className, "init", strDBFilename, "data")) {
|
||||
if (JniHelper::callStaticBooleanMethod(className, "init", strDBFilename, "data")) {
|
||||
_initialized = 1;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ void localStorageInit( const std::string& fullpath)
|
|||
void localStorageFree()
|
||||
{
|
||||
if( _initialized ) {
|
||||
JniHelper::CallStaticVoidMethod(className, "destory");
|
||||
JniHelper::callStaticVoidMethod(className, "destory");
|
||||
_initialized = 0;
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ void localStorageFree()
|
|||
void localStorageSetItem( const std::string& key, const std::string& value)
|
||||
{
|
||||
assert( _initialized );
|
||||
JniHelper::CallStaticVoidMethod(className, "setItem", key, value);
|
||||
JniHelper::callStaticVoidMethod(className, "setItem", key, value);
|
||||
}
|
||||
|
||||
/** gets an item from the LS */
|
||||
|
@ -110,7 +110,7 @@ bool localStorageGetItem( const std::string& key, std::string *outItem )
|
|||
void localStorageRemoveItem( const std::string& key )
|
||||
{
|
||||
assert( _initialized );
|
||||
JniHelper::CallStaticVoidMethod(className, "removeItem", key);
|
||||
JniHelper::callStaticVoidMethod(className, "removeItem", key);
|
||||
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ void localStorageRemoveItem( const std::string& key )
|
|||
void localStorageClear()
|
||||
{
|
||||
assert( _initialized );
|
||||
JniHelper::CallStaticVoidMethod(className, "clear");
|
||||
JniHelper::callStaticVoidMethod(className, "clear");
|
||||
}
|
||||
|
||||
#endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
|
|
Loading…
Reference in New Issue