1 | /* $Id: kHlpString-iprt.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * kHlpString - String And Memory Routines, IPRT based implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*******************************************************************************
|
---|
23 | * Header Files *
|
---|
24 | *******************************************************************************/
|
---|
25 | #include <k/kHlpString.h>
|
---|
26 | #include <iprt/string.h>
|
---|
27 |
|
---|
28 |
|
---|
29 | #ifndef kHlpMemChr
|
---|
30 | void *kHlpMemChr(const void *pv, int ch, KSIZE cb)
|
---|
31 | {
|
---|
32 | return (void *)memchr(pv, ch, cb);
|
---|
33 | }
|
---|
34 | #endif
|
---|
35 |
|
---|
36 |
|
---|
37 | #ifndef kHlpMemComp
|
---|
38 | int kHlpMemComp(const void *pv1, const void *pv2, KSIZE cb)
|
---|
39 | {
|
---|
40 | return memcmp(pv1, pv2, cb);
|
---|
41 | }
|
---|
42 | #endif
|
---|
43 |
|
---|
44 |
|
---|
45 | #ifndef kHlpMemCopy
|
---|
46 | void *kHlpMemCopy(void *pv1, const void *pv2, KSIZE cb)
|
---|
47 | {
|
---|
48 | return memcpy(pv1, pv2, cb);
|
---|
49 | }
|
---|
50 | #endif
|
---|
51 |
|
---|
52 |
|
---|
53 | #ifndef kHlpMemPCopy
|
---|
54 | void *kHlpMemPCopy(void *pv1, const void *pv2, KSIZE cb)
|
---|
55 | {
|
---|
56 | return (KU8 *)memcpy(pv1, pv2, cb) + cb;
|
---|
57 | }
|
---|
58 | #endif
|
---|
59 |
|
---|
60 |
|
---|
61 | #ifndef kHlpMemMove
|
---|
62 | void *kHlpMemMove(void *pv1, const void *pv2, KSIZE cb)
|
---|
63 | {
|
---|
64 | return memmove(pv1, pv2, cb);
|
---|
65 | }
|
---|
66 | #endif
|
---|
67 |
|
---|
68 |
|
---|
69 | #ifndef kHlpMemPMove
|
---|
70 | void *kHlpMemPMove(void *pv1, const void *pv2, KSIZE cb)
|
---|
71 | {
|
---|
72 | return (KU8 *)memmove(pv1, pv2, cb) + cb;
|
---|
73 | }
|
---|
74 | #endif
|
---|
75 |
|
---|
76 |
|
---|
77 | #ifndef kHlpMemSet
|
---|
78 | void *kHlpMemSet(void *pv1, int ch, KSIZE cb)
|
---|
79 | {
|
---|
80 | return memset(pv1, ch, cb);
|
---|
81 | }
|
---|
82 | #endif
|
---|
83 |
|
---|
84 |
|
---|
85 | #ifndef kHlpMemPSet
|
---|
86 | void *kHlpMemPSet(void *pv1, int ch, KSIZE cb)
|
---|
87 | {
|
---|
88 | return (KU8 *)memset(pv1, ch, cb) + cb;
|
---|
89 | }
|
---|
90 | #endif
|
---|
91 |
|
---|
92 |
|
---|
93 | #ifndef kHlpStrCat
|
---|
94 | char *kHlpStrCat(char *psz1, const char *psz2)
|
---|
95 | {
|
---|
96 | return strcat(psz1, psz2);
|
---|
97 | }
|
---|
98 | #endif
|
---|
99 |
|
---|
100 |
|
---|
101 | #ifndef kHlpStrNCat
|
---|
102 | char *kHlpStrNCat(char *psz1, const char *psz2, KSIZE cb)
|
---|
103 | {
|
---|
104 | return strncat(psz1, psz2, cb);
|
---|
105 | }
|
---|
106 | #endif
|
---|
107 |
|
---|
108 |
|
---|
109 | #ifndef kHlpStrChr
|
---|
110 | char *kHlpStrChr(const char *psz, int ch)
|
---|
111 | {
|
---|
112 | return (char *)strchr(psz, ch);
|
---|
113 | }
|
---|
114 | #endif
|
---|
115 |
|
---|
116 |
|
---|
117 | #ifndef kHlpStrRChr
|
---|
118 | char *kHlpStrRChr(const char *psz, int ch)
|
---|
119 | {
|
---|
120 | return (char *)strrchr(psz, ch);
|
---|
121 | }
|
---|
122 | #endif
|
---|
123 |
|
---|
124 |
|
---|
125 | #ifndef kHlpStrComp
|
---|
126 | int kHlpStrComp(const char *psz1, const char *psz2)
|
---|
127 | {
|
---|
128 | return strcmp(psz1, psz2);
|
---|
129 | }
|
---|
130 | #endif
|
---|
131 |
|
---|
132 |
|
---|
133 | #ifndef kHlpStrNComp
|
---|
134 | int kHlpStrNComp(const char *psz1, const char *psz2, KSIZE cch)
|
---|
135 | {
|
---|
136 | return strncmp(psz1, psz2, cch);
|
---|
137 | }
|
---|
138 | #endif
|
---|
139 |
|
---|
140 |
|
---|
141 | #ifndef kHlpStrCopy
|
---|
142 | char *kHlpStrCopy(char *psz1, const char *psz2)
|
---|
143 | {
|
---|
144 | return strcpy(psz1, psz2);
|
---|
145 | }
|
---|
146 | #endif
|
---|
147 |
|
---|
148 |
|
---|
149 | #ifndef kHlpStrLen
|
---|
150 | KSIZE kHlpStrLen(const char *psz1)
|
---|
151 | {
|
---|
152 | return strlen(psz1);
|
---|
153 | }
|
---|
154 | #endif
|
---|
155 |
|
---|
156 |
|
---|