GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_multi_line_text_input_text_set.c Lines: 20 20 100.0 %
Date: 2026-03-06 19:21:09 Branches: 24 24 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 Managment (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_system.h"
29
#include "gx_multi_line_text_input.h"
30
#include "gx_utility.h"
31
32
GX_CALLER_CHECKING_EXTERNS
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gxe_multi_line_text_input_text_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 the multi line text input text   */
46
/*    set function call.                                                  */
47
/*                                                                        */
48
/*                                                                        */
49
/*  INPUT                                                                 */
50
/*                                                                        */
51
/*    input                                 Pointer to multi line text    */
52
/*                                            input control block         */
53
/*    text                                  Null-terminated text string   */
54
/*                                                                        */
55
/*  OUTPUT                                                                */
56
/*                                                                        */
57
/*    status                                Completion status             */
58
/*                                                                        */
59
/*  CALLS                                                                 */
60
/*                                                                        */
61
/*    _gx_multi_line_text_view_input_set    Actual multi line text input  */
62
/*                                            text set fucntion           */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*                                                                        */
68
/**************************************************************************/
69
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
70
932
UINT _gxe_multi_line_text_input_text_set(GX_MULTI_LINE_TEXT_INPUT *input, GX_CONST GX_CHAR *text)
71
{
72
UINT status;
73
74
    /* Check for invalid caller.  */
75

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

187
    GX_INIT_AND_THREADS_CALLER_CHECKING
132
133
185
    if (!input)
134
    {
135
1
        return(GX_PTR_ERROR);
136
    }
137
138
184
    if (text)
139
    {
140
183
        if (text -> gx_string_ptr)
141
        {
142
            /* Calculate string length. */
143
181
            status = _gx_utility_string_length_check(text -> gx_string_ptr, &text_length, text -> gx_string_length);
144
145
181
            if (status != GX_SUCCESS)
146
            {
147
1
                return status;
148
            }
149
        }
150
151
        /* Validate string length. */
152
182
        if (text_length != text -> gx_string_length)
153
        {
154
1
            return GX_INVALID_STRING_LENGTH;
155
        }
156
    }
157
158
182
    status = _gx_multi_line_text_input_text_set_ext(input, text);
159
160
182
    return(status);
161
}
162