diff options
author | Michal Labedzki <michal.labedzki@tieto.com> | 2015-02-05 11:57:27 +0100 |
---|---|---|
committer | Michal Labedzki <michal.labedzki@tieto.com> | 2015-02-21 17:29:05 +0000 |
commit | b8388c6a210f752817a1a68e882127046d499978 (patch) | |
tree | 56e424d64b840ad85b4de2441a61957294ee8a3c /epan/ftypes | |
parent | 9ad00fdcb809971ce76487679bfdedbd73433a94 (diff) |
Ftypes: Double: Minor fixes
Fix comments typos and use safe equivalent of sprintf.
Change-Id: Icc9d69532dc35e8a58a78c0eacdb42214b679069
Reviewed-on: https://code.wireshark.org/review/7290
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan/ftypes')
-rw-r--r-- | epan/ftypes/ftype-double.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/epan/ftypes/ftype-double.c b/epan/ftypes/ftype-double.c index bb5a2e475c..1eb3c103d0 100644 --- a/epan/ftypes/ftype-double.c +++ b/epan/ftypes/ftype-double.c @@ -28,6 +28,8 @@ #include "strutil.h" +#define DOUBLE_REPR_LENGTH 27 + static void double_fvalue_new(fvalue_t *fv) { @@ -89,13 +91,13 @@ float_val_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_, int field_display _U_) * XXX - smaller for float than for double? * XXX - can we compute it from FLT_DIG and the like? */ - return 1 + 26; + return DOUBLE_REPR_LENGTH; } static void float_val_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *buf) { - sprintf(buf, "%." G_STRINGIFY(FLT_DIG) "g", fv->value.floating); + g_snprintf(buf, DOUBLE_REPR_LENGTH, "%." G_STRINGIFY(FLT_DIG) "g", fv->value.floating); } static int @@ -107,13 +109,13 @@ double_val_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_, int field_display _U_) * XXX - is that platform-dependent? * XXX - can we compute it from DBL_DIG and the like? */ - return 1 + 26; + return DOUBLE_REPR_LENGTH; } static void double_val_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char *buf) { - sprintf(buf, "%." G_STRINGIFY(DBL_DIG) "g", fv->value.floating); + g_snprintf(buf, DOUBLE_REPR_LENGTH, "%." G_STRINGIFY(DBL_DIG) "g", fv->value.floating); } static gboolean @@ -175,7 +177,7 @@ ftype_register_double(void) NULL, /* set_value_string */ NULL, /* set_value_tvbuff */ NULL, /* set_value_uinteger */ - NULL, /* set_value_snteger */ + NULL, /* set_value_sinteger */ NULL, /* set_value_uinteger64 */ NULL, /* set_value_sinteger64 */ double_fvalue_set_floating, /* set_value_floating */ @@ -227,7 +229,7 @@ ftype_register_double(void) NULL, /* get_value */ NULL, /* get_value_uinteger */ - NULL, /* get_value_snteger */ + NULL, /* get_value_sinteger */ NULL, /* get_value_uinteger64 */ NULL, /* get_value_sinteger64 */ value_get_floating, /* get_value_floating */ |