Coverage Report

Created: 2025-06-13 07:22

/src/libevtx/libevtx/libevtx_i18n.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Internationalization (i18n) functions
3
 *
4
 * Copyright (C) 2011-2024, Joachim Metz <joachim.metz@gmail.com>
5
 *
6
 * Refer to AUTHORS for acknowledgements.
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Lesser General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public License
19
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
 */
21
22
#include <common.h>
23
#include <types.h>
24
25
#if defined( HAVE_LIBINTL_H ) && defined( ENABLE_NLS )
26
#include <libintl.h>
27
#endif
28
29
#include "libevtx_i18n.h"
30
#include "libevtx_libcerror.h"
31
32
static int libevtx_i18n_initialized = 0;
33
34
/* Initializes library internationalization functions
35
 */
36
int libevtx_i18n_initialize(
37
     libcerror_error_t **error )
38
733
{
39
733
  static char *function = "libevtx_i18n_initialize";
40
41
733
  if( libevtx_i18n_initialized == 0 )
42
1
  {
43
1
#if defined( HAVE_BINDTEXTDOMAIN ) && defined( LOCALEDIR )
44
1
    if( bindtextdomain(
45
1
         "libevtx",
46
1
         LOCALEDIR ) == NULL )
47
0
    {
48
0
      libcerror_error_set(
49
0
       error,
50
0
       LIBCERROR_ERROR_DOMAIN_RUNTIME,
51
0
       LIBCERROR_RUNTIME_ERROR_SET_FAILED,
52
0
       "%s: unable to bind text domain.",
53
0
       function );
54
55
0
      return( -1 );
56
0
    }
57
1
#endif /* defined( HAVE_BINDTEXTDOMAIN ) && defined( LOCALEDIR ) */
58
59
1
    libevtx_i18n_initialized = 1;
60
1
  }
61
733
  return( 1 );
62
733
}
63