- Fix alignment for arrays
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4602 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include <tgmath.h>
|
||||||
|
|
||||||
#define G_LOG_DOMAIN ("PARSER")
|
#define G_LOG_DOMAIN ("PARSER")
|
||||||
|
|
||||||
#include "array_type.h"
|
#include "array_type.h"
|
||||||
@@ -34,6 +36,7 @@ int array_dissect_from_buffer(
|
|||||||
int zero_counter = 0;
|
int zero_counter = 0;
|
||||||
gboolean is_string = FALSE;
|
gboolean is_string = FALSE;
|
||||||
char *string;
|
char *string;
|
||||||
|
int nb_digits = 0;
|
||||||
|
|
||||||
/* Factorizes trailing 0 */
|
/* Factorizes trailing 0 */
|
||||||
if ((items > 1) && (type_child->type == TYPE_FUNDAMENTAL))
|
if ((items > 1) && (type_child->type == TYPE_FUNDAMENTAL))
|
||||||
@@ -87,9 +90,11 @@ int array_dissect_from_buffer(
|
|||||||
|
|
||||||
if (is_string == FALSE)
|
if (is_string == FALSE)
|
||||||
{
|
{
|
||||||
|
nb_digits = log10(items - zero_counter) + 1;
|
||||||
|
|
||||||
for (i = 0; i < (items - zero_counter); i++)
|
for (i = 0; i < (items - zero_counter); i++)
|
||||||
{
|
{
|
||||||
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%d] ", i));
|
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%*d] ", nb_digits, i));
|
||||||
ui_set_signal_text_cb(user_data, cbuf, length);
|
ui_set_signal_text_cb(user_data, cbuf, length);
|
||||||
|
|
||||||
type->child->type_dissect_from_buffer (
|
type->child->type_dissect_from_buffer (
|
||||||
|
|||||||
Reference in New Issue
Block a user