VERSION | 2 - backend/ini.c | 11 +++++ configure.ac | 2 - src/bindings.c | 14 +++++-- src/compiz.cpp | 97 +++++++++++++++++++++++++------------------------ src/compizconfig.proto | 17 ++++---- src/main.c | 19 ++++++++- 7 files changed, 98 insertions(+), 64 deletions(-)
New commits: commit a728704db3c3b89808aaf79d1d3ff0d62135da28 Author: Guillaume Seguin <guilla...@segu.in> Date: Wed Oct 14 04:09:05 2009 +0200 * Bump version to 0.8.4 diff --git a/VERSION b/VERSION index 9b265c0..e4184f4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -VERSION=0.8.3 +VERSION=0.8.4 commit 0001e60f79edaeac2ff8ec80bd28aebebfac77ff Author: Erkin Bahceci <erkin...@gmail.com> Date: Thu Sep 24 13:01:56 2009 -0500 Fix compiler warnings. diff --git a/src/compiz.cpp b/src/compiz.cpp index 2755d47..179a43a 100644 --- a/src/compiz.cpp +++ b/src/compiz.cpp @@ -281,8 +281,6 @@ initEdgeValuePB (CCSSettingValue * v, CCSSettingInfo * i, const GenericValueMetadata & value) { - int k, num; - v->value.asEdge = 0; if (value.has_edge_value ()) @@ -516,7 +514,6 @@ addOptionForPluginPB (CCSPlugin * plugin, const StringList & subgroups, const OptionMetadata & option) { - int num = 0; CCSSetting *setting; if (ccsFindSetting (plugin, name, isScreen, screen)) @@ -677,7 +674,6 @@ addOptionFromPB (CCSPlugin * plugin, { const char *name; Bool readonly = FALSE; - int i; name = option.name ().c_str (); @@ -688,7 +684,7 @@ addOptionFromPB (CCSPlugin * plugin, if (isScreen) { - for (i = 0; i < plugin->context->numScreens; i++) + for (unsigned i = 0; i < plugin->context->numScreens; i++) addOptionForPluginPB (plugin, name, TRUE, plugin->context->screens[i], groups, subgroups, option); @@ -1009,9 +1005,7 @@ getOptionType (const char *name) { "match", TypeMatch }, { "list", TypeList } }; - int i; - - for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) + for (unsigned i = 0; i < sizeof (map) / sizeof (map[0]); i++) if (strcasecmp (name, map[i].name) == 0) return map[i].type; @@ -1439,7 +1433,7 @@ initEdgeValue (CCSSettingValue * v, { xmlNode **nodes; char *value; - int j, k, num; + int k, num; v->value.asEdge = 0; @@ -1461,7 +1455,7 @@ initEdgeValue (CCSSettingValue * v, value = getStringFromXPath (node->doc, nodes[k], "@name"); if (value) { - for (j = 0; j < sizeof (edge) / sizeof (edge[0]); j++) + for (unsigned j = 0; j < sizeof (edge) / sizeof (edge[0]); j++) { if (strcasecmp ((char *) value, edge[j]) == 0) v->value.asEdge |= (1 << j); @@ -2170,8 +2164,6 @@ addOptionFromXMLNode (CCSPlugin * plugin, char *type; char *readonly; Bool isReadonly; - Bool screen; - int i; if (!node) return; @@ -2201,7 +2193,7 @@ addOptionFromXMLNode (CCSPlugin * plugin, if (isScreen) { - for (i = 0; i < plugin->context->numScreens; i++) + for (unsigned i = 0; i < plugin->context->numScreens; i++) addOptionForPlugin (plugin, name, type, isReadonly, TRUE, plugin->context->screens[i], node, groupListPBv, subgroupListPBv, optionPBv); @@ -2658,7 +2650,6 @@ checkAndLoadProtoBuf (char *pbPath, struct stat *xmlStat, PluginBriefMetadata *pluginBriefPB) { - Bool needsUpdate = FALSE; const PluginInfoMetadata &pluginInfoPB = pluginBriefPB->info (); if (pbStat->st_mtime < xmlStat->st_mtime || // is .pb older than .xml? @@ -2793,7 +2784,6 @@ loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath) // Check if the corresponding .pb exists in cache Bool error = TRUE; - int lenXMLName = strlen (xmlName); struct stat pbStat; name = strndup (xmlName, strlen (xmlName) - 4); @@ -2886,7 +2876,6 @@ static void loadPluginsFromXMLFiles (CCSContext * context, char *path) { struct dirent **nameList; - char *metadataPath; int nFile, i; if (!path) commit b4aa1026111293bc1848a20673441142bb3d9ee1 Author: Erkin Bahceci <erkin...@gmail.com> Date: Thu Sep 24 12:59:56 2009 -0500 Fix checking of libprotobuf version >= 2.1. diff --git a/configure.ac b/configure.ac index 0ce5d31..4dde084 100644 --- a/configure.ac +++ b/configure.ac @@ -105,7 +105,7 @@ if test "x$use_protobuf" = "xyes"; then echo -e $protobuf_error_msg; use_protobuf=no else AC_CHECK_LIB(protobuf, _ZN6google8protobuf7MessageD2Ev, [], [ - echo -e $protobuf_error_msg; use_protobuf=no ]) + echo -e $protobuf_error_msg; use_protobuf=no ], -lpthread) if test "x$use_protobuf" = "xyes"; then AC_LANG([C++]) AC_CHECK_HEADER([google/protobuf/message.h],,[ commit a13ca4ed66b18b72a611231cce163e9c499ee20c Author: Erkin Bahceci <erkin...@gmail.com> Date: Sun Sep 20 20:53:39 2009 -0500 Fix crash when LANG has no value. diff --git a/src/compiz.cpp b/src/compiz.cpp index 0faa945..2755d47 100644 --- a/src/compiz.cpp +++ b/src/compiz.cpp @@ -85,7 +85,7 @@ getLocale () if (!lang || !strlen (lang)) lang = getenv ("LC_MESSAGES"); - return lang; + return lang ? lang : (char *)""; } std::string curLocale = std::string (getLocale ()); commit b9229e357af89a20c090ac8a0b3c64a4d477d83e Author: Erkin Bahceci <erkin...@gmail.com> Date: Mon Aug 31 23:17:14 2009 -0500 Fix encoding of corner followed by adjacent edge case. diff --git a/src/bindings.c b/src/bindings.c index 3659b8b..8482668 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -248,18 +248,24 @@ unsigned int ccsStringToEdges (const char *binding) { unsigned int edgeMask = 0; - char *needle; + const char *needle; int i; for (i = 0; i < N_EDGES; i++) { - needle = strstr (binding, edgeList[i].name); - if (needle) + int edgeLen = strlen (edgeList[i].name); + + /* Look for all occurrences of edgeList[i].name in binding */ + needle = binding; + while ((needle = strstr (needle, edgeList[i].name)) != NULL) { if (needle != binding && isalnum (*(needle - 1))) + { + needle += edgeLen; continue; + } - needle += strlen (edgeList[i].name); + needle += edgeLen; if (*needle && isalnum (*needle)) continue; commit ab2c199a5bbdc38b8026febc76682fa21dac5197 Author: Erkin Bahceci <erkin...@gmail.com> Date: Mon Aug 24 23:46:53 2009 -0500 Avoid allocating 0-size memory. Fix memory leak. diff --git a/src/main.c b/src/main.c index 4d0e32c..2edc49d 100644 --- a/src/main.c +++ b/src/main.c @@ -1515,13 +1515,20 @@ ccsGetSortedPluginStringList (CCSContext * context) ap = ccsPluginListRemove (ap, p, FALSE); int len = ccsPluginListLength (ap); - + if (len == 0) + { + ccsStringListFree (rv, TRUE); + return NULL; + } int i, j; /* TODO: conflict handling */ PluginSortHelper *plugins = calloc (1, len * sizeof (PluginSortHelper)); if (!plugins) + { + ccsStringListFree (rv, TRUE); return NULL; + } for (i = 0, list = ap; i < len; i++, list = list->next) { commit 05c8c6176a8d2ff67310167e0c25cd498244c48f Author: Erkin Bahceci <erkin...@gmail.com> Date: Sun Aug 23 10:05:43 2009 -0500 Fix memory leaks. diff --git a/backend/ini.c b/backend/ini.c index c32ed90..82094e6 100644 --- a/backend/ini.c +++ b/backend/ini.c @@ -117,6 +117,8 @@ processFileEvent (unsigned int watchId, data->iniFile = ccsIniOpen (fileName); ccsReadSettings (data->context); + + free (fileName); } static void @@ -151,12 +153,17 @@ setProfile (IniPrivData *data, file = fopen (fileName, "w"); if (!file) + { + free (fileName); return; - + } fclose (file); } else + { + free (fileName); return; + } } data->iniWatchId = ccsAddFileWatch (fileName, TRUE, commit 5987214a45b61e47571f58e72331f4873250a8ca Author: Erkin Bahceci <erkin...@gmail.com> Date: Wed Aug 19 18:05:01 2009 -0500 Fix memory leaks. diff --git a/backend/ini.c b/backend/ini.c index c540571..c32ed90 100644 --- a/backend/ini.c +++ b/backend/ini.c @@ -272,6 +272,7 @@ readSetting (CCSContext *context, keyName, &value)) { ccsSetString (setting, value); + free (value); status = TRUE; } } @@ -283,6 +284,7 @@ readSetting (CCSContext *context, keyName, &value)) { ccsSetMatch (setting, value); + free (value); status = TRUE; } } diff --git a/src/main.c b/src/main.c index d2680eb..4d0e32c 100644 --- a/src/main.c +++ b/src/main.c @@ -2636,7 +2636,10 @@ ccsImportFromFile (CCSContext *context, if (ccsIniGetString (importFile, plugin->name, keyName, &value)) - ccsSetString (setting, value); + { + ccsSetString (setting, value); + free (value); + } } break; case TypeKey: @@ -2689,7 +2692,10 @@ ccsImportFromFile (CCSContext *context, char *value; if (ccsIniGetString (importFile, plugin->name, keyName, &value)) - ccsSetMatch (setting, value); + { + ccsSetMatch (setting, value); + free (value); + } } break; case TypeList: commit 9eb45bed918905833fb61a785369f8883ccc4ef6 Author: Erkin Bahceci <erkin...@gmail.com> Date: Wed Aug 19 18:04:36 2009 -0500 Compare string find result with npos. diff --git a/src/compiz.cpp b/src/compiz.cpp index ac7a9d9..0faa945 100644 --- a/src/compiz.cpp +++ b/src/compiz.cpp @@ -89,7 +89,7 @@ getLocale () } std::string curLocale = std::string (getLocale ()); -std::string shortLocale = curLocale.find ('.') < 0 ? +std::string shortLocale = curLocale.find ('.') == std::string::npos ? curLocale : curLocale.substr (0, curLocale.find ('.')); #endif commit 5dab250c7da6020ec3efbe85f511d3af4ccf79b7 Author: Erkin Bahceci <erkin...@gmail.com> Date: Sat Mar 14 14:30:43 2009 -0500 Update .pb when an older .xml is used, too. diff --git a/src/compiz.cpp b/src/compiz.cpp index 5b36a4d..ac7a9d9 100644 --- a/src/compiz.cpp +++ b/src/compiz.cpp @@ -53,7 +53,7 @@ extern int xmlLoadExtDtdDefaultValue; Bool usingProtobuf = TRUE; -#define PB_ABI_VERSION 20081004 +#define PB_ABI_VERSION 20090314 typedef metadata::PluginInfo PluginInfoMetadata; typedef metadata::PluginBrief PluginBriefMetadata; @@ -2665,13 +2665,12 @@ checkAndLoadProtoBuf (char *pbPath, !loadPluginMetadataFromProtoBuf (pbPath, pluginBriefPB, NULL) || (!basicMetadata && pluginBriefPB->info ().basic_metadata ()) || pluginInfoPB.pb_abi_version () != PB_ABI_VERSION || + pluginInfoPB.time () != (unsigned long)xmlStat->st_mtime || + // xml modification time mismatch? (pluginInfoPB.locale () != "NONE" && pluginInfoPB.locale () != shortLocale)) { // .pb needs update - - remove (pbPath); // Attempt to remove .pb - return FALSE; } return TRUE; @@ -2681,7 +2680,8 @@ checkAndLoadProtoBuf (char *pbPath, static void writePBFile (char *pbFilePath, PluginMetadata *pluginPB, - PluginBriefMetadata *pluginBriefPB) + PluginBriefMetadata *pluginBriefPB, + struct stat *xmlStat) { if (!createProtoBufCacheDir ()) return; @@ -2698,6 +2698,7 @@ writePBFile (char *pbFilePath, pluginInfoPB = pluginBriefPB->mutable_info (); pluginInfoPB->set_pb_abi_version (PB_ABI_VERSION); pluginInfoPB->set_locale (shortLocale); + pluginInfoPB->set_time ((unsigned long)xmlStat->st_mtime); pluginInfoPB->set_brief_metadata (TRUE); } @@ -2779,11 +2780,11 @@ loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath) #ifdef USE_PROTOBUF char *name = NULL; + struct stat xmlStat; + Bool removePB = FALSE; if (usingProtobuf) { - struct stat xmlStat; - if (stat (xmlFilePath, &xmlStat)) { free (xmlFilePath); @@ -2817,26 +2818,32 @@ loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath) error = stat (pbFilePath, &pbStat); } - if (!error && - checkAndLoadProtoBuf (pbFilePath, &pbStat, &xmlStat, - &persistentPluginBriefPB)) + if (!error) { - // Found and loaded .pb - if (!strcmp (name, "core")) - addCoreSettingsFromPB (context, persistentPluginBriefPB.info (), - pbFilePath, xmlFilePath); + if (checkAndLoadProtoBuf (pbFilePath, &pbStat, &xmlStat, + &persistentPluginBriefPB)) + { + // Found and loaded .pb + if (!strcmp (name, "core")) + addCoreSettingsFromPB (context, + persistentPluginBriefPB.info (), + pbFilePath, xmlFilePath); + else + addPluginFromPB (context, persistentPluginBriefPB.info (), + pbFilePath, xmlFilePath); + + updatePBFilePath (context, name, pbFilePath); + + free (xmlFilePath); + free (pbFilePath); + free (name); + return; + } else - addPluginFromPB (context, persistentPluginBriefPB.info (), - pbFilePath, xmlFilePath); - - updatePBFilePath (context, name, pbFilePath); - - free (xmlFilePath); - free (pbFilePath); - free (name); - return; + { + removePB = TRUE; + } } - persistentPluginBriefPB.Clear (); pluginInfoPBv = persistentPluginBriefPB.mutable_info (); } @@ -2862,7 +2869,9 @@ loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath) #ifdef USE_PROTOBUF if (usingProtobuf && xmlLoaded) { - writePBFile (pbFilePath, NULL, &persistentPluginBriefPB); + if (removePB) + remove (pbFilePath); // Attempt to remove .pb + writePBFile (pbFilePath, NULL, &persistentPluginBriefPB, &xmlStat); updatePBFilePath (context, name, pbFilePath); } @@ -3050,13 +3059,18 @@ ccsLoadPlugins (CCSContext * context) static void loadOptionsStringExtensionsFromXML (CCSPlugin * plugin, - void * pluginPBv) + void * pluginPBv, + struct stat *xmlStat) { PLUGIN_PRIV (plugin); xmlDoc *doc = NULL; xmlNode **nodes; int num; + + if (stat (pPrivate->xmlFile, xmlStat)) + return; + FILE *fp = fopen (pPrivate->xmlFile, "r"); if (!fp) return; @@ -3120,14 +3134,16 @@ ccsLoadPluginSettings (CCSPlugin * plugin) } #endif + struct stat xmlStat; + // Load from .xml if (!ignoreXML && pPrivate->xmlFile) - loadOptionsStringExtensionsFromXML (plugin, pluginPBToWrite); + loadOptionsStringExtensionsFromXML (plugin, pluginPBToWrite, &xmlStat); #ifdef USE_PROTOBUF if (pluginPBToWrite && pPrivate->pbFilePath && loadedAtLeastBriefPB) writePBFile (pPrivate->pbFilePath, (PluginMetadata *) pluginPBToWrite, - NULL); + NULL, &xmlStat); #endif D (D_FULL, "done\n"); diff --git a/src/compizconfig.proto b/src/compizconfig.proto index f4eedd1..5834842 100644 --- a/src/compizconfig.proto +++ b/src/compizconfig.proto @@ -7,21 +7,22 @@ message PluginInfo { required sint32 pb_abi_version = 1; required string locale = 2; + required uint64 time = 3; // modification time of source .xml file // true if container is missing options and extensions, and only includes // plugin info - required bool brief_metadata = 3; + required bool brief_metadata = 4; // true if container is missing extensions, string restrictions, and // short/long descriptions for the plugin and its options - required bool basic_metadata = 4; + required bool basic_metadata = 5; - required string name = 5; - optional string short_desc = 6; - optional string long_desc = 7; - optional string category = 8; + required string name = 6; + optional string short_desc = 7; + optional string long_desc = 8; + optional string category = 9; - repeated string feature = 9; + repeated string feature = 10; message Dependencies { @@ -35,7 +36,7 @@ message PluginInfo repeated string conflict_feature = 6; } - optional Dependencies deps = 10; + optional Dependencies deps = 11; } commit 628d1c67510ec31bb22d31e2a7d19a1ed9f4a549 Author: Guillaume Seguin <guilla...@segu.in> Date: Mon Mar 9 15:43:47 2009 +0100 * Bump version to 0.8.3 diff --git a/VERSION b/VERSION index 2dcc312..9b265c0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -VERSION=0.8.2 +VERSION=0.8.3 -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org