mirror of https://github.com/axmolengine/axmol.git
Fix indentation for readability
This commit is contained in:
parent
f07b6a6804
commit
0825b1cc96
|
@ -47,10 +47,10 @@ static std::string className = "org/cocos2dx/lib/Cocos2dxLocalStorage";
|
|||
static void splitFilename (std::string& str)
|
||||
{
|
||||
size_t found = 0;
|
||||
found=str.find_last_of("/\\");
|
||||
found = str.find_last_of("/\\");
|
||||
if (found != std::string::npos)
|
||||
{
|
||||
str = str.substr(found+1);
|
||||
str = str.substr(found + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ void localStorageInit( const std::string& fullpath)
|
|||
if (fullpath.empty())
|
||||
return;
|
||||
|
||||
if( ! _initialized )
|
||||
if (!_initialized)
|
||||
{
|
||||
std::string strDBFilename = fullpath;
|
||||
splitFilename(strDBFilename);
|
||||
|
@ -71,7 +71,7 @@ void localStorageInit( const std::string& fullpath)
|
|||
|
||||
void localStorageFree()
|
||||
{
|
||||
if( _initialized ) {
|
||||
if (_initialized) {
|
||||
JniHelper::callStaticVoidMethod(className, "destory");
|
||||
_initialized = 0;
|
||||
}
|
||||
|
@ -111,7 +111,6 @@ void localStorageRemoveItem( const std::string& key )
|
|||
{
|
||||
assert( _initialized );
|
||||
JniHelper::callStaticVoidMethod(className, "removeItem", key);
|
||||
|
||||
}
|
||||
|
||||
/** removes all items from the LS */
|
||||
|
|
|
@ -49,22 +49,22 @@ static void localStorageCreateTable()
|
|||
{
|
||||
const char *sql_createtable = "CREATE TABLE IF NOT EXISTS data(key TEXT PRIMARY KEY,value TEXT);";
|
||||
sqlite3_stmt *stmt;
|
||||
int ok=sqlite3_prepare_v2(_db, sql_createtable, -1, &stmt, nullptr);
|
||||
int ok = sqlite3_prepare_v2(_db, sql_createtable, -1, &stmt, nullptr);
|
||||
ok |= sqlite3_step(stmt);
|
||||
ok |= sqlite3_finalize(stmt);
|
||||
|
||||
if( ok != SQLITE_OK && ok != SQLITE_DONE)
|
||||
if (ok != SQLITE_OK && ok != SQLITE_DONE)
|
||||
printf("Error in CREATE TABLE\n");
|
||||
}
|
||||
|
||||
void localStorageInit( const std::string& fullpath/* = "" */)
|
||||
{
|
||||
if( ! _initialized ) {
|
||||
if (!_initialized) {
|
||||
|
||||
int ret = 0;
|
||||
|
||||
if (fullpath.empty())
|
||||
ret = sqlite3_open(":memory:",&_db);
|
||||
ret = sqlite3_open(":memory:", &_db);
|
||||
else
|
||||
ret = sqlite3_open(fullpath.c_str(), &_db);
|
||||
|
||||
|
@ -86,7 +86,7 @@ void localStorageInit( const std::string& fullpath/* = "" */)
|
|||
const char *sql_clear = "DELETE FROM data;";
|
||||
ret |= sqlite3_prepare_v2(_db, sql_clear, -1, &_stmt_clear, nullptr);
|
||||
|
||||
if( ret != SQLITE_OK ) {
|
||||
if (ret != SQLITE_OK) {
|
||||
printf("Error initializing DB\n");
|
||||
// report error
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ void localStorageInit( const std::string& fullpath/* = "" */)
|
|||
|
||||
void localStorageFree()
|
||||
{
|
||||
if( _initialized ) {
|
||||
if (_initialized) {
|
||||
sqlite3_finalize(_stmt_select);
|
||||
sqlite3_finalize(_stmt_remove);
|
||||
sqlite3_finalize(_stmt_update);
|
||||
|
@ -120,7 +120,7 @@ void localStorageSetItem( const std::string& key, const std::string& value)
|
|||
|
||||
ok |= sqlite3_reset(_stmt_update);
|
||||
|
||||
if( ok != SQLITE_OK && ok != SQLITE_DONE)
|
||||
if (ok != SQLITE_OK && ok != SQLITE_DONE)
|
||||
printf("Error in localStorage.setItem()\n");
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ bool localStorageGetItem( const std::string& key, std::string *outItem )
|
|||
ok |= sqlite3_step(_stmt_select);
|
||||
const unsigned char *text = sqlite3_column_text(_stmt_select, 0);
|
||||
|
||||
if ( ok != SQLITE_OK && ok != SQLITE_DONE && ok != SQLITE_ROW )
|
||||
if (ok != SQLITE_OK && ok != SQLITE_DONE && ok != SQLITE_ROW)
|
||||
{
|
||||
printf("Error in localStorage.getItem()\n");
|
||||
return false;
|
||||
|
@ -162,7 +162,7 @@ void localStorageRemoveItem( const std::string& key )
|
|||
|
||||
ok |= sqlite3_reset(_stmt_remove);
|
||||
|
||||
if( ok != SQLITE_OK && ok != SQLITE_DONE)
|
||||
if (ok != SQLITE_OK && ok != SQLITE_DONE)
|
||||
printf("Error in localStorage.removeItem()\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue