GCC Code Coverage Report


Directory: common/src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 9 / 0 / 9
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 6 / 0 / 6

fx_unicode_length_get_extended.c
Line Branch Exec Source
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 5316 ULONG _fx_unicode_length_get_extended(UCHAR *unicode_name, UINT buffer_length)
65 {
66
67 ULONG i;
68 ULONG length;
69
70
71 5316 i = 0;
72 5316 length = 0;
73
2/2
✓ Branch 7 → 3 taken 37321 times.
✓ Branch 7 → 8 taken 13 times.
37334 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
4/4
✓ Branch 3 → 4 taken 5920 times.
✓ Branch 3 → 6 taken 31401 times.
✓ Branch 4 → 5 taken 5303 times.
✓ Branch 4 → 6 taken 617 times.
37321 if ((unicode_name[i] == 0) && (unicode_name[i + 1] == 0))
78 {
79 5303 break;
80 }
81
82 /* Increment index. */
83 32018 i = i + 2;
84
85 /* Increment the length. */
86 32018 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 5316 return(length);
94 }
95
96