1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** FileX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** Unicode */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
/**************************************************************************/ |
22 |
|
|
|
23 |
|
|
#define FX_SOURCE_CODE |
24 |
|
|
|
25 |
|
|
|
26 |
|
|
/* Include necessary system files. */ |
27 |
|
|
|
28 |
|
|
#include "fx_api.h" |
29 |
|
|
#include "fx_unicode.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _fx_unicode_length_get_extended PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* William E. Lamie, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function returns the length of the supplied unicode name. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* unicode_name Pointer to unicode name */ |
49 |
|
|
/* buffer_length Buffer length for unicode name*/ |
50 |
|
|
/* */ |
51 |
|
|
/* OUTPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* length */ |
54 |
|
|
/* */ |
55 |
|
|
/* CALLS */ |
56 |
|
|
/* */ |
57 |
|
|
/* None */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLED BY */ |
60 |
|
|
/* */ |
61 |
|
|
/* Application Code */ |
62 |
|
|
/* */ |
63 |
|
|
/**************************************************************************/ |
64 |
|
443 |
ULONG _fx_unicode_length_get_extended(UCHAR *unicode_name, UINT buffer_length) |
65 |
|
|
{ |
66 |
|
|
|
67 |
|
|
ULONG i; |
68 |
|
|
ULONG length; |
69 |
|
|
|
70 |
|
|
|
71 |
|
443 |
i = 0; |
72 |
|
443 |
length = 0; |
73 |
✓✓ |
3491 |
while (i < buffer_length) |
74 |
|
|
{ |
75 |
|
|
|
76 |
|
|
/* See if we are at the end of the unicode string... This assumes that there is a NULL at the end of the string. */ |
77 |
✓✓✓✓
|
3490 |
if ((unicode_name[i] == 0) && (unicode_name[i + 1] == 0)) |
78 |
|
|
{ |
79 |
|
442 |
break; |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
/* Increment index. */ |
83 |
|
3048 |
i = i + 2; |
84 |
|
|
|
85 |
|
|
/* Increment the length. */ |
86 |
|
3048 |
length++; |
87 |
|
|
} |
88 |
|
|
|
89 |
|
|
/* If trace is enabled, insert this event into the trace buffer. */ |
90 |
|
|
FX_TRACE_IN_LINE_INSERT(FX_TRACE_UNICODE_LENGTH_GET, unicode_name, length, 0, 0, FX_TRACE_FILE_EVENTS, 0, 0) |
91 |
|
|
|
92 |
|
|
/* Return length. */ |
93 |
|
443 |
return(length); |
94 |
|
|
} |
95 |
|
|
|