From: Stephen C North Date: Wed, 28 Aug 2019 19:02:02 +0000 (-0400) Subject: Revert "Move two checks from features/sfio into the code" X-Git-Tag: 2.42.2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cebb5103b484a4472543d134d2d3db086b741116;p=graphviz Revert "Move two checks from features/sfio into the code" This reverts commit 2ba97c0ed14163aa41c74bcf0dd72822b13ac7c5. This change broke gvpr, as demonstrated by the following gvpr script: N [ color=="blue"] {color="red";} N [ color=="blue"] {color="red";} I don't know if the mods were more substantive than just cleanup as they were related to other win64 work at the same time. --- diff --git a/lib/sfio/features/sfio b/lib/sfio/features/sfio index 6bc55d494..56abfaee4 100644 --- a/lib/sfio/features/sfio +++ b/lib/sfio/features/sfio @@ -37,6 +37,18 @@ tmp rmfail note{ file not removable if still opened }end execute{ } }end +more void_int note{ voidptr is larger than int }end execute{ + main() { + return sizeof(char*) > sizeof(int) ? 0 : 1; + } +}end + +more long_int note{ long is larger than int }end execute{ + main() { + return sizeof(long) > sizeof(int) ? 0 : 1; + } +}end + ################################################################ # See if there is a preferred block size for a file system ################################################################ diff --git a/lib/sfio/sfvprintf.c b/lib/sfio/sfvprintf.c index b4ed73d70..cbfd23a77 100644 --- a/lib/sfio/sfvprintf.c +++ b/lib/sfio/sfvprintf.c @@ -576,14 +576,13 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) flags = (flags & ~(SFFMT_SIGN | SFFMT_BLANK | SFFMT_ZERO)) | SFFMT_ALTER; - if (sizeof(char*) > sizeof(int)) { - lv = (Sflong_t) ((Sfulong_t) argv.vp); - goto long_cvt; - } else { - v = (int) ((uint) argv.vp); - goto int_cvt; - } - +#if _more_void_int + lv = (Sflong_t) ((Sfulong_t) argv.vp); + goto long_cvt; +#else + v = (int) ((uint) argv.vp); + goto int_cvt; +#endif case 'o': base = 8; n_s = 7; @@ -618,7 +617,7 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) n_s = base == 10 ? -1 : 0; int_arg: - if ((sizeof(long) > sizeof(int)) || (sizeof(char*) > sizeof(int))) { +#if _more_long_int || _more_void_int if (FMTCMP(size, Sflong_t, Sflong_t)) { lv = argv.ll; goto long_cvt; @@ -651,8 +650,9 @@ int sfvprintf(Sfio_t * f, const char *form, va_list args) *--sp = ssp[((Sfulong_t) lv) % base]; } while ((lv = ((Sfulong_t) lv) / base)); } - } - } else if (sizeof(short) < sizeof(int) + } else +#endif + if (sizeof(short) < sizeof(int) && FMTCMP(size, short, Sflong_t)) { if (ft && ft->extf && (ft->flags & SFFMT_VALUE)) { if (fmt == 'd') diff --git a/lib/sfio/sfvscanf.c b/lib/sfio/sfvscanf.c index a573857ab..b4a59c44f 100644 --- a/lib/sfio/sfvscanf.c +++ b/lib/sfio/sfvscanf.c @@ -650,14 +650,12 @@ int sfvscanf(Sfio_t * f, reg const char *form, va_list args) if (value) { n_assign += 1; - if (fmt == 'p') { - if (sizeof(char*) > sizeof(int)){ - *((void **) value) = (void *) ((ulong) argv.lu); - } - else { - *((void **) value) = (void *) ((uint) argv.lu); - } - } + if (fmt == 'p') +#if _more_void_int + *((void **) value) = (void *) ((ulong) argv.lu); +#else + *((void **) value) = (void *) ((uint) argv.lu); +#endif else if (sizeof(long) > sizeof(int) && FMTCMP(size, long, Sflong_t)) { if (fmt == 'd' || fmt == 'i')