From: Ingo Huerner Date: Wed, 30 Apr 2014 12:50:17 +0000 (+0200) Subject: Fixed bug 202 X-Git-Tag: 0.9.0~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=34442a77f4ea692e5620e9e6609295760ada7a3c;p=profile%2Fivi%2Fpersistence-client-library.git Fixed bug 202 --- diff --git a/src/persistence_client_library.c b/src/persistence_client_library.c index 46e6722..42a1c5c 100644 --- a/src/persistence_client_library.c +++ b/src/persistence_client_library.c @@ -174,6 +174,9 @@ int pclInitLibrary(const char* appName, int shutdownMode) DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("pclInit => Failed to load custom library config table => error number:"), DLT_INT(status)); } + // initialize keyHandle array + memset(gKeyHandleArray, 0, sizeof(gKeyHandleArray)); + pers_unlock_access(); // assign application name @@ -294,4 +297,3 @@ int pclLifecycleSet(int shutdown) - diff --git a/src/persistence_client_library_data_organization.c b/src/persistence_client_library_data_organization.c index 81d7d6d..683a7d2 100644 --- a/src/persistence_client_library_data_organization.c +++ b/src/persistence_client_library_data_organization.c @@ -94,7 +94,8 @@ const char* gDeleteSignal = "PersistenceResDelete"; const char* gCreateSignal = "PersistenceResCreate"; -char gNotifykey[DbKeyMaxLen] = {0}; +char gNotifykey[DbKeyMaxLen] = { [0 ... DbKeyMaxLen-1] = 0}; + unsigned int gNotifyLdbid = 0; unsigned int gNotifyUserNo = 0; unsigned int gNotifySeatNo = 0; @@ -108,7 +109,7 @@ int gDbusPendingRvalue = 0; /// application id -char gAppId[MaxAppNameLen] = {0}; +char gAppId[MaxAppNameLen] = { [0 ... MaxAppNameLen-1] = 0}; /// max key value data size [default 16kB] diff --git a/src/persistence_client_library_db_access.c b/src/persistence_client_library_db_access.c index a102607..9fde5e8 100644 --- a/src/persistence_client_library_db_access.c +++ b/src/persistence_client_library_db_access.c @@ -624,14 +624,14 @@ void pers_rct_close_all() // close open persistence resource configuration table for(i=0; i< PrctDbTableSize; i++) { - if(gResource_table[i] != 0) + if(gResource_table[i] != -1) { - if(persComRctClose(i) != 0) + if(persComRctClose(i) == -1) { DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("process_prepare_shutdown => failed to close db => index:"), DLT_INT(i)); } - gResource_table[i] = 0; + gResource_table[i] = -1; } } } diff --git a/src/persistence_client_library_dbus_cmd.c b/src/persistence_client_library_dbus_cmd.c index f410e75..45b7a8f 100644 --- a/src/persistence_client_library_dbus_cmd.c +++ b/src/persistence_client_library_dbus_cmd.c @@ -36,9 +36,9 @@ void msg_pending_func(DBusPendingCall *call, void *data); void process_reg_notification_signal(DBusConnection* conn) { - char ruleChanged[DbusMatchRuleSize] = {0}; - char ruleDeleted[DbusMatchRuleSize] = {0}; - char ruleCreated[DbusMatchRuleSize] = {0}; + char ruleChanged[DbusMatchRuleSize] = {[0 ... DbusMatchRuleSize-1] = 0}; + char ruleDeleted[DbusMatchRuleSize] = {[0 ... DbusMatchRuleSize-1] = 0}; + char ruleCreated[DbusMatchRuleSize] = {[0 ... DbusMatchRuleSize-1] = 0}; // add match for c h a n g e snprintf(ruleChanged, DbusMatchRuleSize, @@ -79,9 +79,9 @@ void process_send_notification_signal(DBusConnection* conn) DBusMessage* message; const char* notifyReason = NULL; - char ldbidArray[DbusSubMatchSize] = {0}; - char userArray[DbusSubMatchSize] = {0}; - char seatArray[DbusSubMatchSize] = {0}; + char ldbidArray[DbusSubMatchSize] = {[0 ... DbusSubMatchSize-1] = 0}; + char userArray[DbusSubMatchSize] = {[0 ... DbusSubMatchSize-1] = 0}; + char seatArray[DbusSubMatchSize] = {[0 ... DbusSubMatchSize-1] = 0}; char* pldbidArra = ldbidArray; char* puserArray = userArray; char* pseatArray = seatArray; diff --git a/src/persistence_client_library_handle.c b/src/persistence_client_library_handle.c index b1c9f6b..23eba1f 100644 --- a/src/persistence_client_library_handle.c +++ b/src/persistence_client_library_handle.c @@ -28,10 +28,10 @@ static int gHandleIdx = 1; /// open file descriptor handle array -int gOpenFdArray[MaxPersHandle] = {0}; +int gOpenFdArray[MaxPersHandle] = { [0 ...MaxPersHandle-1] = 0 }; /// handle array -int gOpenHandleArray[MaxPersHandle] = {0}; +int gOpenHandleArray[MaxPersHandle] = { [0 ...MaxPersHandle-1] = 0 }; /// persistence key handle array PersistenceKeyHandle_s gKeyHandleArray[MaxPersHandle]; @@ -44,7 +44,7 @@ PersistenceFileHandle_s gOssHandleArray[MaxPersHandle]; /// free handle array -int gFreeHandleArray[MaxPersHandle] = {0}; +int gFreeHandleArray[MaxPersHandle] = { [0 ...MaxPersHandle-1] = 0 }; int gFreeHandleIdxHead = 0; pthread_mutex_t gMtx = PTHREAD_MUTEX_INITIALIZER; diff --git a/src/persistence_client_library_prct_access.c b/src/persistence_client_library_prct_access.c index d8a0671..5ae99cf 100644 --- a/src/persistence_client_library_prct_access.c +++ b/src/persistence_client_library_prct_access.c @@ -30,9 +30,9 @@ /// pointer to resource table database -int gResource_table[PrctDbTableSize] = {-1}; +int gResource_table[PrctDbTableSize] = {[0 ... PrctDbTableSize-1] = -1}; /// array to hold the information of database is already open -int gResourceOpen[PrctDbTableSize] = {0}; +int gResourceOpen[PrctDbTableSize] = { [0 ... PrctDbTableSize-1] = 0 }; /// persistence resource config table type definition @@ -101,7 +101,7 @@ int get_resource_cfg_table(PersistenceRCT_e rct, int group) { if(gResourceOpen[arrayIdx] == 0) // check if database is already open { - char filename[DbPathMaxLen] = {0}; + char filename[DbPathMaxLen] = { [0 ... DbPathMaxLen-1] = 0}; switch(rct) // create db name { @@ -120,11 +120,10 @@ int get_resource_cfg_table(PersistenceRCT_e rct, int group) } gResource_table[arrayIdx] = persComRctOpen(filename, 0x00); - DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("get_resource_cfg_table => filename: "), DLT_STRING(filename), DLT_INT(arrayIdx)); if(gResource_table[arrayIdx] < 0) { - gResourceOpen[arrayIdx] = 0; + gResourceOpen[arrayIdx] = -1; DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("get_resource_cfg_table => RCT problem"), DLT_INT(gResource_table[arrayIdx] )); } else