aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-10-16 16:24:32 -0700
committerGuy Harris <guy@alum.mit.edu>2015-10-16 23:27:20 +0000
commit4695ea20cc8f241c5b2ae0e6fc380cc583ee5050 (patch)
tree3488e1dda7d07af9b8d5fecbeef5c05cf722ea65
parentb05803db4b7079307565e423a8caf828949add49 (diff)
Add DEGREE SIGN character to utf8_entities.h and use it.
Add a #define giving the UTF-8 sequence for DEGREE SIGN, and use it in packet-synphasor.c rather than having it define its own version. Use it in some other places rather than a string of two octal values. Change-Id: Ic0f3b23ae0165c9824d89304d683f45bce31dced Reviewed-on: https://code.wireshark.org/review/11102 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--epan/dissectors/packet-lisp.c11
-rw-r--r--epan/dissectors/packet-synphasor.c6
-rw-r--r--epan/dissectors/packet-zbee-zcl-meas-sensing.c10
-rw-r--r--wsutil/utf8_entities.h1
4 files changed, 17 insertions, 11 deletions
diff --git a/epan/dissectors/packet-lisp.c b/epan/dissectors/packet-lisp.c
index 30ae2055e7..cf0dcd4a5f 100644
--- a/epan/dissectors/packet-lisp.c
+++ b/epan/dissectors/packet-lisp.c
@@ -30,6 +30,9 @@
#include <epan/to_str.h>
#include <epan/afn.h>
#include <epan/expert.h>
+
+#include <wsutil/utf8_entities.h>
+
void proto_register_lisp(void);
void proto_reg_handoff_lisp(void);
@@ -1011,9 +1014,9 @@ dissect_lcaf_geo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offse
"Invalid latitude seconds value (%d)", min);
offset += 1;
- proto_item_append_text(ti_lat, ": %s %d\302\260 %d' %d\"",
+ proto_item_append_text(ti_lat, ": %s %d" UTF8_DEGREE_SIGN "%d' %d\"",
val_to_str_const(north, lat_typevals, ""), deg, min, sec);
- proto_item_append_text(tir, ": (%s%d\302\260%d'%d\"",
+ proto_item_append_text(tir, ": (%s%d" UTF8_DEGREE_SIGN "%d'%d\"",
val_to_str_const(north, lat_typevals, ""), deg, min, sec);
/* PROCESS LONGITUDE */
@@ -1048,9 +1051,9 @@ dissect_lcaf_geo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offse
"Invalid longitude seconds value (%d)", min);
offset += 1;
- proto_item_append_text(ti_lon, ": %s %d\302\260 %d' %d\"",
+ proto_item_append_text(ti_lon, ": %s %d" UTF8_DEGREE_SIGN " %d' %d\"",
val_to_str_const(east, lon_typevals, ""), deg, min, sec);
- proto_item_append_text(tir, ", %s%d\302\260%d'%d\")",
+ proto_item_append_text(tir, ", %s%d" UTF8_DEGREE_SIGN "%d'%d\")",
val_to_str_const(east, lon_typevals, ""), deg, min, sec);
/* PROCESS ALTITUDE */
diff --git a/epan/dissectors/packet-synphasor.c b/epan/dissectors/packet-synphasor.c
index 0eb7224f77..d192623170 100644
--- a/epan/dissectors/packet-synphasor.c
+++ b/epan/dissectors/packet-synphasor.c
@@ -32,6 +32,8 @@
#include <epan/expert.h>
#include "packet-tcp.h"
+#include <wsutil/utf8_entities.h>
+
#define PROTOCOL_NAME "IEEE C37.118 Synchrophasor Protocol"
#define PROTOCOL_SHORT_NAME "SYNCHROPHASOR"
#define PROTOCOL_ABBREV "synphasor"
@@ -947,14 +949,12 @@ static gint dissect_PHASORS(tvbuff_t *tvb, proto_tree *tree, config_block *block
mag = (mag * pi->conv) * 0.00001;
#define SYNP_ANGLE "/_"
- #define SYNP_DEGREE "\xC2\xB0" /* DEGREE signs in UTF-8 */
- proto_item_append_text(temp_item, ", %10.2f%c" SYNP_ANGLE "%7.2f" SYNP_DEGREE,
+ proto_item_append_text(temp_item, ", %10.2f%c" SYNP_ANGLE "%7.2f" UTF8_DEGREE_SIGN,
mag,
V == pi->unit ? 'V' : 'A',
phase *180.0/G_PI);
#undef SYNP_ANGLE
- #undef SYNP_DEGREE
}
return offset;
}
diff --git a/epan/dissectors/packet-zbee-zcl-meas-sensing.c b/epan/dissectors/packet-zbee-zcl-meas-sensing.c
index 31ab313e2f..49ac1dfabd 100644
--- a/epan/dissectors/packet-zbee-zcl-meas-sensing.c
+++ b/epan/dissectors/packet-zbee-zcl-meas-sensing.c
@@ -29,6 +29,8 @@
#include <math.h>
#include <epan/packet.h>
+#include <wsutil/utf8_entities.h>
+
#include "packet-zbee.h"
#include "packet-zbee-aps.h"
#include "packet-zbee-zcl.h"
@@ -533,7 +535,7 @@ decode_temp_meas_value(gchar *s, gint16 value)
if (value == (gint16)ZBEE_ZCL_ATTR_ID_TEMP_MEAS_INVALID_VALUE)
g_snprintf(s, ITEM_LABEL_LENGTH, "Invalid value");
else
- g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f [\302\260C]", value/100.0);
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f [" UTF8_DEGREE_SIGN "C]", value/100.0);
return;
} /*decode_temp_meas_value*/
@@ -557,7 +559,7 @@ decode_temp_meas_min_value(gchar *s, gint16 value)
(value > (gint16)ZBEE_ZCL_ATTR_ID_TEMP_MEAS_MIN_HI_VALUE) )
g_snprintf(s, ITEM_LABEL_LENGTH, "Out of range");
else
- g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f [\302\260C]", value/100.0);
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f [" UTF8_DEGREE_SIGN "C]", value/100.0);
return;
} /*decode_temp_meas_min_value*/
@@ -580,7 +582,7 @@ decode_temp_meas_max_value(gchar *s, gint16 value)
if (value < (gint16)ZBEE_ZCL_ATTR_ID_TEMP_MEAS_MAX_LO_VALUE)
g_snprintf(s, ITEM_LABEL_LENGTH, "Out of range");
else
- g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f [\302\260C]", value/100.0);
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%.2f [" UTF8_DEGREE_SIGN "C]", value/100.0);
return;
} /*decode_temp_meas_max_value*/
@@ -603,7 +605,7 @@ decode_temp_meas_tolerance(gchar *s, guint16 value)
if (value > ZBEE_ZCL_ATTR_ID_TEMP_MEAS_TOL_HI_VALUE)
g_snprintf(s, ITEM_LABEL_LENGTH, "Out of range");
else
- g_snprintf(s, ITEM_LABEL_LENGTH, "%d.%d [\302\260C]", value/100, value%100);
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%d.%d [" UTF8_DEGREE_SIGN "C]", value/100, value%100);
return;
} /*decode_temp_meas_tolerance*/
diff --git a/wsutil/utf8_entities.h b/wsutil/utf8_entities.h
index 0fab083674..62254c1736 100644
--- a/wsutil/utf8_entities.h
+++ b/wsutil/utf8_entities.h
@@ -31,6 +31,7 @@
* and other places
*/
+#define UTF8_DEGREE_SIGN "\xc2\xb0" /* 176 / 0xb0 */
#define UTF8_MIDDLE_DOT "\xc2\xb7" /* 183 / 0xb7 */
#define UTF8_BULLET "\xe2\x80\xa2" /* 8226 / 0x2024 */