From: Thibaut VARENE Date: 2023年11月29日 11:09:14 +0000 (+0100) Subject: fix STGE output & processing X-Git-Tag: v2.5~1 X-Git-Url: http://vcs.slashdirt.org/git/?a=commitdiff_plain;h=172932e13b1512aa59d8faf974492a49292b2f2b;p=sw%2Ftic2json.git fix STGE output & processing --- diff --git a/src/tic.c b/src/tic.c index 5668ce5..066bff8 100644 --- a/src/tic.c +++ b/src/tic.c @@ -23,7 +23,6 @@ bool *etiq_en; ///< when non-NULL, a token-indexed array, where the related tok void make_field(struct tic_field *field, const struct tic_etiquette *etiq, char *horodate, char *data) { // args come from the bison stack - int base; char *rem; field->horodate = horodate; @@ -37,13 +36,12 @@ void make_field(struct tic_field *field, const struct tic_etiquette *etiq, char field->data.s = data; return; case T_HEX: - base = 16; + field->data.i = strtoul(data, &rem, 16); break; default: - base = 10; + field->data.i = strtol(data, &rem, 10); break; } - field->data.i = (int)strtol(data, &rem, base); #ifdef TICV01pme if (U_SANS == etiq->unittype && *data != '0円' && *rem != '0円') { diff --git a/src/tic.h b/src/tic.h index 6ee0f9e..d08af73 100644 --- a/src/tic.h +++ b/src/tic.h @@ -77,7 +77,7 @@ struct tic_field { struct tic_etiquette etiq; ///< the field "etiquette" union { char *s; - int i; + long i; } data; ///< the field data, if any char *horodate; ///< the field horodate, if any }; diff --git a/src/tic2json.c b/src/tic2json.c index 597e0a4..74e2a96 100644 --- a/src/tic2json.c +++ b/src/tic2json.c @@ -116,7 +116,7 @@ static const char * tic_units[] = { }; #ifdef TICV02 -static void print_stge_data(int data) +static void print_stge_data(long data) { const char sep = (tp.optflags & TIC2JSON_OPT_CRFIELD) ? '\n' : ' '; uint32_t d = (uint32_t)data; @@ -278,7 +278,7 @@ string: #endif /* TICV02 */ // fallthrough default: - ticprintf("%d", field->data.i); + ticprintf("%ld", field->data.i); break; }

AltStyle によって変換されたページ (->オリジナル) /