GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_utility_string_length_get.c Lines: 5 5 100.0 %
Date: 2024-01-10 21:53:23 Branches: 4 4 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
/**   Utility                                                             */
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_utility.h"
30
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _fx_utility_string_length_get                       PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    William E. Lamie, Microsoft Corporation                             */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function returns length of string up to the maximum length.    */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    string                                Pointer to string             */
49
/*    max_length                            Maximum length which can be   */
50
/*                                            returned by function        */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    return length of string                                             */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    None                                                                */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    _fx_directory_exFAT_unicode_entry_write                             */
63
/*    _fx_directory_exFAT_free_search                                     */
64
/*    _fx_utility_absolute_path_get         Get absolute path             */
65
/*                                                                        */
66
/*  RELEASE HISTORY                                                       */
67
/*                                                                        */
68
/*    DATE              NAME                      DESCRIPTION             */
69
/*                                                                        */
70
/*  05-19-2020     William E. Lamie         Initial Version 6.0           */
71
/*  09-30-2020     William E. Lamie         Modified comment(s),          */
72
/*                                            resulting in version 6.1    */
73
/*                                                                        */
74
/**************************************************************************/
75
8
UINT  _fx_utility_string_length_get(CHAR *string, UINT max_length)
76
{
77
78
UINT length;
79
80
    /* Initialize length to 0.  */
81
8
    length = 0;
82
83
    /* Loop to calculate the length.  */
84

548
    while (string[length] && (length < max_length))
85
    {
86
87
        /* Increment the length (index).  */
88
540
        length++;
89
    }
90
91
    /* Return length.  */
92
8
    return(length);
93
}
94