1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

upgrade gammas

This commit is contained in:
psyc://psyced.org/~lynX 2009-03-07 10:30:44 +01:00
parent ac39429f4a
commit a602585399
20 changed files with 20 additions and 156 deletions

View file

@ -107,34 +107,6 @@ PROTECTED void back() {
myIndex -= 1;
}
#ifndef GAMMA
// funny.. we already have two better ways to do hex2int than this:
//
/// <summary>
/// Get the hex value of a character (base16).
/// </summary>
/// <param name="c">
/// A character between '0' and '9' or between 'A' and 'F' or
/// between 'a' and 'f'.
/// </param>
/// <returns>An int between 0 and 15, or -1 if c was not a hex digit.</returns>
PROTECTED int dehexchar(int c) {
if (c >= '0' && c <= '9')
{
return c - '0';
}
if (c >= 'A' && c <= 'F')
{
return c + 10 - 'A';
}
if (c >= 'a' && c <= 'f')
{
return c + 10 - 'a';
}
return -1;
}
#endif
/// <summary>
/// Determine if the source string still contains characters that next() can consume.
/// </summary>
@ -335,17 +307,8 @@ PROTECTED varargs string unescape(string s)
if (c == '+') {
c = ' ';
} else if (c == '%' && (i + 2 < len)) {
#ifndef GAMMA
int d = dehexchar(s[i+1]);
int e = dehexchar(s[i+2]);
if (d >= 0 && e >= 0) {
c = (d*16 + e);
i += 2;
}
#else
i += 2;
c = hex2int(s[i-1 .. i]);
#endif
}
sb+=int2char(c);
}