version 1.1.1.2, 2012/05/29 09:29:43
|
version 1.1.1.3, 2021/03/17 13:38:46
|
Line 1
|
Line 1
|
/* Convenience header for conditional use of GNU <libintl.h>. |
/* Convenience header for conditional use of GNU <libintl.h>. |
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software | Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2019 Free Software |
Foundation, Inc. |
Foundation, Inc. |
|
|
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
Line 13
|
Line 13
|
GNU General Public License for more details. |
GNU General Public License for more details. |
|
|
You should have received a copy of the GNU General Public License along |
You should have received a copy of the GNU General Public License along |
with this program; if not, write to the Free Software Foundation, | with this program; if not, see <https://www.gnu.org/licenses/>. */ |
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
|
|
#ifndef _LIBGETTEXT_H |
#ifndef _LIBGETTEXT_H |
#define _LIBGETTEXT_H 1 |
#define _LIBGETTEXT_H 1 |
|
|
/* NLS can be disabled through the configure --disable-nls option. */ | /* NLS can be disabled through the configure --disable-nls option |
#if ENABLE_NLS | or through "#define ENABLE NLS 0" before including this file. */ |
| #if defined ENABLE_NLS && ENABLE_NLS |
|
|
/* Get declarations of GNU message catalog functions. */ |
/* Get declarations of GNU message catalog functions. */ |
# include <libintl.h> |
# include <libintl.h> |
Line 184 npgettext_aux (const char *domain,
|
Line 184 npgettext_aux (const char *domain,
|
|
|
#include <string.h> |
#include <string.h> |
|
|
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ | /* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported. |
(((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ | This relates to the -Wvla and -Wvla-larger-than warnings, enabled in |
/* || __STDC_VERSION__ >= 199901L */ ) | the default GCC many warnings set. This allows programs to disable use |
| of VLAs, which may be unintended, or may be awkward to support portably, |
| or may have security implications due to non-deterministic stack usage. */ |
|
|
|
#if (!defined GNULIB_NO_VLA \ |
|
&& (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ |
|
/* || (__STDC_VERSION__ == 199901L && !defined __HP_cc) |
|
|| (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )) |
|
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 |
|
#else |
|
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 |
|
#endif |
|
|
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
#include <stdlib.h> |
#include <stdlib.h> |
#endif |
#endif |
Line 223 dcpgettext_expr (const char *domain,
|
Line 234 dcpgettext_expr (const char *domain,
|
if (msg_ctxt_id != NULL) |
if (msg_ctxt_id != NULL) |
#endif |
#endif |
{ |
{ |
|
int found_translation; |
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); |
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); |
msg_ctxt_id[msgctxt_len - 1] = '\004'; |
msg_ctxt_id[msgctxt_len - 1] = '\004'; |
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); |
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); |
translation = dcgettext (domain, msg_ctxt_id, category); |
translation = dcgettext (domain, msg_ctxt_id, category); |
|
found_translation = (translation != msg_ctxt_id); |
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
if (msg_ctxt_id != buf) |
if (msg_ctxt_id != buf) |
free (msg_ctxt_id); |
free (msg_ctxt_id); |
#endif |
#endif |
if (translation != msg_ctxt_id) | if (found_translation) |
return translation; |
return translation; |
} |
} |
return msgid; |
return msgid; |
Line 269 dcnpgettext_expr (const char *domain,
|
Line 282 dcnpgettext_expr (const char *domain,
|
if (msg_ctxt_id != NULL) |
if (msg_ctxt_id != NULL) |
#endif |
#endif |
{ |
{ |
|
int found_translation; |
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); |
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); |
msg_ctxt_id[msgctxt_len - 1] = '\004'; |
msg_ctxt_id[msgctxt_len - 1] = '\004'; |
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); |
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); |
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); |
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); |
|
found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); |
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
if (msg_ctxt_id != buf) |
if (msg_ctxt_id != buf) |
free (msg_ctxt_id); |
free (msg_ctxt_id); |
#endif |
#endif |
if (!(translation == msg_ctxt_id || translation == msgid_plural)) | if (found_translation) |
return translation; |
return translation; |
} |
} |
return (n == 1 ? msgid : msgid_plural); |
return (n == 1 ? msgid : msgid_plural); |