GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_single_line_text_input_text_set.c Lines: 25 25 100.0 %
Date: 2026-03-06 19:21:09 Branches: 28 28 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
/**   Single Line Text Input Managment (Single Line Text Input)           */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_single_line_text_input.h"
29
#include "gx_utility.h"
30
31
GX_CALLER_CHECKING_EXTERNS
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gxe_single_line_text_input_text_set                PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function checks for errors in the single line text input text  */
45
/*    set function call.                                                  */
46
/*                                                                        */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    input                                 Pointer to single line text   */
51
/*                                            input control block         */
52
/*    text                                  Null-terminated text string   */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    status                                Completion status             */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    _gx_single_line_text_input_text_set   Actual multi line text input  */
61
/*                                            text set fucntion           */
62
/*                                                                        */
63
/*  CALLED BY                                                             */
64
/*                                                                        */
65
/*    Application Code                                                    */
66
/*                                                                        */
67
/**************************************************************************/
68
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
69
317
UINT _gxe_single_line_text_input_text_set(GX_SINGLE_LINE_TEXT_INPUT *input, GX_CONST GX_CHAR *text)
70
{
71
UINT status;
72
73
    /* Check for invalid caller.  */
74

317
    GX_INIT_AND_THREADS_CALLER_CHECKING
75
76
315
    if (!input)
77
    {
78
2
        return(GX_PTR_ERROR);
79
    }
80
81
    /* Check for invalid widget. */
82
313
    if (input -> gx_widget_type == 0)
83
    {
84
1
        return(GX_INVALID_WIDGET);
85
    }
86
87
312
    status = _gx_single_line_text_input_text_set(input, text);
88
89
312
    return(status);
90
}
91
#endif
92
93
/**************************************************************************/
94
/*                                                                        */
95
/*  FUNCTION                                               RELEASE        */
96
/*                                                                        */
97
/*    _gxe_single_line_text_input_text_set_ext            PORTABLE C      */
98
/*                                                           6.1          */
99
/*  AUTHOR                                                                */
100
/*                                                                        */
101
/*    Kenneth Maxwell, Microsoft Corporation                              */
102
/*                                                                        */
103
/*  DESCRIPTION                                                           */
104
/*                                                                        */
105
/*    This function checks for errors in the single line text input text  */
106
/*    set ext function call.                                              */
107
/*                                                                        */
108
/*                                                                        */
109
/*  INPUT                                                                 */
110
/*                                                                        */
111
/*    input                                 Pointer to single line text   */
112
/*                                            input control block         */
113
/*    text                                  GX_STRING type text string    */
114
/*                                                                        */
115
/*  OUTPUT                                                                */
116
/*                                                                        */
117
/*    status                                Completion status             */
118
/*                                                                        */
119
/*  CALLS                                                                 */
120
/*                                                                        */
121
/*    _gx_single_line_text_input_text_set_ext                             */
122
/*                                          Actual multi line text input  */
123
/*                                            text set ext fucntion       */
124
/*                                                                        */
125
/*  CALLED BY                                                             */
126
/*                                                                        */
127
/*    Application Code                                                    */
128
/*                                                                        */
129
/**************************************************************************/
130
243
UINT _gxe_single_line_text_input_text_set_ext(GX_SINGLE_LINE_TEXT_INPUT *input, GX_CONST GX_STRING *text)
131
{
132
243
UINT status = GX_SUCCESS;
133
243
UINT text_length = 0;
134
135
    /* Check for invalid caller.  */
136

243
    GX_INIT_AND_THREADS_CALLER_CHECKING
137
138
241
    if (!input)
139
    {
140
1
        return(GX_PTR_ERROR);
141
    }
142
143
    /* Check for invalid widget. */
144
240
    if (input -> gx_widget_type == 0)
145
    {
146
1
        return(GX_INVALID_WIDGET);
147
    }
148
149
239
    if (text)
150
    {
151
238
        if (text -> gx_string_ptr)
152
        {
153
237
            status = _gx_utility_string_length_check(text -> gx_string_ptr, &text_length, text -> gx_string_length);
154
155
237
            if (status != GX_SUCCESS)
156
            {
157
1
                return status;
158
            }
159
        }
160
161
237
        if (text_length != text -> gx_string_length)
162
        {
163
2
            return GX_INVALID_STRING_LENGTH;
164
        }
165
    }
166
167
236
    status = _gx_single_line_text_input_text_set_ext(input, text);
168
169
236
    return(status);
170
}
171