GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_string_scroll_wheel_string_list_set.c Lines: 30 30 100.0 %
Date: 2026-03-06 19:21:09 Branches: 34 34 100.0 %

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
/** GUIX Component                                                        */
17
/**                                                                       */
18
/**   String Scroll Wheel Management (Scroll Wheel)                       */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_scroll_wheel.h"
29
#include "gx_utility.h"
30
31
GX_CALLER_CHECKING_EXTERNS
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gxe_string_scroll_wheel_string_list_set            PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function checks for errors in string scroll wheel string list  */
46
/*    set call.                                                           */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    wheel                                 Scroll wheel control block    */
51
/*    string_list                           String list to be set         */
52
/*    string_count                          The number of assigned strings*/
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    status                                Completion status             */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    _gx_string_scroll_wheel_string_list_set                             */
61
/*                                          Actual string scroll wheel    */
62
/*                                            string list set call        */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*                                                                        */
68
/**************************************************************************/
69
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
70
34
UINT  _gxe_string_scroll_wheel_string_list_set(GX_STRING_SCROLL_WHEEL *wheel,
71
                                               GX_CONST GX_CHAR **string_list,
72
                                               INT string_count)
73
{
74
UINT status;
75
76
    /* Check for appropriate caller.  */
77

34
    GX_INIT_AND_THREADS_CALLER_CHECKING
78
79
    /* Check for invalid pointer. */
80
32
    if (wheel == GX_NULL)
81
    {
82
1
        return GX_PTR_ERROR;
83
    }
84
85
    /* Check for invalid widget. */
86
31
    if (wheel -> gx_widget_type == 0)
87
    {
88
1
        return GX_INVALID_WIDGET;
89
    }
90
91
    /* Check for invalid list size. */
92
30
    if (string_count < 0)
93
    {
94
1
        return GX_INVALID_VALUE;
95
    }
96
97
29
    status = _gx_string_scroll_wheel_string_list_set(wheel, string_list, string_count);
98
99
29
    return status;
100
}
101
#endif
102
103
/**************************************************************************/
104
/*                                                                        */
105
/*  FUNCTION                                               RELEASE        */
106
/*                                                                        */
107
/*    _gxe_string_scroll_wheel_string_list_set_ext        PORTABLE C      */
108
/*                                                           6.1          */
109
/*  AUTHOR                                                                */
110
/*                                                                        */
111
/*    Kenneth Maxwell, Microsoft Corporation                              */
112
/*                                                                        */
113
/*  DESCRIPTION                                                           */
114
/*                                                                        */
115
/*    This function checks for errors in string scroll wheel string list  */
116
/*    set call.                                                           */
117
/*                                                                        */
118
/*  INPUT                                                                 */
119
/*                                                                        */
120
/*    wheel                                 Scroll wheel control block    */
121
/*    string_list                           String list to be set         */
122
/*    string_count                          The number of assigned strings*/
123
/*                                                                        */
124
/*  OUTPUT                                                                */
125
/*                                                                        */
126
/*    status                                Completion status             */
127
/*                                                                        */
128
/*  CALLS                                                                 */
129
/*                                                                        */
130
/*    _gx_string_scroll_wheel_string_list_set_ext                         */
131
/*                                          Actual string scroll wheel    */
132
/*                                            string list set ext call    */
133
/*                                                                        */
134
/*  CALLED BY                                                             */
135
/*                                                                        */
136
/*    Application Code                                                    */
137
/*                                                                        */
138
/**************************************************************************/
139
26
UINT _gxe_string_scroll_wheel_string_list_set_ext(GX_STRING_SCROLL_WHEEL *wheel,
140
                                                  GX_CONST GX_STRING *string_list,
141
                                                  INT string_count)
142
{
143
UINT                status;
144
INT                 string_id;
145
GX_CONST GX_STRING *string;
146
UINT                string_length;
147
148
    /* Check for appropriate caller.  */
149

26
    GX_INIT_AND_THREADS_CALLER_CHECKING
150
151
    /* Check for invalid pointer. */
152
24
    if (wheel == GX_NULL)
153
    {
154
1
        return GX_PTR_ERROR;
155
    }
156
157
    /* Check for invalid widget. */
158
23
    if (wheel -> gx_widget_type == 0)
159
    {
160
1
        return GX_INVALID_WIDGET;
161
    }
162
163
    /* Check for invalid list size. */
164
22
    if (string_count < 0)
165
    {
166
1
        return GX_INVALID_VALUE;
167
    }
168
169
21
    if (string_list)
170
    {
171
        /* Test string length. */
172
133
        for (string_id = 0; string_id < string_count; string_id++)
173
        {
174
117
            string = &string_list[string_id];
175
117
            if (string -> gx_string_ptr)
176
            {
177
113
                status = _gx_utility_string_length_check(string -> gx_string_ptr, &string_length, string -> gx_string_length);
178
179
113
                if (status != GX_SUCCESS)
180
                {
181
1
                    return status;
182
                }
183
            }
184
            else
185
            {
186
4
                string_length = 0;
187
            }
188
189
116
            if (string_length != string -> gx_string_length)
190
            {
191
1
                return GX_INVALID_STRING_LENGTH;
192
            }
193
        }
194
    }
195
196
19
    status = _gx_string_scroll_wheel_string_list_set_ext(wheel, string_list, string_count);
197
198
19
    return status;
199
}
200