GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
/*************************************************************************** |
||
2 |
* Copyright (c) 2024 Microsoft Corporation |
||
3 |
* |
||
4 |
* This program and the accompanying materials are made available under the |
||
5 |
* terms of the MIT License which is available at |
||
6 |
* https://opensource.org/licenses/MIT. |
||
7 |
* |
||
8 |
* SPDX-License-Identifier: MIT |
||
9 |
**************************************************************************/ |
||
10 |
|||
11 |
|||
12 |
/**************************************************************************/ |
||
13 |
/**************************************************************************/ |
||
14 |
/** */ |
||
15 |
/** GUIX Component */ |
||
16 |
/** */ |
||
17 |
/** System Management (System) */ |
||
18 |
/** */ |
||
19 |
/**************************************************************************/ |
||
20 |
|||
21 |
#define GX_SOURCE_CODE |
||
22 |
|||
23 |
|||
24 |
/* Include necessary system files. */ |
||
25 |
|||
26 |
#include "gx_api.h" |
||
27 |
#include "gx_system.h" |
||
28 |
#include "gx_utility.h" |
||
29 |
|||
30 |
/* Bring in externs for caller checking code. */ |
||
31 |
GX_CALLER_CHECKING_EXTERNS |
||
32 |
|||
33 |
/**************************************************************************/ |
||
34 |
/* */ |
||
35 |
/* FUNCTION RELEASE */ |
||
36 |
/* */ |
||
37 |
/* _gxe_system_string_width_get PORTABLE C */ |
||
38 |
/* 6.1 */ |
||
39 |
/* AUTHOR */ |
||
40 |
/* */ |
||
41 |
/* Kenneth Maxwell, Microsoft Corporation */ |
||
42 |
/* */ |
||
43 |
/* DESCRIPTION */ |
||
44 |
/* */ |
||
45 |
/* This function checks for errors in system string width get call. */ |
||
46 |
/* */ |
||
47 |
/* INPUT */ |
||
48 |
/* */ |
||
49 |
/* font Font used by the string */ |
||
50 |
/* string Pointer to string */ |
||
51 |
/* string_length Length of string */ |
||
52 |
/* return_width Destination for width of */ |
||
53 |
/* string */ |
||
54 |
/* */ |
||
55 |
/* OUTPUT */ |
||
56 |
/* */ |
||
57 |
/* status Completion status */ |
||
58 |
/* */ |
||
59 |
/* CALLS */ |
||
60 |
/* */ |
||
61 |
/* _gx_utility_string_length_check Test string length */ |
||
62 |
/* _gx_system_string_width_get Actual system string width */ |
||
63 |
/* get call */ |
||
64 |
/* */ |
||
65 |
/* CALLED BY */ |
||
66 |
/* */ |
||
67 |
/* Application Code */ |
||
68 |
/* */ |
||
69 |
/* RELEASE HISTORY */ |
||
70 |
/* */ |
||
71 |
/* DATE NAME DESCRIPTION */ |
||
72 |
/* */ |
||
73 |
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
||
74 |
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
||
75 |
/* resulting in version 6.1 */ |
||
76 |
/* */ |
||
77 |
/**************************************************************************/ |
||
78 |
#if defined(GX_ENABLE_DEPRECATED_STRING_API) |
||
79 |
12 |
UINT _gxe_system_string_width_get(GX_CONST GX_FONT *font, GX_CONST GX_CHAR *string, INT string_length, GX_VALUE *return_width) |
|
80 |
{ |
||
81 |
UINT status; |
||
82 |
UINT length; |
||
83 |
|||
84 |
/* Check for invalid caller. */ |
||
85 |
✓✓✓✓ ✓✓ |
12 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
86 |
|||
87 |
/* Check for invalid pointer. */ |
||
88 |
✓✓✓✓ ✓✓ |
10 |
if ((font == GX_NULL) || (string == GX_NULL) || (return_width == GX_NULL)) |
89 |
{ |
||
90 |
3 |
return(GX_PTR_ERROR); |
|
91 |
} |
||
92 |
|||
93 |
/* Check for invalid font. */ |
||
94 |
✓✓ | 7 |
if (font -> gx_font_glyphs.gx_font_normal_glyphs == GX_NULL) |
95 |
{ |
||
96 |
2 |
return(GX_INVALID_FONT); |
|
97 |
} |
||
98 |
|||
99 |
✓✓ | 5 |
if(string_length > 0) |
100 |
{ |
||
101 |
/* Calculate input string length. */ |
||
102 |
3 |
status = _gx_utility_string_length_check(string, &length, GX_MAX_STRING_LENGTH); |
|
103 |
|||
104 |
✓✓ | 3 |
if (status != GX_SUCCESS) |
105 |
{ |
||
106 |
1 |
return status; |
|
107 |
} |
||
108 |
|||
109 |
/* Check for invalid string length. */ |
||
110 |
✓✓ | 2 |
if (string_length > (INT)length) |
111 |
{ |
||
112 |
1 |
return(GX_INVALID_STRING_LENGTH); |
|
113 |
} |
||
114 |
} |
||
115 |
|||
116 |
/* Call actual system string width get. */ |
||
117 |
3 |
status = _gx_system_string_width_get(font, string, string_length, return_width); |
|
118 |
|||
119 |
/* Return status. */ |
||
120 |
3 |
return(status); |
|
121 |
} |
||
122 |
#endif |
||
123 |
|||
124 |
/**************************************************************************/ |
||
125 |
/* */ |
||
126 |
/* FUNCTION RELEASE */ |
||
127 |
/* */ |
||
128 |
/* _gx_system_string_width_get_ext PORTABLE C */ |
||
129 |
/* 6.1 */ |
||
130 |
/* AUTHOR */ |
||
131 |
/* */ |
||
132 |
/* Kenneth Maxwell, Microsoft Corporation */ |
||
133 |
/* */ |
||
134 |
/* DESCRIPTION */ |
||
135 |
/* */ |
||
136 |
/* This function checks for errors in system string width get call. */ |
||
137 |
/* */ |
||
138 |
/* INPUT */ |
||
139 |
/* */ |
||
140 |
/* font Font used by the string */ |
||
141 |
/* string Pointer to string */ |
||
142 |
/* return_width Destination for width of */ |
||
143 |
/* string */ |
||
144 |
/* */ |
||
145 |
/* OUTPUT */ |
||
146 |
/* */ |
||
147 |
/* status Completion status */ |
||
148 |
/* */ |
||
149 |
/* CALLS */ |
||
150 |
/* */ |
||
151 |
/* _gx_utility_string_length_check Test string length */ |
||
152 |
/* _gx_system_string_width_get_ext Actual system string width */ |
||
153 |
/* get exe call */ |
||
154 |
/* */ |
||
155 |
/* CALLED BY */ |
||
156 |
/* */ |
||
157 |
/* Application Code */ |
||
158 |
/* */ |
||
159 |
/* RELEASE HISTORY */ |
||
160 |
/* */ |
||
161 |
/* DATE NAME DESCRIPTION */ |
||
162 |
/* */ |
||
163 |
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
||
164 |
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
||
165 |
/* resulting in version 6.1 */ |
||
166 |
/* */ |
||
167 |
/**************************************************************************/ |
||
168 |
9 |
UINT _gxe_system_string_width_get_ext(GX_CONST GX_FONT *font, GX_CONST GX_STRING *string, GX_VALUE *return_width) |
|
169 |
{ |
||
170 |
UINT status; |
||
171 |
UINT length; |
||
172 |
|||
173 |
/* Check for invalid caller. */ |
||
174 |
✓✓✓✓ ✓✓ |
9 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
175 |
|||
176 |
/* Check for invalid pointer. */ |
||
177 |
✓✓✓✓ ✓✓ |
7 |
if ((font == GX_NULL) || (string == GX_NULL) || (return_width == GX_NULL)) |
178 |
{ |
||
179 |
3 |
return(GX_PTR_ERROR); |
|
180 |
} |
||
181 |
|||
182 |
/* Check for invalid font. */ |
||
183 |
✓✓ | 4 |
if (font -> gx_font_glyphs.gx_font_normal_glyphs == GX_NULL) |
184 |
{ |
||
185 |
1 |
return(GX_INVALID_FONT); |
|
186 |
} |
||
187 |
|||
188 |
/* Calculate input string length. */ |
||
189 |
3 |
status = _gx_utility_string_length_check(string -> gx_string_ptr, &length, string -> gx_string_length); |
|
190 |
|||
191 |
✓✓ | 3 |
if (status != GX_SUCCESS) |
192 |
{ |
||
193 |
1 |
return status; |
|
194 |
} |
||
195 |
|||
196 |
/* Check for invalid string length. */ |
||
197 |
✓✓ | 2 |
if (string -> gx_string_length > length) |
198 |
{ |
||
199 |
1 |
return(GX_INVALID_STRING_LENGTH); |
|
200 |
} |
||
201 |
|||
202 |
/* Call actual system string width get. */ |
||
203 |
1 |
status = _gx_system_string_width_get_ext(font, string, return_width); |
|
204 |
|||
205 |
/* Return status. */ |
||
206 |
1 |
return(status); |
|
207 |
} |
||
208 |
Generated by: GCOVR (Version 4.1) |