/src/pjsip/pjlib/src/pj/guid.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) |
3 | | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> |
4 | | * |
5 | | * This program is free software; you can redistribute it and/or modify |
6 | | * it under the terms of the GNU General Public License as published by |
7 | | * the Free Software Foundation; either version 2 of the License, or |
8 | | * (at your option) any later version. |
9 | | * |
10 | | * This program is distributed in the hope that it will be useful, |
11 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | | * GNU General Public License for more details. |
14 | | * |
15 | | * You should have received a copy of the GNU General Public License |
16 | | * along with this program; if not, write to the Free Software |
17 | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | | */ |
19 | | #include <pj/ctype.h> |
20 | | #include <pj/guid.h> |
21 | | #include <pj/pool.h> |
22 | | |
23 | | PJ_DEF(pj_str_t*) pj_generate_unique_string_lower(pj_str_t *str) |
24 | 0 | { |
25 | 0 | int i; |
26 | |
|
27 | 0 | pj_generate_unique_string(str); |
28 | 0 | for (i = 0; i < str->slen; i++) |
29 | 0 | str->ptr[i] = (char)pj_tolower(str->ptr[i]); |
30 | |
|
31 | 0 | return str; |
32 | 0 | } |
33 | | |
34 | | PJ_DEF(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str) |
35 | 0 | { |
36 | 0 | str->ptr = (char*)pj_pool_alloc(pool, PJ_GUID_STRING_LENGTH); |
37 | 0 | pj_generate_unique_string(str); |
38 | 0 | } |
39 | | |
40 | | PJ_DEF(void) pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str) |
41 | 0 | { |
42 | 0 | int i; |
43 | |
|
44 | 0 | pj_create_unique_string(pool, str); |
45 | 0 | for (i = 0; i < str->slen; i++) |
46 | 0 | str->ptr[i] = (char)pj_tolower(str->ptr[i]); |
47 | 0 | } |