"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "common/flatpak-utils.c" between
flatpak-1.12.1.tar.xz and flatpak-1.12.2.tar.xz

About: Flatpak is a Linux application sandboxing and distribution framework.

flatpak-utils.c  (flatpak-1.12.1.tar.xz):flatpak-utils.c  (flatpak-1.12.2.tar.xz)
/* /*
* Copyright © 1995-1998 Free Software Foundation, Inc.
* Copyright © 2014-2019 Red Hat, Inc * Copyright © 2014-2019 Red Hat, Inc
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
skipping to change at line 7943 skipping to change at line 7944
g_free (language); g_free (language);
if (mask & COMPONENT_CODESET) if (mask & COMPONENT_CODESET)
g_free (codeset); g_free (codeset);
if (mask & COMPONENT_TERRITORY) if (mask & COMPONENT_TERRITORY)
g_free (territory); g_free (territory);
if (mask & COMPONENT_MODIFIER) if (mask & COMPONENT_MODIFIER)
g_free (modifier); g_free (modifier);
} }
/* The following is (partly) taken from the gettext package.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. */
static const gchar *
guess_category_value (const gchar *category_name)
{
const gchar *retval;
/* The highest priority value is the 'LANGUAGE' environment
variable. This is a GNU extension. */
retval = g_getenv ("LANGUAGE");
if ((retval != NULL) && (retval[0] != '\0'))
return retval;
/* 'LANGUAGE' is not set. So we have to proceed with the POSIX
methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'. On some
systems this can be done by the 'setlocale' function itself. */
/* Setting of LC_ALL overwrites all other. */
retval = g_getenv ("LC_ALL");
if ((retval != NULL) && (retval[0] != '\0'))
return retval;
/* Next comes the name of the desired category. */
retval = g_getenv (category_name);
if ((retval != NULL) && (retval[0] != '\0'))
return retval;
/* Last possibility is the LANG environment variable. */
retval = g_getenv ("LANG");
if ((retval != NULL) && (retval[0] != '\0'))
return retval;
#ifdef G_PLATFORM_WIN32
/* g_win32_getlocale() first checks for LC_ALL, LC_MESSAGES and
* LANG, which we already did above. Oh well. The main point of
* calling g_win32_getlocale() is to get the thread's locale as used
* by Windows and the Microsoft C runtime (in the "English_United
* States" format) translated into the Unixish format.
*/
{
char *locale = g_win32_getlocale ();
retval = g_intern_string (locale);
g_free (locale);
return retval;
}
#endif
return NULL;
}
static const gchar * const * static const gchar * const *
g_get_language_names_with_category (const gchar *category_name) g_get_language_names_with_category (const gchar *category_name)
{ {
static GPrivate cache_private = G_PRIVATE_INIT ((void (*)(gpointer)) g_hash_ta ble_unref); static GPrivate cache_private = G_PRIVATE_INIT ((void (*)(gpointer)) g_hash_ta ble_unref);
GHashTable *cache = g_private_get (&cache_private); GHashTable *cache = g_private_get (&cache_private);
const gchar *languages; const gchar *languages;
GLanguageNamesCache *name_cache; GLanguageNamesCache *name_cache;
g_return_val_if_fail (category_name != NULL, NULL); g_return_val_if_fail (category_name != NULL, NULL);
if (!cache) if (!cache)
{ {
cache = g_hash_table_new_full (g_str_hash, g_str_equal, cache = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, language_names_cache_free); g_free, language_names_cache_free);
g_private_set (&cache_private, cache); g_private_set (&cache_private, cache);
} }
/* Backporting note: we don't bother checking all the other LC_* variants as languages = guess_category_value (category_name);
fallbacks, because Flatpak will be reading all the categories individually
anyway. */
languages = g_getenv (category_name);
if (!languages) if (!languages)
languages = "C"; languages = "C";
name_cache = (GLanguageNamesCache *) g_hash_table_lookup (cache, category_name ); name_cache = (GLanguageNamesCache *) g_hash_table_lookup (cache, category_name );
if (!(name_cache && name_cache->languages && if (!(name_cache && name_cache->languages &&
strcmp (name_cache->languages, languages) == 0)) strcmp (name_cache->languages, languages) == 0))
{ {
GPtrArray *array; GPtrArray *array;
gchar **alist, **a; gchar **alist, **a;
 End of changes. 3 change blocks. 
4 lines changed or deleted 53 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)