pike.git
/
src
/
modules
/
_Roxen
/
roxen.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/modules/_Roxen/roxen.c:6:
*/ #define NO_PIKE_SHORTHAND #include "global.h" #include "config.h" #include "machine.h"
+
#include <assert.h>
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <ctype.h> #include <string.h> #include <time.h> #include <limits.h> #include "fdlib.h" #include "stralloc.h"
pike.git/src/modules/_Roxen/roxen.c:482:
if( args != 1 ) Pike_error("Wrong number of arguments to html_encode_string\n" ); switch( Pike_sp[-1].type ) { void o_cast_to_string(); case PIKE_T_INT: /* Optimization, this is basically a inlined cast_int_to_string */ {
-
char buf[21], *b =
buf+19
;
+
char buf[21], *b =
buf + (sizeof (buf) - 2)
;
int neg, j=0; INT_TYPE i = Pike_sp[-1].u.integer; if( i < 0 ) { neg = 1; i = -i; if (i < 0) { /* The largest negative number cannot be negated. */ o_cast_to_string(); return; } } else neg = 0; pop_stack();
-
buf[
20
] = 0;
+
buf[
sizeof (buf) - 1
] = 0;
while( i >= 10 ) { b[ -j++ ] = '0'+(i%10); i /= 10; } b[ -j++ ] = '0'+(i%10); if( neg ) b[ -j++ ] = '-';
-
+
assert (b - j + 1 >= buf);
push_text( b-j+1 ); } return; case PIKE_T_FLOAT: /* Optimization, no need to check the resultstring for * unsafe characters. */ o_cast_to_string(); return;