GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_multi_line_text_input_char_insert.c Lines: 24 24 100.0 %
Date: 2026-03-06 19:21:09 Branches: 32 32 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
/**   Multi Line Text Input Management (Multi 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_multi_line_text_input.h"
29
#include "gx_utility.h"
30
31
/* Bring in externs for caller checking code.  */
32
GX_CALLER_CHECKING_EXTERNS
33
34
/**************************************************************************/
35
/*                                                                        */
36
/*  FUNCTION                                               RELEASE        */
37
/*                                                                        */
38
/*    _gxe_multi_line_text_input_char_insert              PORTABLE C      */
39
/*                                                           6.1          */
40
/*  AUTHOR                                                                */
41
/*                                                                        */
42
/*    Kenneth Maxwell, Microsoft Corporation                              */
43
/*                                                                        */
44
/*  DESCRIPTION                                                           */
45
/*                                                                        */
46
/*    This function checks for errors in the multi line text input        */
47
/*    char insert call.                                                   */
48
/*                                                                        */
49
/*  INPUT                                                                 */
50
/*                                                                        */
51
/*    text_input                            Multi line text input widget  */
52
/*                                            control block               */
53
/*    str                                   Utf8 string to be inserted    */
54
/*    str_size                              Inserted string size in bytes */
55
/*                                                                        */
56
/*  OUTPUT                                                                */
57
/*                                                                        */
58
/*    status                                Completion status             */
59
/*                                                                        */
60
/*  CALLS                                                                 */
61
/*                                                                        */
62
/*    _gx_multi_line_text_input_char_insert                               */
63
/*                                          Actual multi line text input  */
64
/*                                            char insert call            */
65
/*                                                                        */
66
/*  CALLED BY                                                             */
67
/*                                                                        */
68
/*    Application Code                                                    */
69
/*                                                                        */
70
/**************************************************************************/
71
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
72
7
UINT _gxe_multi_line_text_input_char_insert(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_UBYTE *str, UINT str_size)
73
{
74
UINT status;
75
76
    /* Check for invalid caller.  */
77

7
    GX_INIT_AND_THREADS_CALLER_CHECKING
78
79
    /* Check for invalid input pointers. */
80

5
    if ((text_input == GX_NULL) || (str == GX_NULL))
81
    {
82
2
        return(GX_PTR_ERROR);
83
    }
84
85
    /* Check for invalid value. */
86
3
    if (str_size == 0)
87
    {
88
1
        return(GX_INVALID_VALUE);
89
    }
90
91
    /* Check for invalid widget check. */
92
2
    if (text_input -> gx_widget_type == 0)
93
    {
94
1
        return(GX_INVALID_WIDGET);
95
    }
96
97
    /* Call actual multi line text input char insert function.  */
98
1
    status = _gx_multi_line_text_input_char_insert(text_input, str, str_size);
99
100
1
    return status;
101
}
102
#endif
103
104
/**************************************************************************/
105
/*                                                                        */
106
/*  FUNCTION                                               RELEASE        */
107
/*                                                                        */
108
/*    _gxe_multi_line_text_input_char_insert_ext          PORTABLE C      */
109
/*                                                           6.1          */
110
/*  AUTHOR                                                                */
111
/*                                                                        */
112
/*    Kenneth Maxwell, Microsoft Corporation                              */
113
/*                                                                        */
114
/*  DESCRIPTION                                                           */
115
/*                                                                        */
116
/*    This function checks for errors in the multi line text input        */
117
/*    char insert call.                                                   */
118
/*                                                                        */
119
/*  INPUT                                                                 */
120
/*                                                                        */
121
/*    text_input                            Multi line text input widget  */
122
/*                                            control block               */
123
/*    str                                   Utf8 string to be inserted    */
124
/*                                                                        */
125
/*  OUTPUT                                                                */
126
/*                                                                        */
127
/*    status                                Completion status             */
128
/*                                                                        */
129
/*  CALLS                                                                 */
130
/*                                                                        */
131
/*    _gx_multi_line_text_input_char_insert_ext                           */
132
/*                                          Actual multi line text input  */
133
/*                                            char insert ext call        */
134
/*                                                                        */
135
/*  CALLED BY                                                             */
136
/*                                                                        */
137
/*    Application Code                                                    */
138
/*                                                                        */
139
/**************************************************************************/
140
102
UINT _gxe_multi_line_text_input_char_insert_ext(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_CONST GX_STRING *str)
141
{
142
UINT status;
143
102
UINT string_length = 0;
144
145
    /* Check for invalid caller.  */
146

102
    GX_INIT_AND_THREADS_CALLER_CHECKING
147
148
    /* Check for invalid input pointers. */
149

100
    if ((text_input == GX_NULL) || (str == GX_NULL) || (str -> gx_string_ptr == GX_NULL))
150
    {
151
3
        return(GX_PTR_ERROR);
152
    }
153
154
97
    status = _gx_utility_string_length_check(str -> gx_string_ptr, &string_length, str -> gx_string_length);
155
156
97
    if (status != GX_SUCCESS)
157
    {
158
1
        return status;
159
    }
160
161
    /* Check for invalid string length. */
162
96
    if (string_length != str -> gx_string_length)
163
    {
164
1
        return GX_INVALID_STRING_LENGTH;
165
    }
166
167
    /* Check for invalid widget check. */
168
95
    if (text_input -> gx_widget_type == 0)
169
    {
170
1
        return(GX_INVALID_WIDGET);
171
    }
172
173
    /* Call actual multi line text input char insert function.  */
174
94
    status = _gx_multi_line_text_input_char_insert_ext(text_input, str);
175
176
94
    return status;
177
}
178