pike.git
/
src
/
modules
/
_Roxen
/
roxen.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/modules/_Roxen/roxen.c:1:
/* || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: roxen.c,v 1.
38
2004/01/27
10
:
59
:
15
grubba Exp $
+
|| $Id: roxen.c,v 1.
39
2004/01/27
12
:
12
:
50
grubba Exp $
*/ #define NO_PIKE_SHORTHAND #include "global.h" #include "config.h" #include "machine.h"
pike.git/src/modules/_Roxen/roxen.c:339:
/* count '%' and wide characters */ for (proc=0; foo<end; foo++) { if (*foo=='%') { proc++; if (foo[1] == 'u' || foo[1] == 'U') { /* %uXXXX */ if (foo[2] != '0' || foo[3] != '0') { size_shift = 1; }
-
adjust_len
+=
4
;
-
foo +=
4
;
+
foo
+=
5
;
+
if (
foo
< end) {
+
adjust_len
+=
5
;
} else {
-
adjust_len
+
=
2
;
+
adjust_len =
end - (foo - 4)
;
+
}
+
} else {
foo += 2;
-
+
if (foo < end) {
+
adjust_len += 2;
+
} else {
+
adjust_len = end - (foo - 1);
} } }
-
+
}
if (!proc) { pop_n_elems(args-1); return; } newstr = begin_wide_shared_string(Pike_sp[-args].u.string->len - adjust_len, size_shift); if (size_shift) { p_wchar1 *dest = STR1(newstr); for (proc=0; bar<end; dest++) if (*bar=='%') { if (bar[1] == 'u' || bar[1] == 'U') {
-
if (bar<end-
4
)
-
*dest = (((bar[
1
]<'A')?(bar[
1
]&15):((bar[
1
]+9)&15))<<12)|
-
(((bar[
2
]<'A')?(bar[
2
]&15):((bar[
2
]+9)&15))<<8)|
-
(((bar[
3
]<'A')?(bar[
3
]&15):((bar[
3
]+9)&15))<<4)|
-
((bar[
4
]<'A')?(bar[
4
]&15):((bar[
4
]+9)&15));
+
if (bar<end-
5
)
+
*dest = (((bar[
2
]<'A')?(bar[
2
]&15):((bar[
2
]+9)&15))<<12)|
+
(((bar[
3
]<'A')?(bar[
3
]&15):((bar[
3
]+9)&15))<<8)|
+
(((bar[
4
]<'A')?(bar[
4
]&15):((bar[
4
]+9)&15))<<4)|
+
((bar[
5
]<'A')?(bar[
5
]&15):((bar[
5
]+9)&15));
else *dest=0;
-
bar+=
3
;
+
bar+=
6
;
} else { if (bar<end-2) *dest=(((bar[1]<'A')?(bar[1]&15):((bar[1]+9)&15))<<4)| ((bar[2]<'A')?(bar[2]&15):((bar[2]+9)&15)); else *dest=0; bar+=3; } } else { *dest=*(bar++); } } else { foo = newstr->str; for (proc=0; bar<end; foo++) if (*bar=='%') { if (bar[1] == 'u' || bar[1] == 'U') { /* We know that the following two characters are zeros. */
-
bar+=
2
;
+
bar+=
3
;
} if (bar<end-2) *foo=(((bar[1]<'A')?(bar[1]&15):((bar[1]+9)&15))<<4)| ((bar[2]<'A')?(bar[2]&15):((bar[2]+9)&15)); else *foo=0; bar+=3; } else { *foo=*(bar++); }