mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 16:50:16 +01:00
cli: merge branch 'th/clients-meta-cleanup-bgo782943'
https://bugzilla.gnome.org/show_bug.cgi?id=782943
This commit is contained in:
commit
260fd3e79f
5 changed files with 604 additions and 1094 deletions
|
|
@ -21,35 +21,11 @@
|
|||
|
||||
#include "nm-client-utils.h"
|
||||
|
||||
/*
|
||||
* Convert string to signed integer.
|
||||
* If required, the resulting number is checked to be in the <min,max> range.
|
||||
*/
|
||||
gboolean
|
||||
nmc_string_to_int_base (const char *str,
|
||||
int base,
|
||||
gboolean range_check,
|
||||
long int min,
|
||||
long int max,
|
||||
long int *value)
|
||||
{
|
||||
char *end;
|
||||
long int tmp;
|
||||
|
||||
errno = 0;
|
||||
tmp = strtol (str, &end, base);
|
||||
if (errno || *end != '\0' || (range_check && (tmp < min || tmp > max))) {
|
||||
return FALSE;
|
||||
}
|
||||
*value = tmp;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert string to unsigned integer.
|
||||
* If required, the resulting number is checked to be in the <min,max> range.
|
||||
*/
|
||||
gboolean
|
||||
static gboolean
|
||||
nmc_string_to_uint_base (const char *str,
|
||||
int base,
|
||||
gboolean range_check,
|
||||
|
|
@ -69,16 +45,6 @@ nmc_string_to_uint_base (const char *str,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nmc_string_to_int (const char *str,
|
||||
gboolean range_check,
|
||||
long int min,
|
||||
long int max,
|
||||
long int *value)
|
||||
{
|
||||
return nmc_string_to_int_base (str, 10, range_check, min, max, value);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nmc_string_to_uint (const char *str,
|
||||
gboolean range_check,
|
||||
|
|
|
|||
|
|
@ -33,23 +33,6 @@ const char *nmc_string_is_valid (const char *input, const char **allowed, GError
|
|||
|
||||
char **nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens);
|
||||
|
||||
gboolean nmc_string_to_int_base (const char *str,
|
||||
int base,
|
||||
gboolean range_check,
|
||||
long int min,
|
||||
long int max,
|
||||
long int *value);
|
||||
gboolean nmc_string_to_uint_base (const char *str,
|
||||
int base,
|
||||
gboolean range_check,
|
||||
unsigned long int min,
|
||||
unsigned long int max,
|
||||
unsigned long int *value);
|
||||
gboolean nmc_string_to_int (const char *str,
|
||||
gboolean range_check,
|
||||
long int min,
|
||||
long int max,
|
||||
long int *value);
|
||||
gboolean nmc_string_to_uint (const char *str,
|
||||
gboolean range_check,
|
||||
unsigned long int min,
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -225,6 +225,11 @@ struct _NMMetaPropertyType {
|
|||
|
||||
struct _NMUtilsEnumValueInfo;
|
||||
|
||||
typedef struct {
|
||||
const char *nick;
|
||||
gint64 value;
|
||||
} NMMetaUtilsIntValueInfo;
|
||||
|
||||
struct _NMMetaPropertyTypData {
|
||||
union {
|
||||
struct {
|
||||
|
|
@ -235,7 +240,21 @@ struct _NMMetaPropertyTypData {
|
|||
int min;
|
||||
int max;
|
||||
const struct _NMUtilsEnumValueInfo *value_infos;
|
||||
void (*pre_set_notify) (const NMMetaPropertyInfo *property_info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
NMSetting *setting,
|
||||
int value);
|
||||
} gobject_enum;
|
||||
struct {
|
||||
gint64 min;
|
||||
gint64 max;
|
||||
guint base;
|
||||
const NMMetaUtilsIntValueInfo *value_infos;
|
||||
} gobject_int;
|
||||
struct {
|
||||
const char *(*validate_fcn) (const char *value, char **out_to_free, GError **error);
|
||||
} gobject_string;
|
||||
struct {
|
||||
guint32 (*get_fcn) (NMSetting *setting);
|
||||
} mtu;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ typedef enum {
|
|||
NM_WEP_KEY_TYPE_KEY = 1, /* Hex or ASCII */
|
||||
NM_WEP_KEY_TYPE_PASSPHRASE = 2, /* 104/128-bit Passphrase */
|
||||
|
||||
NM_WEP_KEY_TYPE_LAST = NM_WEP_KEY_TYPE_PASSPHRASE
|
||||
NM_WEP_KEY_TYPE_LAST = NM_WEP_KEY_TYPE_PASSPHRASE, /*< skip >*/
|
||||
} NMWepKeyType;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue