diff options
author | Dan Williams <dcbw@redhat.com> | 2016-03-03 13:26:44 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2016-03-03 13:26:44 -0600 |
commit | 3465107153e373adfd4e50ac90259ed25d556bed (patch) | |
tree | 2bb7755187f3136555d401d16ded37dc415736ab /src/libqmi-glib | |
parent | fea234dd1ea6f8d558b32d93e127a5bd73e5ae04 (diff) | |
download | external_libqmi-3465107153e373adfd4e50ac90259ed25d556bed.zip external_libqmi-3465107153e373adfd4e50ac90259ed25d556bed.tar.gz external_libqmi-3465107153e373adfd4e50ac90259ed25d556bed.tar.bz2 |
trivial: whitespace fixes
Diffstat (limited to 'src/libqmi-glib')
-rw-r--r-- | src/libqmi-glib/qmi-utils.c | 52 | ||||
-rw-r--r-- | src/libqmi-glib/test/test-port-context.c | 52 |
2 files changed, 52 insertions, 52 deletions
diff --git a/src/libqmi-glib/qmi-utils.c b/src/libqmi-glib/qmi-utils.c index d0df93b..a4028cb 100644 --- a/src/libqmi-glib/qmi-utils.c +++ b/src/libqmi-glib/qmi-utils.c @@ -47,32 +47,32 @@ __qmi_utils_str_hex (gconstpointer mem, gchar delimiter) { const guint8 *data = mem; - gsize i; - gsize j; - gsize new_str_length; - gchar *new_str; - - /* Get new string length. If input string has N bytes, we need: - * - 1 byte for last NUL char - * - 2N bytes for hexadecimal char representation of each byte... - * - N-1 bytes for the separator ':' - * So... a total of (1+2N+N-1) = 3N bytes are needed... */ - new_str_length = 3 * size; - - /* Allocate memory for new array and initialize contents to NUL */ - new_str = g_malloc0 (new_str_length); - - /* Print hexadecimal representation of each byte... */ - for (i = 0, j = 0; i < size; i++, j += 3) { - /* Print character in output string... */ - snprintf (&new_str[j], 3, "%02X", data[i]); - /* And if needed, add separator */ - if (i != (size - 1) ) - new_str[j + 2] = delimiter; - } - - /* Set output string */ - return new_str; + gsize i; + gsize j; + gsize new_str_length; + gchar *new_str; + + /* Get new string length. If input string has N bytes, we need: + * - 1 byte for last NUL char + * - 2N bytes for hexadecimal char representation of each byte... + * - N-1 bytes for the separator ':' + * So... a total of (1+2N+N-1) = 3N bytes are needed... */ + new_str_length = 3 * size; + + /* Allocate memory for new array and initialize contents to NUL */ + new_str = g_malloc0 (new_str_length); + + /* Print hexadecimal representation of each byte... */ + for (i = 0, j = 0; i < size; i++, j += 3) { + /* Print character in output string... */ + snprintf (&new_str[j], 3, "%02X", data[i]); + /* And if needed, add separator */ + if (i != (size - 1) ) + new_str[j + 2] = delimiter; + } + + /* Set output string */ + return new_str; } /*****************************************************************************/ diff --git a/src/libqmi-glib/test/test-port-context.c b/src/libqmi-glib/test/test-port-context.c index e3ed94e..72407c2 100644 --- a/src/libqmi-glib/test/test-port-context.c +++ b/src/libqmi-glib/test/test-port-context.c @@ -51,32 +51,32 @@ str_hex (gconstpointer mem, gchar delimiter) { const guint8 *data = mem; - gsize i; - gsize j; - gsize new_str_length; - gchar *new_str; - - /* Get new string length. If input string has N bytes, we need: - * - 1 byte for last NUL char - * - 2N bytes for hexadecimal char representation of each byte... - * - N-1 bytes for the separator ':' - * So... a total of (1+2N+N-1) = 3N bytes are needed... */ - new_str_length = 3 * size; - - /* Allocate memory for new array and initialize contents to NUL */ - new_str = g_malloc0 (new_str_length); - - /* Print hexadecimal representation of each byte... */ - for (i = 0, j = 0; i < size; i++, j += 3) { - /* Print character in output string... */ - snprintf (&new_str[j], 3, "%02X", data[i]); - /* And if needed, add separator */ - if (i != (size - 1) ) - new_str[j + 2] = delimiter; - } - - /* Set output string */ - return new_str; + gsize i; + gsize j; + gsize new_str_length; + gchar *new_str; + + /* Get new string length. If input string has N bytes, we need: + * - 1 byte for last NUL char + * - 2N bytes for hexadecimal char representation of each byte... + * - N-1 bytes for the separator ':' + * So... a total of (1+2N+N-1) = 3N bytes are needed... */ + new_str_length = 3 * size; + + /* Allocate memory for new array and initialize contents to NUL */ + new_str = g_malloc0 (new_str_length); + + /* Print hexadecimal representation of each byte... */ + for (i = 0, j = 0; i < size; i++, j += 3) { + /* Print character in output string... */ + snprintf (&new_str[j], 3, "%02X", data[i]); + /* And if needed, add separator */ + if (i != (size - 1) ) + new_str[j + 2] = delimiter; + } + + /* Set output string */ + return new_str; } /*****************************************************************************/ |