blob: 4502b025aa4a0182220411a8fe096c53f3916264 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*++
Module Name:
lstr.c
Abstract:
Implementation of functions manipulating unicode/ansi strings. (lstr*A/W)
--*/
#include "pal/palinternal.h"
#include "pal/dbgmsg.h"
SET_DEFAULT_DEBUG_CHANNEL(CRT);
/*++
Function:
lstrlenA
The lstrlen function returns the length in bytes (ANSI version) or
characters (Unicode version) of the specified string (not including
the terminating null character).
Parameters
lpString [in] Pointer to a null-terminated string.
Return Values
The return value specifies the length of the string, in TCHARs. This
refers to bytes for ANSI versions of the function or characters for
Unicode versions.
--*/
int
PALAPI
lstrlenA( IN LPCSTR lpString)
{
int nChar = 0;
PERF_ENTRY(lstrlenA);
ENTRY("lstrlenA (lpString=%p (%s))\n", lpString?lpString:"NULL", lpString?lpString:"NULL");
if (lpString)
{
while (*lpString++)
{
nChar++;
}
}
LOGEXIT("lstrlenA returning int %d\n", nChar);
PERF_EXIT(lstrlenA);
return nChar;
}
/*++
Function:
lstrlenW
The lstrlen function returns the length in bytes (ANSI version) or
characters (Unicode version) of the specified string (not including
the terminating null character).
Parameters
lpString [in] Pointer to a null-terminated string.
Return Values
The return value specifies the length of the string, in TCHARs. This
refers to bytes for ANSI versions of the function or characters for
Unicode versions.
--*/
int
PALAPI
lstrlenW(
IN LPCWSTR lpString)
{
int nChar = 0;
PERF_ENTRY(lstrlenW);
ENTRY("lstrlenW (lpString=%p (%S))\n", lpString?lpString:W16_NULLSTRING, lpString?lpString:W16_NULLSTRING);
if (lpString != NULL)
{
while (*lpString++)
{
nChar++;
}
}
LOGEXIT("lstrlenW returning int %d\n", nChar);
PERF_EXIT(lstrlenW);
return nChar;
}
|