Commit 8349b1a8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

modules: constify vlc_gettext()

The returned string is actually not modifiable. We have no obligations
to reproduce the deficient prototype of the standard gettext().
parent 123aa0a6
......@@ -1126,8 +1126,9 @@ static inline void *vlc_alloc(size_t count, size_t size)
/*****************************************************************************
* I18n stuff
*****************************************************************************/
VLC_API char *vlc_gettext( const char *msgid ) VLC_FORMAT_ARG(1);
VLC_API char *vlc_ngettext( const char *s, const char *p, unsigned long n ) VLC_FORMAT_ARG(1) VLC_FORMAT_ARG(2);
VLC_API const char *vlc_gettext(const char *msgid) VLC_FORMAT_ARG(1);
VLC_API const char *vlc_ngettext(const char *s, const char *p, unsigned long n)
VLC_FORMAT_ARG(1) VLC_FORMAT_ARG(2);
#define vlc_pgettext( ctx, id ) \
vlc_pgettext_aux( ctx "\004" id, id )
......
......@@ -55,7 +55,7 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): SkinObject( pIntf )
// Create a variable to add items in wxwindows popup menu
var_Create( pIntf, "intf-skins", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
text.psz_string = _("Select skin");
text.psz_string = (char *)_("Select skin");
var_Change( pIntf, "intf-skins", VLC_VAR_SETTEXT, &text );
// Scan vlt files in the resource path
......@@ -113,7 +113,7 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): SkinObject( pIntf )
// variable for opening a dialog box to change skins
var_Create( pIntf, "intf-skins-interactive", VLC_VAR_VOID |
VLC_VAR_ISCOMMAND );
text.psz_string = _("Open skin...");
text.psz_string = (char *)_("Open skin...");
var_Change( pIntf, "intf-skins-interactive", VLC_VAR_SETTEXT, &text );
// Set the callback
......
......@@ -210,9 +210,9 @@ uint_fast32_t vlc_str2keycode (const char *name)
return code;
}
static char *nooptext (const char *txt)
static const char *nooptext (const char *txt)
{
return (char *)txt;
return txt;
}
/**
......@@ -225,7 +225,7 @@ static char *nooptext (const char *txt)
*/
char *vlc_keycode2str (uint_fast32_t code, bool locale)
{
char *(*tr) (const char *) = locale ? vlc_gettext : nooptext;
const char *(*tr)(const char *) = locale ? vlc_gettext : nooptext;
const char *name;
char *str, buf[5];
uintptr_t key = code & ~KEY_MODIFIER;
......
......@@ -76,20 +76,21 @@ int vlc_bindtextdomain (const char *domain)
/**
* In-tree plugins share their gettext domain with LibVLC.
*/
char *vlc_gettext (const char *msgid)
const char *vlc_gettext(const char *msgid)
{
#ifdef ENABLE_NLS
if (likely(*msgid))
return dgettext (PACKAGE_NAME, msgid);
#endif
return (char *)msgid;
return msgid;
}
char *vlc_ngettext (const char *msgid, const char *plural, unsigned long n)
const char *vlc_ngettext(const char *msgid, const char *plural,
unsigned long n)
{
#ifdef ENABLE_NLS
if (likely(*msgid))
return dngettext (PACKAGE_NAME, msgid, plural, n);
#endif
return (char *)((n == 1) ? msgid : plural);
return ((n == 1) ? msgid : plural);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment