summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Novacek <rnovacek@redhat.com>2013-07-25 10:11:50 +0200
committerRadek Novacek <rnovacek@redhat.com>2013-07-25 10:11:50 +0200
commit3c7dbda737bdbd6bbd46fe8f06afb9954c19a548 (patch)
tree4bb093207aba4a17fd487ccb26260e2de38e82d6
parentc5767ebb8f72494bd422636cea462c41679e7f69 (diff)
downloadopenlmi-providers-3c7dbda737bdbd6bbd46fe8f06afb9954c19a548.tar.gz
openlmi-providers-3c7dbda737bdbd6bbd46fe8f06afb9954c19a548.tar.xz
openlmi-providers-3c7dbda737bdbd6bbd46fe8f06afb9954c19a548.zip
Silence many compilation warnings
Mostly deprecation warnings and wrong 'const' handling.
-rw-r--r--src/account/LMI_AccountManagementServiceProvider.c9
-rw-r--r--src/account/LMI_AccountProvider.c4
-rw-r--r--src/account/LMI_MemberOfGroupProvider.c6
-rw-r--r--src/account/aux_lu.c2
-rw-r--r--src/account/aux_lu.h5
-rw-r--r--src/logicalfile/LMI_UnixDeviceFileProvider.c2
-rw-r--r--src/power/power.c6
-rw-r--r--src/service-dbus/util/serviceutil.c6
8 files changed, 28 insertions, 12 deletions
diff --git a/src/account/LMI_AccountManagementServiceProvider.c b/src/account/LMI_AccountManagementServiceProvider.c
index b01f5a3..5995c11 100644
--- a/src/account/LMI_AccountManagementServiceProvider.c
+++ b/src/account/LMI_AccountManagementServiceProvider.c
@@ -233,7 +233,8 @@ KUint32 LMI_AccountManagementService_CreateGroup(
struct lu_error *error = NULL;
struct lu_ent *lue = NULL;
GValue value;
- const char *nameSpace = LMI_AccountManagementServiceRef_NameSpace(self);
+ const char *nameSpace = LMI_AccountManagementServiceRef_NameSpace(
+ (LMI_AccountManagementServiceRef *) self);
CMPIEnumeration *instances = NULL;
LMI_GroupRef Groupref;
LMI_IdentityRef Identityref;
@@ -357,9 +358,11 @@ KUint32 LMI_AccountManagementService_CreateAccount(
GValue val;
int create_group = 0;
gid_t gid = LU_VALUE_INVALID_ID, uid = LU_VALUE_INVALID_ID;
- char *group_name = NULL, *home = NULL, *instanceid = NULL;
+ char *group_name = NULL, *instanceid = NULL;
+ const char *home = NULL;
- const char *nameSpace = LMI_AccountManagementServiceRef_NameSpace(self);
+ const char *nameSpace = LMI_AccountManagementServiceRef_NameSpace(
+ (LMI_AccountManagementServiceRef *) self);
const char *hostname = get_system_name();
CMPIStatus st;
CMPIEnumeration *instances = NULL;
diff --git a/src/account/LMI_AccountProvider.c b/src/account/LMI_AccountProvider.c
index d7b0dac..9727923 100644
--- a/src/account/LMI_AccountProvider.c
+++ b/src/account/LMI_AccountProvider.c
@@ -84,7 +84,7 @@ static CMPIStatus LMI_AccountEnumInstances(
long last_change, min_lifetime, max_lifetime, warn, inactive, expire;
time_t last_login;
CMPIStatus *rc = NULL;
- char *password = NULL;
+ const char *password = NULL;
luc = lu_start(NULL, lu_user, NULL, NULL, lu_prompt_console_quiet, NULL, &error);
if (!luc)
@@ -238,7 +238,7 @@ static CMPIStatus LMI_AccountModifyInstance(
* Set up account expiration
* Set up password expiration
*/
- char* value = NULL, *password = NULL;
+ const char* value = NULL, *password = NULL;
CMPIString* vs = NULL;
CMPIArray* ar = NULL; int arsize;/* used for password */
CMPIData data;
diff --git a/src/account/LMI_MemberOfGroupProvider.c b/src/account/LMI_MemberOfGroupProvider.c
index beb5edd..60259b8 100644
--- a/src/account/LMI_MemberOfGroupProvider.c
+++ b/src/account/LMI_MemberOfGroupProvider.c
@@ -159,8 +159,8 @@ static CMPIStatus LMI_MemberOfGroupCreateInstance(
LMI_MemberOfGroup lmog;
LMI_Account la;
- char *group_name = NULL;
- char *user_name = NULL;
+ const char *group_name = NULL;
+ const char *user_name = NULL;
GValue val;
struct lu_context *luc = NULL;
@@ -246,7 +246,7 @@ static CMPIStatus LMI_MemberOfGroupDeleteInstance(
struct lu_ent *lue_u = lu_ent_new();
struct lu_error *error = NULL;
- char *group_name = NULL;
+ const char *group_name = NULL;
uid_t user_id = -1;
GValueArray *groups = NULL;
unsigned int i = 0; /* iterator */
diff --git a/src/account/aux_lu.c b/src/account/aux_lu.c
index 6059665..3b9f047 100644
--- a/src/account/aux_lu.c
+++ b/src/account/aux_lu.c
@@ -28,7 +28,7 @@
* Get the value of type from the given entity
* returns string
*/
-char* aux_lu_get_str(struct lu_ent* ent, char* type)
+const char* aux_lu_get_str(struct lu_ent* ent, char* type)
{
return g_value_get_string(g_value_array_get_nth(lu_ent_get(ent, type), 0));
}
diff --git a/src/account/aux_lu.h b/src/account/aux_lu.h
index 91383d4..338adef 100644
--- a/src/account/aux_lu.h
+++ b/src/account/aux_lu.h
@@ -21,10 +21,13 @@
#ifndef AUX_LU_H
#define AUX_LU_H
+// for GValueArray
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include <libuser/entity.h>
#include <libuser/user.h>
-char* aux_lu_get_str(struct lu_ent*, char*);
+const char* aux_lu_get_str(struct lu_ent*, char*);
long aux_lu_get_long(struct lu_ent*, char*);
/* Get the latest login time for given user name */
diff --git a/src/logicalfile/LMI_UnixDeviceFileProvider.c b/src/logicalfile/LMI_UnixDeviceFileProvider.c
index e8aa7dd..4d09efa 100644
--- a/src/logicalfile/LMI_UnixDeviceFileProvider.c
+++ b/src/logicalfile/LMI_UnixDeviceFileProvider.c
@@ -69,7 +69,7 @@ static CMPIStatus LMI_UnixDeviceFileGetInstance(
path = KChars(lmi_file.Name.value);
fill_basic(UnixDeviceFile, path, S_IFCHR | S_IFBLK, "No such device: %s");
- sprintf(tmp, "%u", sb.st_rdev);
+ sprintf(tmp, "%lu", sb.st_rdev);
LMI_UnixDeviceFile_Set_DeviceId(&lmi_file, tmp);
sprintf(tmp, "%u", major(sb.st_rdev));
LMI_UnixDeviceFile_Set_DeviceMajor(&lmi_file, tmp);
diff --git a/src/power/power.c b/src/power/power.c
index 96494dc..9629dcf 100644
--- a/src/power/power.c
+++ b/src/power/power.c
@@ -29,6 +29,8 @@
#include "LMI_PowerConcreteJob.h"
#ifdef HAS_UPOWER
+// TODO: port to logind
+#define UPOWER_ENABLE_DEPRECATED
#include <upower.h>
#endif
@@ -94,8 +96,10 @@ Power *power_new(const CMPIBroker *_cb)
power->transitioningToPowerState = LMI_AssociatedPowerManagementService_TransitioningToPowerState_No_Change;
power->mutex = _cb->xft->newMutex(0);
power->jobs = NULL;
-#ifdef HAS_UPOWER
+#if !defined(GLIB_VERSION_2_36)
g_type_init();
+#endif
+#ifdef HAS_UPOWER
power->up = up_client_new();
#endif
return power;
diff --git a/src/service-dbus/util/serviceutil.c b/src/service-dbus/util/serviceutil.c
index 685f7a7..b4b6d0c 100644
--- a/src/service-dbus/util/serviceutil.c
+++ b/src/service-dbus/util/serviceutil.c
@@ -64,7 +64,9 @@ SList *service_find_all(void)
gchar *primary_unit_name = NULL;
char *tmps = NULL;
+#if !defined(GLIB_VERSION_2_36)
g_type_init();
+#endif
manager_proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
NULL, MANAGER_NAME, MANAGER_OP, MANAGER_INTERFACE, NULL, &error);
@@ -128,7 +130,9 @@ int service_get_properties(
gchar *unit, *value_str;
unsigned long value_long;
+#if !defined(GLIB_VERSION_2_36)
g_type_init();
+#endif
svc->svName = strdup(service);
if (!svc->svName) return 0;
@@ -251,7 +255,9 @@ unsigned int service_operation(
GError *error = NULL;
GVariantBuilder *builder;
+#if !defined(GLIB_VERSION_2_36)
g_type_init();
+#endif
manager_proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
NULL, MANAGER_NAME, MANAGER_OP, MANAGER_INTERFACE, NULL, &error);