diff options
author | Jay Sorg <jay.sorg@gmail.com> | 2016-12-04 15:39:10 -0800 |
---|---|---|
committer | Jay Sorg <jay.sorg@gmail.com> | 2016-12-04 15:39:10 -0800 |
commit | 9a517b34f0f4eb546c46ad4185260f4b66773a8c (patch) | |
tree | acba9d4d05b0b495cfe628fb585001837407e371 /common | |
parent | 57905d71ada103ae397e441e2c14b6f64c365a69 (diff) | |
download | xrdp-proprietary-9a517b34f0f4eb546c46ad4185260f4b66773a8c.tar.gz xrdp-proprietary-9a517b34f0f4eb546c46ad4185260f4b66773a8c.zip |
vnc: code cleanup
Diffstat (limited to 'common')
-rw-r--r-- | common/os_calls.c | 28 | ||||
-rw-r--r-- | common/os_calls.h | 2 |
2 files changed, 30 insertions, 0 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index d8e711b8..9ebaa880 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -2531,6 +2531,34 @@ g_htoi(char *str) } /*****************************************************************************/ +/* returns number of bytes copied into out_str */ +int APP_CC +g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str, + int bytes_out_str) +{ + int rv; + int index; + char *lout_str; + const tui8 *lbytes; + + rv = 0; + lbytes = (const tui8 *) bytes; + lout_str = out_str; + for (index = 0; index < num_bytes; index++) + { + if (bytes_out_str < 3) + { + break; + } + g_snprintf(lout_str, bytes_out_str, "%2.2x", lbytes[index]); + lout_str += 2; + bytes_out_str -= 2; + rv += 2; + } + return rv; +} + +/*****************************************************************************/ int APP_CC g_pos(const char *str, const char *to_find) { diff --git a/common/os_calls.h b/common/os_calls.h index 00e91a1d..6a206726 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -134,6 +134,8 @@ int APP_CC g_strcasecmp(const char* c1, const char* c2); int APP_CC g_strncasecmp(const char* c1, const char* c2, int len); int APP_CC g_atoi(const char* str); int APP_CC g_htoi(char* str); +int APP_CC g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str, + int bytes_out_str); int APP_CC g_pos(const char* str, const char* to_find); int APP_CC g_mbstowcs(twchar* dest, const char* src, int n); int APP_CC g_wcstombs(char* dest, const twchar* src, int n); |