GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_binres_language_count_get.c Lines: 14 14 100.0 %
Date: 2026-03-06 19:21:09 Branches: 4 4 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
/**   Binres Loader Management (Binres Loader)                            */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_binres_loader.h"
29
#include "gx_system.h"
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_binres_language_count_get                       PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function retrives language count of specified binary resource. */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    root_address                          Root address of binary        */
48
/*                                            resource data               */
49
/*    header                                Returned Language count       */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    Status                                Completion status             */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    None                                                                */
58
/*                                                                        */
59
/*  CALLED BY                                                             */
60
/*                                                                        */
61
/*    Application Code                                                    */
62
/*    GUIX Internal Code                                                  */
63
/*                                                                        */
64
/**************************************************************************/
65
#ifdef GX_BINARY_RESOURCE_SUPPORT
66
3
UINT _gx_binres_language_count_get(GX_UBYTE *root_address, GX_VALUE *put_count)
67
{
68
3
UINT                status = GX_SUCCESS;
69
GX_BINRES_DATA_INFO info;
70
GX_RESOURCE_HEADER  header;
71
GX_STRING_HEADER    string_header;
72
73
3
    memset(&info, 0, sizeof(GX_BINRES_DATA_INFO));
74
75
3
    info.gx_binres_root_address = root_address;
76
77
    /* Read Resource header. */
78
3
    info.gx_binres_read_offset = 0;
79
3
    _gx_binres_resource_header_load(&info, &header);
80
81
    /* Skip theme info.  */
82
3
    info.gx_binres_read_offset += header.gx_resource_header_theme_data_size;
83
84
3
    if (header.gx_resource_header_magic_number != GX_MAGIC_NUMBER)
85
    {
86
1
        return GX_INVALID_FORMAT;
87
    }
88
89
    /* Read string header. */
90
2
    _gx_binres_string_header_load(&info, &string_header);
91
92
2
    if (string_header.gx_string_header_magic_number != GX_MAGIC_NUMBER)
93
    {
94
1
        status = GX_INVALID_FORMAT;
95
    }
96
    else
97
    {
98
1
        *put_count = (GX_VALUE)(string_header.gx_string_header_language_count);
99
    }
100
101
2
    return status;
102
}
103
#endif
104