diff options
-rw-r--r-- | liblazy/liblazy.h | 22 | ||||
-rw-r--r-- | liblazy/liblazy_hal.c | 29 |
2 files changed, 27 insertions, 24 deletions
diff --git a/liblazy/liblazy.h b/liblazy/liblazy.h index d85e4c4..c71a5c9 100644 --- a/liblazy/liblazy.h +++ b/liblazy/liblazy.h @@ -141,8 +141,7 @@ int liblazy_dbus_session_send_signal(const char *path, const char *interface, * * @return 0 on success, LIBLAZY_ERROR_* on failure */ -int liblazy_dbus_message_get_basic_arg(DBusMessage *message, int type, - void *arg, int no); +int liblazy_dbus_message_get_basic_arg(DBusMessage *message, int type, void *arg, int no); /** @brief get a array argument from a DBusMessage as a string list * @@ -154,8 +153,7 @@ int liblazy_dbus_message_get_basic_arg(DBusMessage *message, int type, * * @return 0 on success, LIBLAZY_ERROR_* on failure */ -int liblazy_dbus_message_get_strlist_arg(DBusMessage *message, - char ***strlist, int no); +int liblazy_dbus_message_get_strlist_arg(DBusMessage *message, char ***strlist, int no); /** @brief use a private connection for system bus messages * @@ -183,7 +181,7 @@ void liblazy_dbus_system_use_private_connection(int use_private); * * @return 0 on success, LIBLAZY_ERROR_* on failure */ -int liblazy_hal_get_property_int(char *udi, char *property, int *value); +int liblazy_hal_get_property_int(const char *udi, const char *property, int *value); /** @brief get boolean property from HAL * @@ -195,7 +193,7 @@ int liblazy_hal_get_property_int(char *udi, char *property, int *value); * * @return 0 on success, LIBLAZY_ERROR_* on failure */ -int liblazy_hal_get_property_bool(char *udi, char *property, int *value); +int liblazy_hal_get_property_bool(const char *udi, const char *property, int *value); /** @brief get string property from HAL * @@ -207,7 +205,7 @@ int liblazy_hal_get_property_bool(char *udi, char *property, int *value); * * @return 0 on success, LIBLAZY_ERROR_* on failure */ -int liblazy_hal_get_property_string(char *udi, char *property, char **value); +int liblazy_hal_get_property_string(const char *udi, const char *property, char **value); /** @brief get string list property from HAL * @@ -220,7 +218,7 @@ int liblazy_hal_get_property_string(char *udi, char *property, char **value); * * @return 0 on success, LIBLAZY_ERROR_* on failure */ -int liblazy_hal_get_property_strlist(char *udi, char *property, char ***strlist); +int liblazy_hal_get_property_strlist(const char *udi, const char *property, char ***strlist); /** @brief check if a device has a capability * @@ -230,7 +228,7 @@ int liblazy_hal_get_property_strlist(char *udi, char *property, char ***strlist) * @return 1 if the device possesses the capability, 0 if not and * LIBLAZY_ERROR_* on failure */ -int liblazy_hal_query_capability(char *udi, char *capability); +int liblazy_hal_query_capability(const char *udi, const char *capability); /** @brief find devices with a given capability * @@ -240,7 +238,7 @@ int liblazy_hal_query_capability(char *udi, char *capability); * * @return 0 on success, LIBLAZY_ERROR_* on failure */ -int liblazy_hal_find_device_by_capability(char *capability, char ***strlist); +int liblazy_hal_find_device_by_capability(const char *capability, char ***strlist); /** @brief find devices with given key and value * @@ -251,7 +249,7 @@ int liblazy_hal_find_device_by_capability(char *capability, char ***strlist); * * @return 0 on success, LIBLAZY_ERROR_* on failure */ -int liblazy_hal_find_device_by_string_match(char *key, char *value, char ***strlist); +int liblazy_hal_find_device_by_string_match(const char *key, const char *value, char ***strlist); /** @brief check if a user possesses a privilege * @@ -262,7 +260,7 @@ int liblazy_hal_find_device_by_string_match(char *key, char *value, char ***strl * * @return 1 if the caller is privileged, 0 if not, and LIBLAZY_ERROR_* on failure */ -int liblazy_hal_is_caller_privileged(char *privilege); +int liblazy_hal_is_caller_privileged(const char *privilege); #ifdef __cplusplus } diff --git a/liblazy/liblazy_hal.c b/liblazy/liblazy_hal.c index b9a2694..9d94170 100644 --- a/liblazy/liblazy_hal.c +++ b/liblazy/liblazy_hal.c @@ -36,7 +36,7 @@ #define DBUS_HAL_MANAGER_INTERFACE "org.freedesktop.Hal.Manager" #define DBUS_HAL_COMPUTER_PATH "/org/freedesktop/Hal/devices/computer" -static int liblazy_hal_property_exists(char *udi, char *property) +static int liblazy_hal_property_exists(const char *udi, const char *property) { int error = 0; int exists = 0; @@ -68,8 +68,8 @@ static int liblazy_hal_property_exists(char *udi, char *property) return error; } -static int liblazy_hal_get_property(char *udi, char *property, char *method, - int type, void *value) +static int liblazy_hal_get_property(const char *udi, const char *property, + const char *method, int type, void *value) { int error = 0; DBusMessage *reply; @@ -99,7 +99,7 @@ static int liblazy_hal_get_property(char *udi, char *property, char *method, return error; } -static int liblazy_hal_get_strlist_manager(char ***strlist, char *method, +static int liblazy_hal_get_strlist_manager(char ***strlist, const char *method, int first_arg_type, ...) { int error = 0; @@ -129,7 +129,8 @@ static int liblazy_hal_get_strlist_manager(char ***strlist, char *method, return error; } -int liblazy_hal_get_property_string(char *udi, char *property, char **value) +int liblazy_hal_get_property_string(const char *udi, const char *property, + char **value) { char *str; int ret; @@ -153,7 +154,8 @@ Error: return ret; } -int liblazy_hal_get_property_int(char *udi, char *property, int *value) +int liblazy_hal_get_property_int(const char *udi, const char *property, + int *value) { int ret; @@ -169,7 +171,8 @@ int liblazy_hal_get_property_int(char *udi, char *property, int *value) DBUS_TYPE_INT32, value); } -int liblazy_hal_get_property_bool(char *udi, char *property, int *value) +int liblazy_hal_get_property_bool(const char *udi, const char *property, + int *value) { int ret; @@ -185,7 +188,8 @@ int liblazy_hal_get_property_bool(char *udi, char *property, int *value) DBUS_TYPE_BOOLEAN, value); } -int liblazy_hal_get_property_strlist(char *udi, char *property, char ***strlist) +int liblazy_hal_get_property_strlist(const char *udi, const char *property, + char ***strlist) { int error = 0; DBusMessage *reply; @@ -226,7 +230,7 @@ Error: return error; } -int liblazy_hal_query_capability(char *udi, char *capability) +int liblazy_hal_query_capability(const char *udi, const char *capability) { int i; int error = -1; @@ -250,7 +254,7 @@ int liblazy_hal_query_capability(char *udi, char *capability) return error; } -int liblazy_hal_find_device_by_capability(char *capability, char ***strlist) +int liblazy_hal_find_device_by_capability(const char *capability, char ***strlist) { int error; error = liblazy_hal_get_strlist_manager(strlist, "FindDeviceByCapability", @@ -264,7 +268,8 @@ int liblazy_hal_find_device_by_capability(char *capability, char ***strlist) } -int liblazy_hal_find_device_by_string_match(char *key, char *value, char ***strlist) +int liblazy_hal_find_device_by_string_match(const char *key, const char *value, + char ***strlist) { int error; error = liblazy_hal_get_strlist_manager(strlist, "FindDeviceStringMatch", @@ -277,7 +282,7 @@ int liblazy_hal_find_device_by_string_match(char *key, char *value, char ***strl return error; } -int liblazy_hal_is_caller_privileged(char *privilege) +int liblazy_hal_is_caller_privileged(const char *privilege) { DBusMessage *reply; DBusError dbus_error; |