tony2001 Mon Feb 26 11:55:33 2007 UTC
Modified files:
/php-src/main snprintf.c
Log:
fix CS/WS
http://cvs.php.net/viewvc.cgi/php-src/main/snprintf.c?r1=1.52&r2=1.53&diff_format=u
Index: php-src/main/snprintf.c
diff -u php-src/main/snprintf.c:1.52 php-src/main/snprintf.c:1.53
--- php-src/main/snprintf.c:1.52 Mon Feb 26 10:22:44 2007
+++ php-src/main/snprintf.c Mon Feb 26 11:55:32 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: snprintf.c,v 1.52 2007/02/26 10:22:44 dmitry Exp $ */
+/* $Id: snprintf.c,v 1.53 2007/02/26 11:55:32 tony2001 Exp $ */
#include "php.h"
@@ -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 @@
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 @@
* 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 @@
} 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 @@
} 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 @@
zend_freedtoa(digits);
return (buf);
}
+/* }}} */
-
+/* Apache license {{{ */
/* ====================================================================
* Copyright (c) 1995-1998 The Apache Group. All rights reserved.
*
@@ -276,6 +283,7 @@
* SIO stdio-replacement strx_* functions by Panos Tsirigotis
* <[EMAIL PROTECTED]> for xinetd.
*/
+/* }}} */
#define FALSE 0
#define TRUE 1
@@ -301,6 +309,7 @@
* 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 @@
*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 @@
* 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 @@
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 @@
* 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 @@
*len = buf_end - p;
return (p);
}
-
+/* }}} */
/*
* NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
@@ -560,8 +571,7 @@
/*
* 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 @@
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 @@
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 @@
}
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 @@
}
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 @@
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:
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php