dcerpc-netlogon: remove unused variable
[wireshark-sm.git] / epan / unit_strings.c
blobadab41b8bb36195a2f9e11f0e9241c38a23e9b88
1 /* unit_strings.c
2 * Units to append to field values
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #include "config.h"
13 #include <wsutil/utf8_entities.h>
14 #include <wsutil/str_util.h>
15 #include "unit_strings.h"
17 /** Returns the unit string appropriate for the 32 bit value. */
18 const char* unit_name_string_get_value(uint32_t value, const unit_name_string* units)
20 if (units->plural == NULL)
21 return units->singular;
23 return plurality(value, units->singular, units->plural);
26 /** Returns the unit string appropriate for the 64 bit value. */
27 const char* unit_name_string_get_value64(uint64_t value, const unit_name_string* units)
29 if (units->plural == NULL)
30 return units->singular;
32 return plurality(value, units->singular, units->plural);
35 /** Returns the unit string appropriate for the double value. */
36 const char* unit_name_string_get_double(double value, const unit_name_string* units)
38 if (units->plural == NULL)
39 return units->singular;
41 return plurality(value, units->singular, units->plural);
45 * A default set of unit strings that dissectors can use for
46 * header fields. Some units intentionally have a space
47 * character in them for spacing between unit and value
49 const unit_name_string units_foot_feet = { " foot", " feet" };
50 const unit_name_string units_bit_bits = { " bit", " bits" };
51 const unit_name_string units_byte_bytes = { " byte", " bytes" };
52 const unit_name_string units_byte_bytespsecond = { " byte/s", " bytes/s" };
53 const unit_name_string units_octet_octets = { " octet", " octets" };
54 const unit_name_string units_word_words = { " word", " words" };
55 const unit_name_string units_tick_ticks = { " tick", " ticks" };
56 const unit_name_string units_meters = { "m", NULL };
57 const unit_name_string units_meter_meters = { " meter", " meters" };
58 const unit_name_string units_centimeters = { "cm", NULL };
59 const unit_name_string units_centimeter_centimeters = { " centimeter", " centimeters" };
60 const unit_name_string units_millimeters = { "mm", NULL };
61 const unit_name_string units_millimeter_millimeters = { " millimeter", " millimeters" };
62 const unit_name_string units_week_weeks = { " week", " weeks" };
63 const unit_name_string units_day_days = { " day", " days" };
64 const unit_name_string units_hour_hours = { " hour", " hours" };
65 const unit_name_string units_hours = { "h", NULL };
66 const unit_name_string units_minute_minutes = { " minute", " minutes" };
67 const unit_name_string units_minutes = { "min", NULL };
68 const unit_name_string units_second_seconds = { " second", " seconds" };
69 const unit_name_string units_seconds = { "s", NULL };
70 const unit_name_string units_millisecond_milliseconds = { " millisecond", " milliseconds" };
71 const unit_name_string units_milliseconds = { "ms", NULL };
72 const unit_name_string units_microsecond_microseconds = { " microsecond", " microseconds" };
73 const unit_name_string units_microseconds = { UTF8_MICRO_SIGN "s", NULL };
74 const unit_name_string units_nanosecond_nanoseconds = { " nanosecond", " nanoseconds" };
75 const unit_name_string units_nanoseconds = { "ns", NULL };
76 const unit_name_string units_nanometers = { "nm", NULL };
77 const unit_name_string units_degree_degrees = { " degree", " degrees" };
78 const unit_name_string units_degree_celsius = { UTF8_DEGREE_SIGN "C", NULL };
79 const unit_name_string units_degree_bearing = { UTF8_DEGREE_SIGN, NULL };
80 const unit_name_string units_centibels = { " cB", NULL };
81 const unit_name_string units_decibels = { " dB", NULL };
82 const unit_name_string units_dbm = { " dBm", NULL };
83 const unit_name_string units_dbi = { " dBi", NULL };
84 const unit_name_string units_dbhz = { " dB-Hz", NULL };
85 const unit_name_string units_mbm = { " mBm", NULL };
86 const unit_name_string units_percent = { "%", NULL };
87 const unit_name_string units_khz = { "kHz", NULL };
88 const unit_name_string units_mhz = { "MHz", NULL };
89 const unit_name_string units_ghz = { "GHz", NULL };
90 const unit_name_string units_hz = { "Hz", NULL };
91 const unit_name_string units_hz_s = { "Hz/s", NULL };
92 const unit_name_string units_kbit = { "kbit", NULL };
93 const unit_name_string units_kbps = { "Kbps", NULL };
94 const unit_name_string units_kibps = { "KiB/s", NULL };
95 const unit_name_string units_pkts = { " pkts", NULL };
96 const unit_name_string units_pkts_per_sec = { " pkts/s", NULL };
97 const unit_name_string units_km = { "km", NULL };
98 const unit_name_string units_kmh = { "km/h", NULL };
99 const unit_name_string units_m_s = { "m/s", NULL };
100 const unit_name_string units_cm_s = { "cm/s", NULL };
101 const unit_name_string units_mm_s = { "mm/s", NULL };
102 const unit_name_string units_bit_sec = { "bits/s", NULL };
103 const unit_name_string units_milliamps = { "mA", NULL };
104 const unit_name_string units_microwatts = { UTF8_MICRO_SIGN "W", NULL };
105 const unit_name_string units_volt = { "V", NULL };
106 const unit_name_string units_grams_per_second = { "g/s", NULL };
107 const unit_name_string units_meter_sec = { "m/s", NULL };
108 const unit_name_string units_meter_sec_squared = { "m/s" UTF8_SUPERSCRIPT_TWO , NULL };
109 const unit_name_string units_segment_remaining = { " segment remaining", " segments remaining" };
110 const unit_name_string units_frame_frames = { " frame", " frames" };
111 const unit_name_string units_revolutions_per_minute = { "rpm", NULL };
112 const unit_name_string units_kilopascal = { "kPa", NULL };
113 const unit_name_string units_newton_metre = { "Nm", NULL };
114 const unit_name_string units_liter_per_hour = { "L/h", NULL };
115 const unit_name_string units_amp = { "A", NULL };
116 const unit_name_string units_watthour = { "Wh", NULL };
117 const unit_name_string units_watt = { "W", NULL };
118 const unit_name_string units_bpm = { " BPM", NULL };
119 const unit_name_string units_calorie = { " cal", NULL };
120 const unit_name_string units_cycle_cycles = { " cycle", " cycles" };
124 * Editor modelines
126 * Local Variables:
127 * c-basic-offset: 4
128 * tab-width: 8
129 * indent-tabs-mode: nil
130 * End:
132 * ex: set shiftwidth=4 tabstop=8 expandtab:
133 * :indentSize=4:tabSize=8:noTabs=true: