From a605c06e12510600a67aaa86ea349037f613e53d Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sun, 20 Nov 2005 19:55:42 +0000 Subject: Added hex character conversion utility in ctype git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@62 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/src/pj/ctype.c | 24 ++++++++++++++++++++++++ pjlib/src/pj/log.c | 4 ++-- pjlib/src/pj/os_core_win32.c | 4 ---- pjlib/src/pj/string.c | 12 ++---------- 4 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 pjlib/src/pj/ctype.c (limited to 'pjlib/src/pj') diff --git a/pjlib/src/pj/ctype.c b/pjlib/src/pj/ctype.c new file mode 100644 index 00000000..b274ccaf --- /dev/null +++ b/pjlib/src/pj/ctype.c @@ -0,0 +1,24 @@ +/* $Id: $ */ +/* + * Copyright (C)2003-2006 Benny Prijono + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + + +char pj_hex_digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + diff --git a/pjlib/src/pj/log.c b/pjlib/src/pj/log.c index 2e4e931b..55e7cf39 100644 --- a/pjlib/src/pj/log.c +++ b/pjlib/src/pj/log.c @@ -64,8 +64,8 @@ PJ_DEF(pj_log_func*) pj_log_get_log_func(void) return log_writer; } -static void pj_log(const char *sender, int level, - const char *format, va_list marker) +PJ_DEF(void) pj_log( const char *sender, int level, + const char *format, va_list marker) { pj_time_val now; pj_parsed_time ptime; diff --git a/pjlib/src/pj/os_core_win32.c b/pjlib/src/pj/os_core_win32.c index 05f3f341..b8e6b281 100644 --- a/pjlib/src/pj/os_core_win32.c +++ b/pjlib/src/pj/os_core_win32.c @@ -129,17 +129,13 @@ PJ_DEF(pj_status_t) pj_init(void) pj_str_t guid; pj_status_t rc; - PJ_LOG(5, ("pj_init", "Initializing PJ Library..")); - /* Init Winsock.. */ if (WSAStartup(MAKEWORD(2,0), &wsa) != 0) { - PJ_LOG(1, ("pj_init", "Winsock initialization has returned an error")); return PJ_RETURN_OS_ERROR(WSAGetLastError()); } /* Init this thread's TLS. */ if ((rc=pj_thread_init()) != PJ_SUCCESS) { - PJ_LOG(1, ("pj_init", "Thread initialization has returned an error")); return rc; } diff --git a/pjlib/src/pj/string.c b/pjlib/src/pj/string.c index 34a518fb..5c152fb5 100644 --- a/pjlib/src/pj/string.c +++ b/pjlib/src/pj/string.c @@ -27,9 +27,6 @@ #endif -static char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - PJ_DEF(pj_str_t*) pj_strltrim( pj_str_t *str ) { register char *p = str->ptr; @@ -50,12 +47,6 @@ PJ_DEF(pj_str_t*) pj_strrtrim( pj_str_t *str ) return str; } -PJ_INLINE(void) pj_val_to_hex_digit(unsigned value, char *p) -{ - *p++ = hex[ (value & 0xF0) >> 4 ]; - *p++ = hex[ (value & 0x0F) ]; -} - PJ_DEF(char*) pj_create_random_string(char *str, pj_size_t len) { unsigned i; @@ -72,7 +63,7 @@ PJ_DEF(char*) pj_create_random_string(char *str, pj_size_t len) p += 8; } for (i=i * 8; i