Hello community, here is the log from the commit of package libcompizconfig for openSUSE:Factory checked in at 2020-04-05 20:56:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libcompizconfig (Old) and /work/SRC/openSUSE:Factory/.libcompizconfig.new.3248 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libcompizconfig" Sun Apr 5 20:56:41 2020 rev:10 rq:791518 version:0.8.18 Changes: -------- --- /work/SRC/openSUSE:Factory/libcompizconfig/libcompizconfig.changes 2019-11-01 15:13:53.576735877 +0100 +++ /work/SRC/openSUSE:Factory/.libcompizconfig.new.3248/libcompizconfig.changes 2020-04-05 20:56:45.233391764 +0200 @@ -1,0 +2,11 @@ +Sat Apr 4 22:34:57 UTC 2020 - Alexei Sorokin <sor.ale...@meowr.ru> + +- Update to version 0.8.18: + * Read SYSCONFDIR/compizconfig/presets.ini as default values if + exists. + * Avoid using glibc-specific strcasestr and asprintf. +- Rebase libcompizconfig-config-dir.patch. +- Improve libcompizconfig-configure-retval.patch: there is no need + in a return value at all. + +------------------------------------------------------------------- Old: ---- libcompizconfig-0.8.16.tar.xz New: ---- libcompizconfig-0.8.18.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libcompizconfig.spec ++++++ --- /var/tmp/diff_new_pack.lcC2m8/_old 2020-04-05 20:56:46.581393210 +0200 +++ /var/tmp/diff_new_pack.lcC2m8/_new 2020-04-05 20:56:46.581393210 +0200 @@ -1,7 +1,7 @@ # # spec file for package libcompizconfig # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,19 +16,19 @@ # -%define _rev f5a51bfcae611276064ba8b9048c294e +%define _rev ada252d7170ae626651a98fd03569e1f %define sover 0 Name: libcompizconfig -Version: 0.8.16 +Version: 0.8.18 Release: 0 Summary: CompizConfig plugin required for CCSM License: GPL-2.0-or-later -Group: System/Libraries URL: https://gitlab.com/compiz/libcompizconfig Source: https://gitlab.com/compiz/libcompizconfig/uploads/%{_rev}/%{name}-%{version}.tar.xz # PATCH-FIX-OPENSUSE libcompizconfig-config-dir.patch boo#438081 rodr...@novell.com Patch0: %{name}-config-dir.patch -Patch1: libcompizconfig-configure-retval.patch +# PATCH-FIX-UPSTREAM libcompizconfig-configure-retval.patch r...@suse.de +Patch1: %{name}-configure-retval.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: gcc-c++ @@ -47,7 +47,6 @@ %package devel Summary: Development files for libcompizconfig -Group: Development/Libraries/C and C++ Requires: %{name} = %{version} Requires: pkgconfig Requires: pkgconfig(compiz) < 0.9 @@ -61,15 +60,13 @@ This package contains development files. %prep -%setup -q -%patch0 -p1 -%patch1 -p1 +%autosetup -p1 %build NOCONFIGURE=1 ./autogen.sh %configure \ --disable-static -make %{?_smp_mflags} V=1 +%make_build %install %make_install ++++++ libcompizconfig-0.8.16.tar.xz -> libcompizconfig-0.8.18.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/ChangeLog new/libcompizconfig-0.8.18/ChangeLog --- old/libcompizconfig-0.8.16/ChangeLog 2018-11-11 18:21:31.000000000 +0100 +++ new/libcompizconfig-0.8.18/ChangeLog 2020-04-04 20:40:29.000000000 +0200 @@ -1,3 +1,84 @@ +commit 1fc177123f4da3e2eddffc916d663fc68fdbab04 +Author: Alex ARNAUD <aarn...@hypra.fr> +Date: Sat Apr 4 12:40:09 2020 -0600 + + Release version 0.8.18 + + NEWS | 8 ++++++++ + configure.ac | 2 +- + 2 files changed, 9 insertions(+), 1 deletion(-) + +commit c3d65e489a3b15bcce19f59ef82a36b25acd0ce2 +Merge: 0a18999 c94e5ba +Author: Scott Moreau <ore...@gmail.com> +Date: Tue Nov 5 18:43:58 2019 +0000 + + Merge branch 'presets' into 'master' + + Read SYSCONFDIR/compizconfig/presets.ini as default values + + Closes #4 + + See merge request compiz/libcompizconfig!1 + +commit c94e5ba114a778c18d6e8a3179f21ec798102682 +Author: Jonathan Michalon <d...@michalon.eu> +Date: Tue Oct 29 16:45:40 2019 +0100 + + Read SYSCONFDIR/compizconfig/presets.ini as default values + + Just after reading the XML files and before loading user profiles, + we now read SYSCONFDIR/compizconfig/presets.ini and set the definitions + in there as default values, overriding these from XML. This allows + distributions to provide a set of custom defaults. + + backend/ini.c | 150 +----------------------------------------------------- + include/ccs.h | 6 +++ + src/compiz.cpp | 28 +++++++++++ + src/ini.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/main.c | 7 +++ + 5 files changed, 198 insertions(+), 149 deletions(-) + +commit 0a1899922dbb298a589285e0c3221ac3173bb79a +Author: Alexei Sorokin <sor.ale...@meowr.ru> +Date: Wed Dec 12 16:00:51 2018 +0300 + + Improve "Avoid using glibc-specific strcasestr and asprintf" + + Use a more efficient for smaller strings algorithm. + The older code also had an issue when snprintf() returns a negative value. + + backend/ini.c | 20 +++++++++++++------- + src/main.c | 20 +++++++++++++------- + 2 files changed, 26 insertions(+), 14 deletions(-) + +commit 181b047d3b7a6030a7239dcaa4569120c29ca9f8 +Author: Alexei Sorokin <sor.ale...@meowr.ru> +Date: Mon Nov 12 23:49:50 2018 +0300 + + Avoid using glibc-specific strcasestr and asprintf + + backend/ini.c | 97 ++++++++++++++++++++++++++++++----------------- + plugin/ccp.c | 2 - + src/bindings.c | 26 ++++++++++--- + src/ccs-private.h | 2 + + src/compiz.cpp | 44 ++++++++++------------ + src/config.c | 28 ++++++-------- + src/filewatch.c | 1 - + src/ini.c | 34 ++++++++++------- + src/lists.c | 1 - + src/main.c | 110 +++++++++++++++++++++++++++++++++++++----------------- + 10 files changed, 214 insertions(+), 131 deletions(-) + +commit 3cec64a3568f6bc6314469bd92b6911e69306be9 +Author: Scott Moreau <ore...@gmail.com> +Date: Sun Nov 11 10:59:30 2018 -0700 + + Post-release version increment + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit cc7f611a8a93702c6eda77e7e76a444168f3a896 Author: Scott Moreau <ore...@gmail.com> Date: Sun Nov 11 10:21:12 2018 -0700 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/NEWS new/libcompizconfig-0.8.18/NEWS --- old/libcompizconfig-0.8.16/NEWS 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/NEWS 2020-04-04 20:37:10.000000000 +0200 @@ -1,3 +1,11 @@ +Release 0.8.18 (2020-04-04 The Compiz Reloaded Team) +================================================================== +COMPIZ-RELOADED + +Read SYSCONFDIR/compizconfig/presets.ini as default values if exists + +Avoid using glibc-specific strcasestr and asprintf + Release 0.8.16 (2018-11-11 Scott Moreau <ore...@gmail.com>) ================================================================== COMPIZ-RELOADED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/backend/ini.c new/libcompizconfig-0.8.18/backend/ini.c --- old/libcompizconfig-0.8.16/backend/ini.c 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/backend/ini.c 2020-02-11 12:22:38.000000000 +0100 @@ -18,8 +18,8 @@ * **/ -#define _GNU_SOURCE #include <stdio.h> +#include <stdarg.h> #include <stdlib.h> #include <string.h> #include <malloc.h> @@ -57,7 +57,35 @@ /* forward declaration */ static void setProfile (IniPrivData *data, char *profile); -static IniPrivData* +static char * +strdup_printf (const char *format, ...) +{ + char *string; + const int init_size = 100; + char stack[init_size]; + int size; + va_list args, args2; + + va_start (args, format); + size = vsnprintf (stack, init_size, format, args); + va_end (args); + + if (size < 0) + return NULL; + + string = calloc ((unsigned long) size + 1UL, sizeof (char)); + if (string != NULL && size + 1 > init_size) + { + va_start (args2, format); + vsprintf (string, format, args2); + va_end (args2); + } + else if (string != NULL) + memcpy (string, stack, (unsigned long) size + 1UL); + return string; +} + +static IniPrivData * findPrivFromContext (CCSContext *context) { int i; @@ -73,25 +101,23 @@ return data; } -static char* +static char * getIniFileName (char *profile) { - char *configDir = NULL; - char *fileName = NULL; + const char *configDir; + const char *homeDir; configDir = getenv ("XDG_CONFIG_HOME"); - if (configDir && strlen (configDir)) + if (configDir != NULL && strlen (configDir) > 0) { - asprintf (&fileName, "%s/%s/%s.ini", configDir, SETTINGPATH, profile); - return fileName; + return strdup_printf ("%s/%s/%s.ini", configDir, SETTINGPATH, profile); } - configDir = getenv ("HOME"); - if (configDir && strlen (configDir)) + homeDir = getenv ("HOME"); + if (homeDir != NULL && strlen (homeDir) > 0) { - asprintf (&fileName, "%s/.config/%s/%s.ini", configDir, SETTINGPATH, - profile); - return fileName; + return strdup_printf ("%s/.config/%s/%s.ini", homeDir, SETTINGPATH, + profile); } return NULL; @@ -257,158 +283,13 @@ readSetting (CCSContext *context, CCSSetting *setting) { - Bool status = FALSE; - char *keyName; IniPrivData *data; data = findPrivFromContext (context); if (!data) return; - if (setting->isScreen) - asprintf (&keyName, "s%d_%s", setting->screenNum, setting->name); - else - asprintf (&keyName, "as_%s", setting->name); - - switch (setting->type) - { - case TypeString: - { - char *value; - if (ccsIniGetString (data->iniFile, setting->parent->name, - keyName, &value)) - { - ccsSetString (setting, value); - free (value); - status = TRUE; - } - } - break; - case TypeMatch: - { - char *value; - if (ccsIniGetString (data->iniFile, setting->parent->name, - keyName, &value)) - { - ccsSetMatch (setting, value); - free (value); - status = TRUE; - } - } - break; - case TypeInt: - { - int value; - if (ccsIniGetInt (data->iniFile, setting->parent->name, - keyName, &value)) - { - ccsSetInt (setting, value); - status = TRUE; - } - } - break; - case TypeBool: - { - Bool value; - if (ccsIniGetBool (data->iniFile, setting->parent->name, - keyName, &value)) - { - ccsSetBool (setting, (value != 0)); - status = TRUE; - } - } - break; - case TypeFloat: - { - float value; - if (ccsIniGetFloat (data->iniFile, setting->parent->name, - keyName, &value)) - { - ccsSetFloat (setting, value); - status = TRUE; - } - } - break; - case TypeColor: - { - CCSSettingColorValue color; - - if (ccsIniGetColor (data->iniFile, setting->parent->name, - keyName, &color)) - { - ccsSetColor (setting, color); - status = TRUE; - } - } - break; - case TypeKey: - { - CCSSettingKeyValue key; - if (ccsIniGetKey (data->iniFile, setting->parent->name, - keyName, &key)) - { - ccsSetKey (setting, key); - status = TRUE; - } - } - break; - case TypeButton: - { - CCSSettingButtonValue button; - if (ccsIniGetButton (data->iniFile, setting->parent->name, - keyName, &button)) - { - ccsSetButton (setting, button); - status = TRUE; - } - } - break; - case TypeEdge: - { - unsigned int edges; - if (ccsIniGetEdge (data->iniFile, setting->parent->name, - keyName, &edges)) - { - ccsSetEdge (setting, edges); - status = TRUE; - } - } - break; - case TypeBell: - { - Bool bell; - if (ccsIniGetBell (data->iniFile, setting->parent->name, - keyName, &bell)) - { - ccsSetBell (setting, bell); - status = TRUE; - } - } - break; - case TypeList: - { - CCSSettingValueList value; - if (ccsIniGetList (data->iniFile, setting->parent->name, - keyName, &value, setting)) - { - ccsSetList (setting, value); - ccsSettingValueListFree (value, TRUE); - status = TRUE; - } - } - break; - default: - break; - } - - if (!status) - { - /* reset setting to default if it could not be read */ - ccsResetToDefault (setting); - } - - if (keyName) - free (keyName); + ccsIniReadSetting (data->iniFile, setting); } static void @@ -459,9 +340,12 @@ return; if (setting->isScreen) - asprintf (&keyName, "s%d_%s", setting->screenNum, setting->name); + keyName = strdup_printf ("s%d_%s", setting->screenNum, setting->name); else - asprintf (&keyName, "as_%s", setting->name); + keyName = strdup_printf ("as_%s", setting->name); + + if (keyName == NULL) + return; if (setting->isDefault) { @@ -650,33 +534,36 @@ static CCSStringList getExistingProfiles (CCSContext * context) { - CCSStringList ret = NULL; - char *filePath = NULL; - char *homeDir = NULL; - char *configDir = NULL; - + CCSStringList ret; + const char *configDir; + const char *homeDir; + char *filePath; + configDir = getenv ("XDG_CONFIG_HOME"); - if (configDir && strlen (configDir)) + if (configDir != NULL && strlen (configDir) > 0) { - asprintf (&filePath, "%s/%s", configDir, SETTINGPATH); - - ret = scanConfigDir(filePath); - free(filePath); + filePath = strdup_printf ("%s/%s", configDir, SETTINGPATH); + + if (filePath == NULL) + return NULL; - if (ret) + ret = scanConfigDir (filePath); + free (filePath); + + if (ret != NULL) return ret; } - + homeDir = getenv ("HOME"); - if (!homeDir) + if (homeDir == NULL && strlen (configDir) <= 0) return NULL; - asprintf (&filePath, "%s/.config/%s", homeDir, SETTINGPATH); - if (!filePath) + filePath = strdup_printf ("%s/.config/%s", homeDir, SETTINGPATH); + if (filePath == NULL) return NULL; - ret = scanConfigDir(filePath); - free(filePath); + ret = scanConfigDir (filePath); + free (filePath); return ret; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/configure new/libcompizconfig-0.8.18/configure --- old/libcompizconfig-0.8.16/configure 2018-11-11 18:21:17.000000000 +0100 +++ new/libcompizconfig-0.8.18/configure 2020-04-04 20:40:25.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libcompizconfig 0.8.16. +# Generated by GNU Autoconf 2.69 for libcompizconfig 0.8.18. # # Report bugs to <chat-to...@raveit.de>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libcompizconfig' PACKAGE_TARNAME='libcompizconfig' -PACKAGE_VERSION='0.8.16' -PACKAGE_STRING='libcompizconfig 0.8.16' +PACKAGE_VERSION='0.8.18' +PACKAGE_STRING='libcompizconfig 0.8.18' PACKAGE_BUGREPORT='chat-to...@raveit.de' PACKAGE_URL='' @@ -1369,7 +1369,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libcompizconfig 0.8.16 to adapt to many kinds of systems. +\`configure' configures libcompizconfig 0.8.18 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1440,7 +1440,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libcompizconfig 0.8.16:";; + short | recursive ) echo "Configuration of libcompizconfig 0.8.18:";; esac cat <<\_ACEOF @@ -1577,7 +1577,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libcompizconfig configure 0.8.16 +libcompizconfig configure 0.8.18 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2067,7 +2067,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libcompizconfig $as_me 0.8.16, which was +It was created by libcompizconfig $as_me 0.8.18, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2930,7 +2930,7 @@ # Define the identity of the package. PACKAGE='libcompizconfig' - VERSION='0.8.16' + VERSION='0.8.18' cat >>confdefs.h <<_ACEOF @@ -18413,7 +18413,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libcompizconfig $as_me 0.8.16, which was +This file was extended by libcompizconfig $as_me 0.8.18, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18479,7 +18479,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libcompizconfig config.status 0.8.16 +libcompizconfig config.status 0.8.18 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/configure.ac new/libcompizconfig-0.8.18/configure.ac --- old/libcompizconfig-0.8.16/configure.ac 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/configure.ac 2020-04-04 20:36:06.000000000 +0200 @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([libcompizconfig], [0.8.16], [chat-to...@raveit.de]) +AC_INIT([libcompizconfig], [0.8.18], [chat-to...@raveit.de]) AM_INIT_AUTOMAKE([1.9 foreign tar-ustar dist-xz no-dist-gzip check-news]) AC_PROG_CXX diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/include/ccs.h new/libcompizconfig-0.8.18/include/ccs.h --- old/libcompizconfig-0.8.16/include/ccs.h 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/include/ccs.h 2020-02-11 12:22:38.000000000 +0100 @@ -667,6 +667,9 @@ previously are added to the changedSettings list of the context. */ void ccsResetToDefault (CCSSetting * setting); +/* Sets the current value as default value */ +void ccsSetAsDefault (CCSSetting * setting); + /* Exports a profile to a file. If skipDefaults is TRUE, only exports non-default settings. Returns TRUE on successful export, FALSE otherwise. */ Bool ccsExportToFile (CCSContext *context, @@ -805,6 +808,9 @@ const char *section, const char *entry); +void ccsIniReadSetting (IniDictionary *dictionary, + CCSSetting *setting); + /* Checks if a plugin can be enabled. Returns a list of conflicts that would occur when loading the plugin. A return value of NULL means that the plugin can be enabled without problems. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/plugin/ccp.c new/libcompizconfig-0.8.18/plugin/ccp.c --- old/libcompizconfig-0.8.16/plugin/ccp.c 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/plugin/ccp.c 2020-02-11 12:22:38.000000000 +0100 @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#define _GNU_SOURCE - #ifdef HAVE_CONFIG_H # include "../config.h" #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/src/bindings.c new/libcompizconfig-0.8.18/src/bindings.c --- old/libcompizconfig-0.8.16/src/bindings.c 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/src/bindings.c 2020-02-11 12:22:38.000000000 +0100 @@ -25,8 +25,6 @@ */ -#define _GNU_SOURCE - #include <stdlib.h> #include <string.h> #include <strings.h> @@ -238,8 +236,16 @@ for (i = 0; i < N_MODIFIERS; i++) { - if (strcasestr (binding, modifierList[i].name)) - mods |= modifierList[i].modifier; + int modLen = strlen (modifierList[i].name); + const char *haystack; + for (haystack = binding; *haystack != '\0'; ++haystack) + { + if (strncasecmp (haystack, modifierList[i].name, modLen) == 0) + { + mods |= modifierList[i].modifier; + break; + } + } } return mods; @@ -287,8 +293,16 @@ for (i = 0; i < N_EDGES; i++) { - if (strcasestr (binding, edgeList[i].modName)) - mods |= edgeList[i].modifier; + int edgeLen = strlen (edgeList[i].name); + const char *haystack; + for (haystack = binding; *haystack != '\0'; ++haystack) + { + if (strncasecmp (haystack, edgeList[i].name, edgeLen) == 0) + { + mods |= edgeList[i].modifier; + break; + } + } } return mods; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/src/ccs-private.h new/libcompizconfig-0.8.18/src/ccs-private.h --- old/libcompizconfig-0.8.16/src/ccs-private.h 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/src/ccs-private.h 2020-02-11 12:22:38.000000000 +0100 @@ -78,4 +78,6 @@ unsigned int ccsAddConfigWatch (CCSContext *context, FileWatchCallbackProc callback); +char *strdup_printf (const char *format, ...); + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/src/compiz.cpp new/libcompizconfig-0.8.18/src/compiz.cpp --- old/libcompizconfig-0.8.16/src/compiz.cpp 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/src/compiz.cpp 2020-02-11 12:22:38.000000000 +0100 @@ -43,6 +43,7 @@ #include <compiz-core.h> #include <ccs.h> #include "ccs-private.h" +#include "iniparser.h" } extern int xmlLoadExtDtdDefaultValue; @@ -855,7 +856,7 @@ if (xmlFile) { pPrivate->xmlFile = strdup (xmlFile); - asprintf (&pPrivate->xmlPath, "/compiz/plugin[@name = '%s']", name); + pPrivate->xmlPath = strdup_printf ("/compiz/plugin[@name = '%s']", name); } plugin->context = context; @@ -1899,18 +1900,18 @@ return TRUE; } char *cacheBaseDir = NULL; - char *cacheHome = getenv ("XDG_CACHE_HOME"); + const char *cacheHome = getenv ("XDG_CACHE_HOME"); if (cacheHome && strlen (cacheHome)) { - asprintf (&cacheBaseDir, "%s", cacheHome); + cacheBaseDir = strdup (cacheHome); } else { - char *home = getenv ("HOME"); - if (home && strlen (home)) + const char *home = getenv ("HOME"); + if (home && strlen (home) > 0) { - asprintf (&cacheBaseDir, "%s/.cache", home); + cacheBaseDir = strdup_printf ("%s/.cache", home); } } @@ -2514,7 +2515,7 @@ if (file) pPrivate->xmlFile = strdup (file); - asprintf (&pPrivate->xmlPath, "/compiz/plugin[@name = '%s']", name); + pPrivate->xmlPath = strdup_printf ("/compiz/plugin[@name = '%s']", name); plugin->context = context; plugin->name = strdup (name); @@ -2748,11 +2749,11 @@ static void loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath) { - char *xmlFilePath = NULL; + char *xmlFilePath; char *pbFilePath = NULL; void *pluginInfoPBv = NULL; - asprintf (&xmlFilePath, "%s/%s", xmlDirPath, xmlName); + xmlFilePath = strdup_printf ("%s/%s", xmlDirPath, xmlName); if (!xmlFilePath) { fprintf (stderr, "[ERROR]: Can't allocate memory\n"); @@ -2787,7 +2788,7 @@ if (createProtoBufCacheDir () && metadataCacheDir.length () > 0) { - asprintf (&pbFilePath, "%s/%s.pb", metadataCacheDir.c_str (), name); + pbFilePath = strdup_printf ("%s/%s.pb", metadataCacheDir.c_str (), name); if (!pbFilePath) { fprintf (stderr, "[ERROR]: Can't allocate memory\n"); @@ -2982,17 +2983,15 @@ initPBLoading (); #endif - char *xmlDirPath = NULL; - char *xmlName = NULL; - asprintf (&xmlName, "%s.xml", name); + char *xmlName = strdup_printf ("%s.xml", name); if (xmlName) { - char *home = getenv ("HOME"); - if (home && strlen (home)) + const char *home = getenv ("HOME"); + if (home && strlen (home) > 0) { - char *home = getenv ("HOME"); - asprintf (&xmlDirPath, "%s/.compiz/metadata", home); + char *xmlDirPath = strdup_printf ("%s/.compiz/metadata", home); + if (xmlDirPath) { loadPluginFromXMLFile (context, xmlName, xmlDirPath); @@ -3016,11 +3015,10 @@ initPBLoading (); #endif - char *home = getenv ("HOME"); - if (home && strlen (home)) + const char *home = getenv ("HOME"); + if (home && strlen (home) > 0) { - char *homeplugins = NULL; - asprintf (&homeplugins, "%s/.compiz/metadata", home); + char *homeplugins = strdup_printf ("%s/.compiz/metadata", home); if (homeplugins) { loadPluginsFromXMLFiles (context, homeplugins); @@ -3029,10 +3027,9 @@ } loadPluginsFromXMLFiles (context, (char *)METADATADIR); - if (home && strlen (home)) + if (home && strlen (home) > 0) { - char *homeplugins = NULL; - asprintf (&homeplugins, "%s/.compiz/plugins", home); + char *homeplugins = strdup_printf ("%s/.compiz/plugins", home); if (homeplugins) { loadPluginsFromName (context, homeplugins); @@ -3075,6 +3072,30 @@ xmlFreeDoc (doc); } +static void +loadPresets(CCSPlugin * plugin) +{ + IniDictionary *presets; + const char *presetsFile = SYSCONFDIR "/compizconfig/presets.ini"; + + PLUGIN_PRIV (plugin); + + CCSSettingList sl = pPrivate->settings; + + presets = iniparser_new ((char *) presetsFile); + + if (presets) + { + while (sl) + { + ccsIniReadSetting (presets, sl->data); + ccsSetAsDefault (sl->data); + + sl = sl->next; + } + } +} + void ccsLoadPluginSettings (CCSPlugin * plugin) { @@ -3133,6 +3154,9 @@ D (D_FULL, "done\n"); collateGroups (pPrivate); + + loadPresets (plugin); + ccsReadPluginSettings (plugin); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/src/config.c new/libcompizconfig-0.8.18/src/config.c --- old/libcompizconfig-0.8.16/src/config.c 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/src/config.c 2020-02-11 12:22:38.000000000 +0100 @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <stdarg.h> @@ -29,24 +28,22 @@ #define SETTINGPATH "compiz/compizconfig" -static char* +static char * getConfigFileName (void) { - char *configDir = NULL; - char *fileName = NULL; + const char *configDir; + const char *homeDir; configDir = getenv ("XDG_CONFIG_HOME"); - if (configDir && strlen (configDir)) + if (configDir != NULL && strlen (configDir) > 0) { - asprintf (&fileName, "%s/%s/config", configDir, SETTINGPATH); - return fileName; + return strdup_printf ("%s/%s/config", configDir, SETTINGPATH); } - configDir = getenv ("HOME"); - if (configDir && strlen (configDir)) + homeDir = getenv ("HOME"); + if (homeDir != NULL && strlen (homeDir) > 0) { - asprintf (&fileName, "%s/.config/%s/config", configDir, SETTINGPATH); - return fileName; + return strdup_printf ("%s/.config/%s/config", homeDir, SETTINGPATH); } return NULL; @@ -55,14 +52,13 @@ static char* getSectionName (void) { - char *profile; - char *section; + char *section = NULL; + const char *profile; profile = getenv ("COMPIZ_CONFIG_PROFILE"); - if (profile && strlen (profile)) + if (profile != NULL && strlen (profile) > 0) { - asprintf (§ion, "general_%s", profile); - return section; + return strdup_printf ("general_%s", profile); } profile = getenv ("MATE_DESKTOP_SESSION_ID"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/src/filewatch.c new/libcompizconfig-0.8.18/src/filewatch.c --- old/libcompizconfig-0.8.16/src/filewatch.c 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/src/filewatch.c 2020-02-11 12:22:38.000000000 +0100 @@ -22,7 +22,6 @@ # include "../config.h" #endif -#define _GNU_SOURCE #include <stdlib.h> #include <stdio.h> #include <string.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/src/ini.c new/libcompizconfig-0.8.18/src/ini.c --- old/libcompizconfig-0.8.16/src/ini.c 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/src/ini.c 2020-02-11 12:22:38.000000000 +0100 @@ -18,13 +18,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#define _GNU_SOURCE #include <stdio.h> #include <sys/stat.h> #include <sys/types.h> #include <errno.h> #include <ccs.h> +#include "ccs-private.h" #include "iniparser.h" /** @@ -110,9 +110,12 @@ char *sectionName; char *retValue; - asprintf (§ionName, "%s:%s", section, entry); + sectionName = strdup_printf ("%s:%s", section, entry); + if (sectionName == NULL) + return NULL; retValue = iniparser_getstring (dictionary, sectionName, NULL); + free (sectionName); return retValue; @@ -126,7 +129,9 @@ { char *sectionName; - asprintf (§ionName, "%s:%s", section, entry); + sectionName = strdup_printf ("%s:%s", section, entry); + if (sectionName == NULL) + return; if (!iniparser_find_entry (dictionary, (char*) section)) iniparser_add_entry (dictionary, (char*) section, NULL, NULL); @@ -534,10 +539,10 @@ const char *entry, int value) { - char *string = NULL; + char *string; - asprintf (&string, "%i", value); - if (string) + string = strdup_printf ("%d", value); + if (string != NULL) { setIniString (dictionary, section, entry, string); free (string); @@ -550,10 +555,10 @@ const char *entry, float value) { - char *string = NULL; + char *string; - asprintf (&string, "%f", value); - if (string) + string = strdup_printf ("%f", value); + if (string != NULL) { setIniString (dictionary, section, entry, string); free (string); @@ -579,7 +584,7 @@ char *string; string = ccsColorToString (&value); - if (string) + if (string != NULL) { setIniString (dictionary, section, entry, string); free (string); @@ -746,7 +751,166 @@ { char *sectionName; - asprintf (§ionName, "%s:%s", section, entry); - iniparser_unset (dictionary, sectionName); - free (sectionName); + sectionName = strdup_printf ("%s:%s", section, entry); + if (sectionName != NULL) + { + iniparser_unset (dictionary, sectionName); + free (sectionName); + } +} + +void +ccsIniReadSetting (dictionary *d, + CCSSetting *setting) +{ + Bool status = FALSE; + char *keyName; + + if (setting->isScreen) + keyName = strdup_printf ("s%d_%s", setting->screenNum, setting->name); + else + keyName = strdup_printf ("as_%s", setting->name); + + if (keyName == NULL) + return; + + switch (setting->type) + { + case TypeString: + { + char *value; + if (ccsIniGetString (d, setting->parent->name, + keyName, &value)) + { + ccsSetString (setting, value); + free (value); + status = TRUE; + } + } + break; + case TypeMatch: + { + char *value; + if (ccsIniGetString (d, setting->parent->name, + keyName, &value)) + { + ccsSetMatch (setting, value); + free (value); + status = TRUE; + } + } + break; + case TypeInt: + { + int value; + if (ccsIniGetInt (d, setting->parent->name, + keyName, &value)) + { + ccsSetInt (setting, value); + status = TRUE; + } + } + break; + case TypeBool: + { + Bool value; + if (ccsIniGetBool (d, setting->parent->name, + keyName, &value)) + { + ccsSetBool (setting, (value != 0)); + status = TRUE; + } + } + break; + case TypeFloat: + { + float value; + if (ccsIniGetFloat (d, setting->parent->name, + keyName, &value)) + { + ccsSetFloat (setting, value); + status = TRUE; + } + } + break; + case TypeColor: + { + CCSSettingColorValue color; + + if (ccsIniGetColor (d, setting->parent->name, + keyName, &color)) + { + ccsSetColor (setting, color); + status = TRUE; + } + } + break; + case TypeKey: + { + CCSSettingKeyValue key; + if (ccsIniGetKey (d, setting->parent->name, + keyName, &key)) + { + ccsSetKey (setting, key); + status = TRUE; + } + } + break; + case TypeButton: + { + CCSSettingButtonValue button; + if (ccsIniGetButton (d, setting->parent->name, + keyName, &button)) + { + ccsSetButton (setting, button); + status = TRUE; + } + } + break; + case TypeEdge: + { + unsigned int edges; + if (ccsIniGetEdge (d, setting->parent->name, + keyName, &edges)) + { + ccsSetEdge (setting, edges); + status = TRUE; + } + } + break; + case TypeBell: + { + Bool bell; + if (ccsIniGetBell (d, setting->parent->name, + keyName, &bell)) + { + ccsSetBell (setting, bell); + status = TRUE; + } + } + break; + case TypeList: + { + CCSSettingValueList value; + if (ccsIniGetList (d, setting->parent->name, + keyName, &value, setting)) + { + ccsSetList (setting, value); + ccsSettingValueListFree (value, TRUE); + status = TRUE; + } + } + break; + default: + break; + } + + if (!status) + { + /* reset setting to default if it could not be read */ + ccsResetToDefault (setting); + } + + if (keyName) + free (keyName); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/src/lists.c new/libcompizconfig-0.8.18/src/lists.c --- old/libcompizconfig-0.8.16/src/lists.c 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/src/lists.c 2020-02-11 12:22:38.000000000 +0100 @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#define _GNU_SOURCE #include <stdlib.h> #include <string.h> #include <malloc.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcompizconfig-0.8.16/src/main.c new/libcompizconfig-0.8.18/src/main.c --- old/libcompizconfig-0.8.16/src/main.c 2018-11-11 18:21:12.000000000 +0100 +++ new/libcompizconfig-0.8.18/src/main.c 2020-02-11 12:22:38.000000000 +0100 @@ -23,8 +23,8 @@ # include "../config.h" #endif -#define _GNU_SOURCE #include <stdlib.h> +#include <stdarg.h> #include <stdio.h> #include <string.h> #include <malloc.h> @@ -46,6 +46,34 @@ basicMetadata = value; } +char * +strdup_printf (const char *format, ...) +{ + char *string; + const int init_size = 100; + char stack[init_size]; + int size; + va_list args, args2; + + va_start (args, format); + size = vsnprintf (stack, init_size, format, args); + va_end (args); + + if (size < 0) + return NULL; + + string = calloc ((unsigned long) size + 1UL, sizeof (char)); + if (string != NULL && size + 1 > init_size) + { + va_start (args2, format); + vsprintf (string, format, args2); + va_end (args2); + } + else if (string != NULL) + memcpy (string, stack, (unsigned long) size + 1UL); + return string; +} + static void initGeneralOptions (CCSContext * context) { @@ -588,33 +616,35 @@ static void * openBackend (char *backend) { - char *home = getenv ("HOME"); + const char *home = getenv ("HOME"); void *dlhand = NULL; - char *dlname = NULL; char *err = NULL; - if (home && strlen (home)) + if (home != NULL && strlen (home) > 0) { - asprintf (&dlname, "%s/.compizconfig/backends/lib%s.so", - home, backend); - dlerror (); - dlhand = dlopen (dlname, RTLD_NOW | RTLD_NODELETE | RTLD_LOCAL); - err = dlerror (); + char *dlname = strdup_printf ("%s/.compizconfig/backends/lib%s.so", + home, backend); + if (dlname != NULL) + { + dlerror (); + dlhand = dlopen (dlname, RTLD_NOW | RTLD_NODELETE | RTLD_LOCAL); + err = dlerror (); + free (dlname); + } } - if (!dlhand) + if (dlhand == NULL) { - if (dlname) { - free (dlname); - } - asprintf (&dlname, "%s/compizconfig/backends/lib%s.so", - LIBDIR, backend); - dlhand = dlopen (dlname, RTLD_NOW | RTLD_NODELETE | RTLD_LOCAL); - err = dlerror (); + char *dlname = strdup_printf ("%s/compizconfig/backends/lib%s.so", + LIBDIR, backend); + if (dlname != NULL) + { + dlhand = dlopen (dlname, RTLD_NOW | RTLD_NODELETE | RTLD_LOCAL); + err = dlerror (); + free (dlname); + } } - free (dlname); - if (err) { fprintf (stderr, "libccs: dlopen: %s\n", err); @@ -763,6 +793,13 @@ setting->isDefault = TRUE; } +void +ccsSetAsDefault (CCSSetting * setting) +{ + copyValue (setting->value, &setting->defaultValue); + ccsResetToDefault (setting); +} + Bool ccsSetInt (CCSSetting * setting, int data) { @@ -2454,20 +2491,26 @@ ccsGetExistingBackends () { CCSBackendInfoList rv = NULL; - char *home = getenv ("HOME"); + const char *home = getenv ("HOME"); char *backenddir; - if (home && strlen (home)) + if (home != NULL && strlen (home) > 0) + { + backenddir = strdup_printf ("%s/.compizconfig/backends", home); + if (backenddir != NULL) + { + getBackendInfoFromDir (&rv, backenddir); + free (backenddir); + } + } + + backenddir = strdup_printf ("%s/compizconfig/backends", LIBDIR); + if (backenddir != NULL) { - asprintf (&backenddir, "%s/.compizconfig/backends", home); getBackendInfoFromDir (&rv, backenddir); free (backenddir); } - asprintf (&backenddir, "%s/compizconfig/backends", LIBDIR); - - getBackendInfoFromDir (&rv, backenddir); - free (backenddir); return rv; } @@ -2481,7 +2524,6 @@ CCSSettingList s; CCSPlugin *plugin; CCSSetting *setting; - char *keyName; exportFile = ccsIniNew (); if (!exportFile) @@ -2497,16 +2539,23 @@ for (s = pPrivate->settings; s; s = s->next) { + char *keyName; + setting = s->data; if (skipDefaults && setting->isDefault) continue; if (setting->isScreen) - asprintf (&keyName, "s%d_%s", - setting->screenNum, setting->name); + { + keyName = strdup_printf ("s%d_%s", + setting->screenNum, setting->name); + } else - asprintf (&keyName, "as_%s", setting->name); + keyName = strdup_printf ("as_%s", setting->name); + + if (keyName == NULL) + continue; switch (setting->type) { @@ -2578,7 +2627,6 @@ CCSSettingList s; CCSPlugin *plugin; CCSSetting *setting; - char *keyName; FILE *fp; /* check if the file exists first */ @@ -2601,15 +2649,22 @@ for (s = pPrivate->settings; s; s = s->next) { + char *keyName; + setting = s->data; if (!setting->isDefault && !overwriteNonDefault) continue; if (setting->isScreen) - asprintf (&keyName, "s%d_%s", - setting->screenNum, setting->name); + { + keyName = strdup_printf ("s%d_%s", + setting->screenNum, setting->name); + } else - asprintf (&keyName, "as_%s", setting->name); + keyName = strdup_printf ("as_%s", setting->name); + + if (keyName == NULL) + continue; switch (setting->type) { ++++++ libcompizconfig-config-dir.patch ++++++ --- /var/tmp/diff_new_pack.lcC2m8/_old 2020-04-05 20:56:46.737393378 +0200 +++ /var/tmp/diff_new_pack.lcC2m8/_new 2020-04-05 20:56:46.737393378 +0200 @@ -1,20 +1,5 @@ -Index: libcompizconfig-0.7.8/src/config.c -=================================================================== ---- libcompizconfig-0.7.8.orig/src/config.c -+++ libcompizconfig-0.7.8/src/config.c -@@ -27,7 +27,7 @@ - - #include "ccs-private.h" - --#define SETTINGPATH "compiz/compizconfig" -+#define SETTINGPATH "compiz/compizconfig-1" - - static char* - getConfigFileName (void) -Index: libcompizconfig-0.7.8/backend/ini.c -=================================================================== ---- libcompizconfig-0.7.8.orig/backend/ini.c -+++ libcompizconfig-0.7.8/backend/ini.c +--- a/backend/ini.c ++++ b/backend/ini.c @@ -38,7 +38,7 @@ #include <X11/Xlib.h> @@ -24,3 +9,14 @@ typedef struct _IniPrivData { +--- a/src/config.c ++++ b/src/config.c +@@ -26,7 +26,7 @@ + + #include "ccs-private.h" + +-#define SETTINGPATH "compiz/compizconfig" ++#define SETTINGPATH "compiz/compizconfig-1" + + static char * + getConfigFileName (void) ++++++ libcompizconfig-configure-retval.patch ++++++ --- /var/tmp/diff_new_pack.lcC2m8/_old 2020-04-05 20:56:46.745393386 +0200 +++ /var/tmp/diff_new_pack.lcC2m8/_new 2020-04-05 20:56:46.745393386 +0200 @@ -1,10 +1,11 @@ ---- libcompizconfig-0.8.16/configure.ac 2019/10/31 16:41:02 1.1 -+++ libcompizconfig-0.8.16/configure.ac 2019/10/31 16:41:36 -@@ -111,6 +111,7 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -109,7 +109,7 @@ AC_CACHE_CHECK([whether we have the POSIX compatible scandir() prototype], + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ # include <dirent.h> - int func (const char *d, dirent ***list, void *sort) { +- int func (const char *d, dirent ***list, void *sort) { ++ void func (const char *d, dirent ***list, void *sort) { int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort); -+ return 0; } ],[ - ], ac_cv_cxx_scandir_posix=yes, ac_cv_cxx_scandir_posix=no)