GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_unicode_length_get_extended.c Lines: 9 9 100.0 %
Date: 2024-01-10 21:53:23 Branches: 6 6 100.0 %

Line Branch Exec Source
1
/**************************************************************************/
2
/*                                                                        */
3
/*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4
/*                                                                        */
5
/*       This software is licensed under the Microsoft Software License   */
6
/*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7
/*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8
/*       and in the root directory of this software.                      */
9
/*                                                                        */
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
/*  RELEASE HISTORY                                                       */
64
/*                                                                        */
65
/*    DATE              NAME                      DESCRIPTION             */
66
/*                                                                        */
67
/*  05-19-2020     William E. Lamie         Initial Version 6.0           */
68
/*  09-30-2020     William E. Lamie         Modified comment(s),          */
69
/*                                            resulting in version 6.1    */
70
/*                                                                        */
71
/**************************************************************************/
72
443
ULONG  _fx_unicode_length_get_extended(UCHAR *unicode_name, UINT buffer_length)
73
{
74
75
ULONG i;
76
ULONG length;
77
78
79
443
    i =  0;
80
443
    length =  0;
81
3491
    while (i < buffer_length)
82
    {
83
84
        /* See if we are at the end of the unicode string...  This assumes that there is a NULL at the end of the string.  */
85

3490
        if ((unicode_name[i] == 0) && (unicode_name[i + 1] == 0))
86
        {
87
442
            break;
88
        }
89
90
        /* Increment index.  */
91
3048
        i =  i + 2;
92
93
        /* Increment the length.  */
94
3048
        length++;
95
    }
96
97
    /* If trace is enabled, insert this event into the trace buffer.  */
98
    FX_TRACE_IN_LINE_INSERT(FX_TRACE_UNICODE_LENGTH_GET, unicode_name, length, 0, 0, FX_TRACE_FILE_EVENTS, 0, 0)
99
100
    /* Return length.  */
101
443
    return(length);
102
}
103