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 /**   Binres Loader Management (Binres Loader)                            */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_binres_loader.h"
28 #include "gx_system.h"
29 
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gxe_binres_font_load                               PORTABLE C      */
36 /*                                                           6.3.0        */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Ting Zhu, Microsoft Corporation                                     */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function checks for errors in binres font load function.       */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    root_address                          Pointer to the binary data    */
48 /*                                            memory                      */
49 /*    font_index                            Resource index of the font    */
50 /*                                            to be loaded                */
51 /*    buffer                                Pointer to the buffer to      */
52 /*                                            store the loaded font       */
53 /*    buffer_size                           Size of the buffer. It will   */
54 /*                                            be overwritten with the     */
55 /*                                            required buffer size if the */
56 /*                                            input buffer size is        */
57 /*                                            insufficient                */
58 /*                                                                        */
59 /*  OUTPUT                                                                */
60 /*                                                                        */
61 /*    status                                Completion status             */
62 /*                                                                        */
63 /*  CALLS                                                                 */
64 /*                                                                        */
65 /*    _gx_binres_font_load                  The actual binres font load   */
66 /*                                            function                    */
67 /*                                                                        */
68 /*  CALLED BY                                                             */
69 /*                                                                        */
70 /*    Application Code                                                    */
71 /*                                                                        */
72 /*  RELEASE HISTORY                                                       */
73 /*                                                                        */
74 /*    DATE              NAME                      DESCRIPTION             */
75 /*                                                                        */
76 /*  10-31-2023     Ting Zhu                 Initial Version 6.3.0         */
77 /*                                                                        */
78 /**************************************************************************/
_gxe_binres_font_load(GX_UBYTE * root_address,UINT font_index,GX_UBYTE * buffer,ULONG * buffer_size)79 UINT _gxe_binres_font_load(GX_UBYTE *root_address, UINT font_index, GX_UBYTE *buffer, ULONG *buffer_size)
80 {
81     if (root_address == GX_NULL || buffer == GX_NULL || buffer_size == GX_NULL)
82     {
83         return GX_PTR_ERROR;
84     }
85 
86     return _gx_binres_font_load(root_address, font_index, buffer, buffer_size);
87 }
88 
89