GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_multi_line_text_button_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
/**   Button Management (Button)                                          */
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_button.h"
30
#include "gx_utility.h"
31
32
/* Bring in externs for caller checking code.  */
33
GX_CALLER_CHECKING_EXTERNS
34
35
36
/**************************************************************************/
37
/*                                                                        */
38
/*  FUNCTION                                               RELEASE        */
39
/*                                                                        */
40
/*    _gxe_multi_line_text_button_text_set                PORTABLE C      */
41
/*                                                           6.1          */
42
/*  AUTHOR                                                                */
43
/*                                                                        */
44
/*    Kenneth Maxwell, Microsoft Corporation                              */
45
/*                                                                        */
46
/*  DESCRIPTION                                                           */
47
/*                                                                        */
48
/*    This function checks for errors in the text assigment.              */
49
/*                                                                        */
50
/*  INPUT                                                                 */
51
/*                                                                        */
52
/*    button                                Pointer to the button         */
53
/*                                            control block               */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    status                                Completion status             */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    _gx_multi_line_text_button_text_set   Actual text assignment        */
61
/*                                                                        */
62
/*  CALLED BY                                                             */
63
/*                                                                        */
64
/*    Application Code                                                    */
65
/*                                                                        */
66
/**************************************************************************/
67
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
68
7
UINT  _gxe_multi_line_text_button_text_set(GX_MULTI_LINE_TEXT_BUTTON *button,
69
                                           GX_CONST GX_CHAR *text)
70
{
71
UINT status;
72
73
    /* Check for appropriate caller.  */
74

7
    GX_INIT_AND_THREADS_CALLER_CHECKING
75
76
    /* Check for invalid input pointers.  */
77
5
    if (button == GX_NULL)
78
    {
79
2
        return(GX_PTR_ERROR);
80
    }
81
82
    /* Call the actual button draw function.  */
83
3
    status = _gx_multi_line_text_button_text_set(button, text);
84
85
    /* Return completion status.  */
86
3
    return status;
87
}
88
#endif
89
90
/**************************************************************************/
91
/*                                                                        */
92
/*  FUNCTION                                               RELEASE        */
93
/*                                                                        */
94
/*    _gxe_multi_line_text_button_text_set_ext            PORTABLE C      */
95
/*                                                           6.1          */
96
/*  AUTHOR                                                                */
97
/*                                                                        */
98
/*    Kenneth Maxwell, Microsoft Corporation                              */
99
/*                                                                        */
100
/*  DESCRIPTION                                                           */
101
/*                                                                        */
102
/*    This function checks for errors in the text assigment.              */
103
/*                                                                        */
104
/*  INPUT                                                                 */
105
/*                                                                        */
106
/*    button                                Pointer to the button         */
107
/*                                            control block               */
108
/*    text                                  Text to be set                */
109
/*                                                                        */
110
/*  OUTPUT                                                                */
111
/*                                                                        */
112
/*    status                                Completion status             */
113
/*                                                                        */
114
/*  CALLS                                                                 */
115
/*                                                                        */
116
/*    _gx_multi_line_text_button_text_set_ext                             */
117
/*                                          Actual text assignment        */
118
/*                                                                        */
119
/*  CALLED BY                                                             */
120
/*                                                                        */
121
/*    Application Code                                                    */
122
/*                                                                        */
123
/**************************************************************************/
124
8
UINT _gxe_multi_line_text_button_text_set_ext(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_STRING *text)
125
{
126
UINT status;
127
8
UINT text_length = 0;
128
129
    /* Check for appropriate caller.  */
130

8
    GX_INIT_AND_THREADS_CALLER_CHECKING
131
132
    /* Check for invalid input pointers.  */
133
6
    if (button == GX_NULL)
134
    {
135
1
        return(GX_PTR_ERROR);
136
    }
137
138
5
    if (text)
139
    {
140
4
        if (text -> gx_string_ptr)
141
        {
142
3
            status = _gx_utility_string_length_check(text -> gx_string_ptr, &text_length, text -> gx_string_length);
143
144
3
            if (status != GX_SUCCESS)
145
            {
146
1
                return status;
147
            }
148
        }
149
150
3
        if (text_length != text -> gx_string_length)
151
        {
152
1
            return GX_INVALID_STRING_LENGTH;
153
        }
154
    }
155
156
    /* Call the actual button draw function.  */
157
3
    status = _gx_multi_line_text_button_text_set_ext(button, text);
158
159
    /* Return completion status.  */
160
3
    return status;
161
}
162