Removed compiler warnings
authorIngo Huerner <ingo.huerner@xse.de>
Mon, 10 Feb 2014 13:18:32 +0000 (14:18 +0100)
committerIngo Huerner <ingo.huerner@xse.de>
Mon, 10 Feb 2014 13:18:32 +0000 (14:18 +0100)
src/persistence_client_library.c
src/persistence_client_library_backup_filelist.c
src/persistence_client_library_backup_filelist.h
src/persistence_client_library_db_access.c
src/persistence_client_library_dbus_cmd.c
src/persistence_client_library_dbus_service.c
src/persistence_client_library_key.c
src/persistence_client_library_prct_access.c
test/persistence_client_library_test.c

index 868db91..38da6c8 100644 (file)
@@ -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>
index 5a44212..c72b739 100644 (file)
@@ -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)
    {
index 65a6a3c..896981b 100644 (file)
@@ -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 */
index 8c10ae9..443aab4 100644 (file)
@@ -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;
index b9a99b4..c8a138c 100644 (file)
 #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;
    }
 }
 
index e802714..abca25c 100644 (file)
 #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>
index a080a1e..2c212e0 100644 (file)
 #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
index 6dac0e1..d1158ca 100644 (file)
@@ -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};
 
index fbb36ba..6cf1da1 100644 (file)
@@ -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);
    }