diff options
author | jsorg71 <jsorg71> | 2007-10-15 03:47:26 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2007-10-15 03:47:26 +0000 |
commit | 5a2d2d67b55d7a5cb954631dbb28cb18a645dd3c (patch) | |
tree | 8949a03c1c1a428407f553f0dd2e3d2f13b4cae0 | |
parent | b906054cfbb503ec08acbb5b23aab956c211b479 (diff) | |
download | xrdp-proprietary-5a2d2d67b55d7a5cb954631dbb28cb18a645dd3c.tar.gz xrdp-proprietary-5a2d2d67b55d7a5cb954631dbb28cb18a645dd3c.zip |
added g_htoi
-rw-r--r-- | common/os_calls.c | 78 | ||||
-rw-r--r-- | common/os_calls.h | 2 |
2 files changed, 80 insertions, 0 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index e13ca334..0dd0067a 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -1084,6 +1084,84 @@ g_atoi(char* str) /*****************************************************************************/ int APP_CC +g_htoi(char* str) +{ + int len; + int index; + int rv; + int val; + int shift; + + rv = 0; + len = strlen(str); + index = len - 1; + shift = 0; + while (index >= 0) + { + val = 0; + switch (str[index]) + { + case '1': + val = 1; + break; + case '2': + val = 2; + break; + case '3': + val = 3; + break; + case '4': + val = 4; + break; + case '5': + val = 5; + break; + case '6': + val = 6; + break; + case '7': + val = 7; + break; + case '8': + val = 8; + break; + case '9': + val = 9; + break; + case 'a': + case 'A': + val = 10; + break; + case 'b': + case 'B': + val = 11; + break; + case 'c': + case 'C': + val = 12; + break; + case 'd': + case 'D': + val = 13; + break; + case 'e': + case 'E': + val = 14; + break; + case 'f': + case 'F': + val = 15; + break; + } + rv = rv | (val << shift); + index--; + shift += 4; + } + return rv; +} + +/*****************************************************************************/ +int APP_CC g_pos(char* str, const char* to_find) { char* pp; diff --git a/common/os_calls.h b/common/os_calls.h index 80f8cff1..d86776ad 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -154,6 +154,8 @@ g_strncasecmp(const char* c1, const char* c2, int len); int APP_CC g_atoi(char* str); int APP_CC +g_htoi(char* str); +int APP_CC g_pos(char* str, const char* to_find); int APP_CC g_mbstowcs(twchar* dest, const char* src, int n); |