summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Huerner <ingo.huerner@xse.de>2014-02-10 14:18:32 +0100
committerIngo Huerner <ingo.huerner@xse.de>2014-02-10 14:18:32 +0100
commitfdd7c5149b3c611b805560240834b25ef11147cb (patch)
tree9f092af724ab68a49ce0c3dbeddb433a9804d5d7
parent803592aadc00719505f1165dd507656482fd509c (diff)
downloadpersistence-client-library-fdd7c5149b3c611b805560240834b25ef11147cb.tar.gz
Removed compiler warnings
-rw-r--r--src/persistence_client_library.c1
-rw-r--r--src/persistence_client_library_backup_filelist.c4
-rw-r--r--src/persistence_client_library_backup_filelist.h23
-rw-r--r--src/persistence_client_library_db_access.c6
-rw-r--r--src/persistence_client_library_dbus_cmd.c11
-rw-r--r--src/persistence_client_library_dbus_service.c2
-rw-r--r--src/persistence_client_library_key.c5
-rw-r--r--src/persistence_client_library_prct_access.c2
-rw-r--r--test/persistence_client_library_test.c23
9 files changed, 50 insertions, 27 deletions
diff --git a/src/persistence_client_library.c b/src/persistence_client_library.c
index 868db91..38da6c8 100644
--- a/src/persistence_client_library.c
+++ b/src/persistence_client_library.c
@@ -25,6 +25,7 @@
#include "persistence_client_library_custom_loader.h"
#include "persistence_client_library.h"
#include "persistence_client_library_backup_filelist.h"
+#include "../include_protected/persistence_client_library_db_access.h"
#include <string.h>
#include <errno.h>
diff --git a/src/persistence_client_library_backup_filelist.c b/src/persistence_client_library_backup_filelist.c
index 5a44212..c72b739 100644
--- a/src/persistence_client_library_backup_filelist.c
+++ b/src/persistence_client_library_backup_filelist.c
@@ -31,6 +31,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
+#include <sys/sendfile.h>
/// structure definition for a key value item
@@ -566,8 +567,6 @@ int pclVerifyConsistency(const char* origPath, const char* backupPath, const cha
int pclRecoverFromBackup(int backupFd, const char* original)
{
int handle = 0;
- int readSize = 0;
- char buffer[RDRWBufferSize];
handle = open(original, O_TRUNC | O_RDWR);
if(handle != -1)
@@ -588,7 +587,6 @@ int pclCreateBackup(const char* dstPath, int srcfd, const char* csumPath, const
{
int dstFd = 0, csfd = 0;
int readSize = -1;
- char buffer[RDRWBufferSize];
if(access(dstPath, F_OK) != 0)
{
diff --git a/src/persistence_client_library_backup_filelist.h b/src/persistence_client_library_backup_filelist.h
index 65a6a3c..896981b 100644
--- a/src/persistence_client_library_backup_filelist.h
+++ b/src/persistence_client_library_backup_filelist.h
@@ -20,6 +20,8 @@
*/
+#include "../include_protected/persistence_client_library_rc_table.h"
+
/**
* @brief Read the blacklist configuration file
*
@@ -100,5 +102,26 @@ int pclVerifyConsistency(const char* origPath, const char* backupPath, const cha
inline int pclBackupNeeded(const char* path);
+/**
+ * @brief translate persistence permission into POSIX file open permissions
+ *
+ * @param
+ *
+ * @return
+ */
+int pclGetPosixPermission(PersistencePermission_e permission);
+
+
+
+/**
+ * @brief create the file and the given path
+ *
+ * @param
+ *
+ * @return
+ */
+int pclCreateFileAndPath(const char* path);
+
+
#endif /* PERS_BACKUP_BLACKLIST_H */
diff --git a/src/persistence_client_library_db_access.c b/src/persistence_client_library_db_access.c
index 8c10ae9..443aab4 100644
--- a/src/persistence_client_library_db_access.c
+++ b/src/persistence_client_library_db_access.c
@@ -21,6 +21,7 @@
#include "../include_protected/persistence_client_library_rc_table.h"
#include "persistence_client_library_custom_loader.h"
#include "persistence_client_library_itzam_errors.h"
+#include "persistence_client_library_prct_access.h"
#include "persistence_client_library_dbus_service.h"
@@ -72,7 +73,7 @@ static int gBtreeCreated[DbTableSize][PersistencePolicy_LastEntry] = { {0} };
// function prototype
int pers_send_Notification_Signal(const char* key, PersistenceDbContext_s* context, unsigned int reason);
-int pers_get_default_data(char* dbPath, char* key, char* buffer, unsigned int buffer_size);
+int pers_get_default_data(char* dbPath, char* key, unsigned char* buffer, unsigned int buffer_size);
@@ -241,7 +242,6 @@ int pers_db_read_key(char* dbPath, char* key, PersistenceInfo_s* info, unsigned
{
itzam_btree* btree = NULL;
int keyFound = 0;
- itzam_state state = ITZAM_FAILED;
btree = pers_db_open(info, dbPath);
if(btree != NULL)
@@ -298,7 +298,7 @@ int pers_db_read_key(char* dbPath, char* key, PersistenceInfo_s* info, unsigned
-int pers_get_default_data(char* dbPath, char* key, char* buffer, unsigned int buffer_size)
+int pers_get_default_data(char* dbPath, char* key, unsigned char* buffer, unsigned int buffer_size)
{
int keyFound = 0;
int read_size = 0;
diff --git a/src/persistence_client_library_dbus_cmd.c b/src/persistence_client_library_dbus_cmd.c
index b9a99b4..c8a138c 100644
--- a/src/persistence_client_library_dbus_cmd.c
+++ b/src/persistence_client_library_dbus_cmd.c
@@ -22,11 +22,13 @@
#include "persistence_client_library_itzam_errors.h"
#include "persistence_client_library_custom_loader.h"
#include "persistence_client_library_prct_access.h"
+#include "persistence_client_library_pas_interface.h"
#include "../include_protected/persistence_client_library_data_organization.h"
#include "../include_protected/persistence_client_library_db_access.h"
#include <itzam.h>
+#include <dlfcn.h>
// function prototype
@@ -213,7 +215,6 @@ void process_send_pas_request(DBusConnection* conn, unsigned int requestID, int
{
DBusError error;
dbus_error_init (&error);
- int rval = 0;
DBusMessage* message = dbus_message_new_method_call("org.genivi.persistence.admin", // destination
"/org/genivi/persistence/admin", // path
@@ -230,7 +231,6 @@ void process_send_pas_request(DBusConnection* conn, unsigned int requestID, int
if(!dbus_connection_send(conn, message, 0))
{
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => Access denied"), DLT_STRING(error.message) );
- rval = -1;
}
dbus_connection_flush(conn);
@@ -314,8 +314,6 @@ void process_send_pas_register(DBusConnection* conn, int regType, int notificati
void process_send_lifecycle_register(DBusConnection* conn, int regType, int shutdownMode)
{
- int rval = 0;
-
DBusError error;
dbus_error_init (&error);
@@ -354,7 +352,6 @@ void process_send_lifecycle_register(DBusConnection* conn, int regType, int shut
if(!dbus_connection_send(conn, message, 0))
{
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_register => Access denied"), DLT_STRING(error.message) );
- rval = -1;
}
dbus_connection_flush(conn);
dbus_message_unref(message);
@@ -374,7 +371,6 @@ void process_send_lifecycle_register(DBusConnection* conn, int regType, int shut
void process_send_lifecycle_request(DBusConnection* conn, int requestId, int status)
{
- int rval = 0;
DBusError error;
dbus_error_init (&error);
@@ -394,7 +390,6 @@ void process_send_lifecycle_request(DBusConnection* conn, int requestId, int sta
if(!dbus_connection_send(conn, message, 0))
{
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => Access denied"), DLT_STRING(error.message) );
- rval = -1;
}
dbus_connection_flush(conn);
@@ -403,13 +398,11 @@ void process_send_lifecycle_request(DBusConnection* conn, int requestId, int sta
else
{
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => ERROR: Invalid message"));
- rval = -1;
}
}
else
{
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("send_lifecycle_request => ERROR: connection isn NULL"));
- rval = -1;
}
}
diff --git a/src/persistence_client_library_dbus_service.c b/src/persistence_client_library_dbus_service.c
index e802714..abca25c 100644
--- a/src/persistence_client_library_dbus_service.c
+++ b/src/persistence_client_library_dbus_service.c
@@ -20,8 +20,10 @@
#include "persistence_client_library_dbus_service.h"
#include "persistence_client_library_lc_interface.h"
#include "persistence_client_library_pas_interface.h"
+#include "persistence_client_library_dbus_cmd.h"
#include "../include_protected/persistence_client_library_data_organization.h"
+
#include <stdio.h>
#include <errno.h>
#include <string.h>
diff --git a/src/persistence_client_library_key.c b/src/persistence_client_library_key.c
index a080a1e..2c212e0 100644
--- a/src/persistence_client_library_key.c
+++ b/src/persistence_client_library_key.c
@@ -29,6 +29,11 @@
#include "persistence_client_library_custom_loader.h"
+// function declaration
+int handleRegNotifyOnChange(int key_handle, pclChangeNotifyCallback_t callback, PersNotifyRegPolicy_e regPolicy);
+int regNotifyOnChange(unsigned int ldbid, const char* resource_id, unsigned int user_no, unsigned int seat_no,
+ pclChangeNotifyCallback_t callback, PersNotifyRegPolicy_e regPolicy);
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// function with handle
diff --git a/src/persistence_client_library_prct_access.c b/src/persistence_client_library_prct_access.c
index 6dac0e1..d1158ca 100644
--- a/src/persistence_client_library_prct_access.c
+++ b/src/persistence_client_library_prct_access.c
@@ -26,7 +26,7 @@
/// pointer to resource table database
-itzam_btree gResource_table[PrctDbTableSize] = {0};
+itzam_btree gResource_table[PrctDbTableSize] = {{0}};
/// array to hold the information of database is already open
int gResourceOpen[PrctDbTableSize] = {0};
diff --git a/test/persistence_client_library_test.c b/test/persistence_client_library_test.c
index fbb36ba..6cf1da1 100644
--- a/test/persistence_client_library_test.c
+++ b/test/persistence_client_library_test.c
@@ -694,7 +694,7 @@ START_TEST(test_DataHandle)
X_TEST_REPORT_DESCRIPTION("Test of data handle");
X_TEST_REPORT_TYPE(GOOD);
- int handle1 = 0, handle2 = 0, size = 0;
+ int handle1 = 0, handle2 = 0;
int handleArray[4] = {0};
int ret = 0;
unsigned char buffer[READ_SIZE] = {0};
@@ -729,22 +729,22 @@ START_TEST(test_DataHandle)
handleArray[3] = pclFileOpen(0xFF, "media/mediaDB_write_04.db", 1, 1);
x_fail_unless(handle1 != -1, "Could not open file ==> /media/mediaDB_write_04.db");
- size = pclFileReadData(handleArray[0], buffer, READ_SIZE);
+ (void)pclFileReadData(handleArray[0], buffer, READ_SIZE);
x_fail_unless(strncmp((char*)buffer, "/user/1/seat/1/media/mediaDB_write_01.db",
strlen("/user/1/seat/1/media/mediaDB_write_01.db"))
== 0, "Buffer not correctly read => mediaDB_write_01.db");
- size = pclFileReadData(handleArray[1], buffer, READ_SIZE);
+ (void)pclFileReadData(handleArray[1], buffer, READ_SIZE);
x_fail_unless(strncmp((char*)buffer, "/user/1/seat/1/media/mediaDB_write_02.db",
strlen("/user/1/seat/1/media/mediaDB_write_02.db"))
== 0, "Buffer not correctly read => mediaDB_write_02.db");
- size = pclFileReadData(handleArray[2], buffer, READ_SIZE);
+ (void)pclFileReadData(handleArray[2], buffer, READ_SIZE);
x_fail_unless(strncmp((char*)buffer, "/user/1/seat/1/media/mediaDB_write_03.db",
strlen("/user/1/seat/1/media/mediaDB_write_03.db"))
== 0, "Buffer not correctly read => mediaDB_write_03.db");
- size = pclFileReadData(handleArray[3], buffer, READ_SIZE);
+ (void)pclFileReadData(handleArray[3], buffer, READ_SIZE);
x_fail_unless(strncmp((char*)buffer, "/user/1/seat/1/media/mediaDB_write_04.db",
strlen("/user/1/seat/1/media/mediaDB_write_04.db"))
== 0, "Buffer not correctly read => mediaDB_write_04.db");
@@ -1082,23 +1082,23 @@ END_TEST
START_TEST(test_InitDeinit)
{
- int ret = 0, i = 0;
+ int i = 0;
unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
for(i=0; i< 3; i++)
{
// initialize and deinitialize 1. time
- ret = pclInitLibrary(gTheAppId, shutdownReg);
+ (void)pclInitLibrary(gTheAppId, shutdownReg);
pclDeinitLibrary();
// initialize and deinitialize 2. time
- ret = pclInitLibrary(gTheAppId, shutdownReg);
+ (void)pclInitLibrary(gTheAppId, shutdownReg);
pclDeinitLibrary();
// initialize and deinitialize 3. time
- ret = pclInitLibrary(gTheAppId, shutdownReg);
+ (void)pclInitLibrary(gTheAppId, shutdownReg);
pclDeinitLibrary();
}
}
@@ -1182,8 +1182,8 @@ int main(int argc, char *argv[])
{
int nr_failed = 0,
nr_run = 0,
- fail = 0,
i = 0;
+ //int fail = 0;
TestResult** tResult;
@@ -1207,7 +1207,8 @@ int main(int argc, char *argv[])
tResult = srunner_results(sr);
for(i = 0; i< nr_run; i++)
{
- fail = tr_rtype(tResult[i]); // get status of each test
+ (void)tr_rtype(tResult[i]); // get status of each test
+ //fail = tr_rtype(tResult[i]); // get status of each test
//printf("[%d] Fail: %d \n", i, fail);
}