From: Antony Dovgal Date: Mon, 26 Feb 2007 11:55:32 +0000 (+0000) Subject: fix CS/WS X-Git-Tag: RELEASE_1_0_1~150 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce78040c39d0476fb954b8e3f4a81c8928a0efe6;p=php fix CS/WS --- diff --git a/main/snprintf.c b/main/snprintf.c index 5defd6fccc..a0167e096d 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -63,7 +63,7 @@ * Materiel Command, USAF, under agreement number F39502-99-1-0512. */ -static char * __cvt(double value, int ndigit, int *decpt, int *sign, int fmode, int pad) +static char * __cvt(double value, int ndigit, int *decpt, int *sign, int fmode, int pad) /* {{{ */ { register char *s = NULL; char *p, *rve, c; @@ -117,18 +117,21 @@ static char * __cvt(double value, int ndigit, int *decpt, int *sign, int fmode, return(s); } +/* }}} */ -static inline char *php_ecvt(double value, int ndigit, int *decpt, int *sign) +static inline char *php_ecvt(double value, int ndigit, int *decpt, int *sign) /* {{{ */ { return(__cvt(value, ndigit, decpt, sign, 0, 1)); } +/* }}} */ -static inline char *php_fcvt(double value, int ndigit, int *decpt, int *sign) +static inline char *php_fcvt(double value, int ndigit, int *decpt, int *sign) /* {{{ */ { return(__cvt(value, ndigit, decpt, sign, 1, 1)); } +/* }}} */ -PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf) +PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf) /* {{{ */ { char *digits, *dst, *src; int i, decpt, sign; @@ -139,26 +142,26 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c * Infinity or NaN, convert to inf or nan with sign. * We assume the buffer is at least ndigit long. */ - snprintf(buf, ndigit + 1, "%s%s", (sign && *digits == 'I') ? "-" : "", - *digits == 'I' ? "INF" : "NAN"); + snprintf(buf, ndigit + 1, "%s%s", (sign && *digits == 'I') ? "-" : "", *digits == 'I' ? "INF" : "NAN"); zend_freedtoa(digits); return (buf); } dst = buf; - if (sign) + if (sign) { *dst++ = '-'; + } for (i = 0; i < ndigit && digits[i] != '\0'; i++); - if ((decpt >= 0 && decpt - i > 4) - || (decpt < 0 && decpt < -3)) { /* use E-style */ + if ((decpt >= 0 && decpt - i > 4) || (decpt < 0 && decpt < -3)) { /* use E-style */ /* exponential format (e.g. 1.2345e+13) */ if (--decpt < 0) { sign = 1; decpt = -decpt; - } else + } else { sign = 0; + } src = digits; *dst++ = *src++; *dst++ = dec_point; @@ -170,10 +173,11 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c } while (*src != '\0'); } *dst++ = exponent; - if (sign) + if (sign) { *dst++ = '-'; - else + } else { *dst++ = '+'; + } if (decpt < 10) { *dst++ = '0' + decpt; *dst = '\0'; @@ -202,14 +206,16 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c } else { /* standard format */ for (i = 0, src = digits; i < decpt; i++) { - if (*src != '\0') + if (*src != '\0') { *dst++ = *src++; - else + } else { *dst++ = '0'; + } } if (*src != '\0') { - if (src == digits) + if (src == digits) { *dst++ = '0'; /* zero before decimal point */ + } *dst++ = dec_point; for (i = decpt; digits[i] != '\0'; i++) { *dst++ = digits[i]; @@ -220,8 +226,9 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c zend_freedtoa(digits); return (buf); } +/* }}} */ - +/* Apache license {{{ */ /* ==================================================================== * Copyright (c) 1995-1998 The Apache Group. All rights reserved. * @@ -276,6 +283,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c * SIO stdio-replacement strx_* functions by Panos Tsirigotis * for xinetd. */ +/* }}} */ #define FALSE 0 #define TRUE 1 @@ -301,6 +309,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c * which is a pointer to the END of the buffer + 1 (i.e. if the buffer * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) */ +/* char *ap_php_conv_10() {{{ */ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, register bool_int * is_negative, char *buf_end, register int *len) { @@ -344,6 +353,7 @@ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, *len = buf_end - p; return (p); } +/* }}} */ /* If you change this value then also change bug24640.phpt. * Also NDIG must be reasonable smaller than NUM_BUF_SIZE. @@ -357,6 +367,7 @@ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, * The sign is returned in the is_negative argument (and is not placed * in buf). */ +/* PHPAPI char *php_conf_fp() {{{ */ PHPAPI char * php_conv_fp(register char format, register double num, boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, int *len) { @@ -446,6 +457,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, free(p_orig); return (buf); } +/* }}} */ /* * Convert num to a base X number where X is a power of 2. nbits determines X. @@ -457,8 +469,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, * which is a pointer to the END of the buffer + 1 (i.e. if the buffer * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) */ -char * ap_php_conv_p2(register u_wide_int num, register int nbits, - char format, char *buf_end, register int *len) +char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register int *len) /* {{{ */ { register int mask = (1 << nbits) - 1; register char *p = buf_end; @@ -475,7 +486,7 @@ char * ap_php_conv_p2(register u_wide_int num, register int nbits, *len = buf_end - p; return (p); } - +/* }}} */ /* * NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions @@ -560,8 +571,7 @@ typedef struct buf_area buffy; /* * Do format conversion placing the output in buffer */ -static int format_converter(register buffy * odp, const char *fmt, - va_list ap) +static int format_converter(register buffy * odp, const char *fmt, va_list ap) /* {{{ */ { register char *sp; register char *bep; @@ -1183,13 +1193,12 @@ skip_output: odp->nextb = sp; return (cc); } - +/* }}} */ /* * This is the general purpose conversion function. */ -static void strx_printv(int *ccp, char *buf, size_t len, const char *format, - va_list ap) +static void strx_printv(int *ccp, char *buf, size_t len, const char *format, va_list ap) /* {{{ */ { buffy od; int cc; @@ -1216,9 +1225,9 @@ static void strx_printv(int *ccp, char *buf, size_t len, const char *format, if (ccp) *ccp = cc; } +/* }}} */ - -PHPAPI int ap_php_slprintf(char *buf, size_t len, const char *format,...) +PHPAPI int ap_php_slprintf(char *buf, size_t len, const char *format,...) /* {{{ */ { int cc; va_list ap; @@ -1232,9 +1241,9 @@ PHPAPI int ap_php_slprintf(char *buf, size_t len, const char *format,...) } return cc; } +/* }}} */ - -PHPAPI int ap_php_vslprintf(char *buf, size_t len, const char *format, va_list ap) +PHPAPI int ap_php_vslprintf(char *buf, size_t len, const char *format, va_list ap) /* {{{ */ { int cc; @@ -1245,8 +1254,9 @@ PHPAPI int ap_php_vslprintf(char *buf, size_t len, const char *format, va_list a } return cc; } +/* }}} */ -PHPAPI int ap_php_snprintf(char *buf, size_t len, const char *format,...) +PHPAPI int ap_php_snprintf(char *buf, size_t len, const char *format,...) /* {{{ */ { int cc; va_list ap; @@ -1256,15 +1266,16 @@ PHPAPI int ap_php_snprintf(char *buf, size_t len, const char *format,...) va_end(ap); return (cc); } +/* }}} */ - -PHPAPI int ap_php_vsnprintf(char *buf, size_t len, const char *format, va_list ap) +PHPAPI int ap_php_vsnprintf(char *buf, size_t len, const char *format, va_list ap) /* {{{ */ { int cc; strx_printv(&cc, buf, len, format, ap); return (cc); } +/* }}} */ /* * Local variables: