rpms/pan/devel pan-0.96-upstream-sort_segfault.patch, NONE, 1.1 pan-0.96-upstream-subscribed_group.patch, NONE, 1.1 pan.spec, 1.13, 1.14

Michael A. Peters (mpeters) fedora-extras-commits at redhat.com
Tue May 9 00:59:08 UTC 2006


Author: mpeters

Update of /cvs/extras/rpms/pan/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27530

Modified Files:
	pan.spec 
Added Files:
	pan-0.96-upstream-sort_segfault.patch 
	pan-0.96-upstream-subscribed_group.patch 
Log Message:
Two patches from upstream that fix some bad stuff


pan-0.96-upstream-sort_segfault.patch:

--- NEW FILE pan-0.96-upstream-sort_segfault.patch ---
--- pan/gui/header-pane.cc.bak	2006-05-08 11:19:05.000000000 -0500
+++ pan/gui/header-pane.cc	2006-05-08 15:56:51.000000000 -0500
@@ -78,6 +78,10 @@
     StringView in (view);
     while (!in.empty() && !isalpha(*in.str))
       in.eat_chars (1);
+
+    if (in.empty())
+      return g_strdup ("");
+
     char * casefold = g_utf8_casefold (in.str, in.len);
     char * ret = g_utf8_collate_key (casefold, -1);
     g_free (casefold);
@@ -89,9 +93,8 @@
   {
     const char * pch = (const char*) pan_tree_store_peek_value (PAN_TREE_STORE(model), iter, COL_COLLATED_AUTHOR);
     if (!pch) {
-      const Article * a (get_article (model, iter));
-      const char * in = a->author.empty() ? "" : a->author.c_str();
-      char * tmp = do_collate (in);
+      const Article * article (get_article (model, iter));
+      char * tmp = do_collate (article->author.to_view());
       pan_tree_store_set (PAN_TREE_STORE(model), iter, COL_COLLATED_AUTHOR, tmp, -1);
       g_free (tmp);
       pch = get_collated_author (model, iter);
@@ -104,9 +107,8 @@
   {
     const char * pch = (const char*) pan_tree_store_peek_value (PAN_TREE_STORE(model), iter, COL_COLLATED_SUBJECT);
     if (!pch) {
-      const Article * a (get_article (model, iter));
-      const char * in = a->subject.empty() ? "" : a->subject.c_str();
-      char * tmp = do_collate (in);
+      const Article * article (get_article (model, iter));
+      char * tmp = do_collate (article->subject.to_view());
       pan_tree_store_set (PAN_TREE_STORE(model), iter, COL_COLLATED_SUBJECT, tmp, -1);
       g_free (tmp);
       pch = get_collated_subject (model, iter);

pan-0.96-upstream-subscribed_group.patch:

--- NEW FILE pan-0.96-upstream-subscribed_group.patch ---
--- pan/data-impl/groups.cc.old	2006-05-08 10:50:16.000000000 -0500
+++ pan/data-impl/groups.cc	2006-05-07 23:32:36.000000000 -0500
@@ -129,7 +129,7 @@
     std::set_union (sub.begin(), sub.end(),
                     tmp_sub.begin(), tmp_sub.end(),
                     std::inserter (tmp, tmp.begin()), o);
-    sub.get_container().swap (tmp_sub);
+    sub.get_container().swap (tmp);
   }
 
   // unsub += tmp_unsub
@@ -159,13 +159,14 @@
     delete in;
   }
 
-  // if it's in both _sub and _unsub, remove it from _unsub.
+  // unsub -= sub
+  AlphabeticalQuarkOrdering o;
   std::vector<Quark> tmp;
   tmp.reserve (_unsubscribed.size());
   std::set_difference (_unsubscribed.begin(), _unsubscribed.end(),
                        _subscribed.begin(), _subscribed.end(),
-                       inserter (tmp, tmp.begin()));
-  _unsubscribed.get_container().assign (tmp.begin(), tmp.end());
+                       inserter (tmp, tmp.begin()), o);
+  _unsubscribed.get_container().swap (tmp);
 }
 
 void
@@ -212,25 +213,37 @@
 void
 DataImpl :: load_group_permissions (const DataIO& data_io)
 {
-  _moderated.clear ();
-  _nopost.clear ();
+  std::vector<Quark> m, n;
 
   LineReader * in (data_io.read_group_permissions ());
-  StringView s, group;
-  while (in && !in->fail() && in->getline(group)) {
-    if (group.len && *group.str=='#')
+  StringView s, line;
+  while (in && !in->fail() && in->getline(line))
+  {
+    if (line.len && *line.str=='#')
       continue;
-    else if (!group.pop_last_token (s, ':'))
-      std::cerr << LINE_ID << " I don't understand \"" << group << '"' << std::endl;
-    else if (!s.len)
-      std::cerr << LINE_ID << " Permission for " << group << " needs to be one of 'y', 'n', or 'm'.\n";
-    else if (*s.str=='m')
-      _moderated.insert (group);
-    else if (*s.str=='n')
-      _nopost.insert (group);
-    else if (*s.str!='y')
-      std::cerr << LINE_ID << " Permission for " << group << " needs to be one of 'y', 'n', or 'm'.\n";
-  }
+
+    else if (!line.pop_last_token (s, ':') || !s.len || (*s.str!='y' && *s.str!='n' && *s.str!='m')) {
+      std::cerr << LINE_ID << " Group permissions: Can't parse line `" << line << std::endl;
+      continue;
+    }
+
+    const Quark group (line);
+    const char ch = *s.str;
+
+    if (ch == 'm')
+      m.push_back (group);
+    else if (ch == 'n')
+      n.push_back (group);
+  }
+
+  std::sort (m.begin(), m.end());
+  m.erase (std::unique(m.begin(), m.end()), m.end()); 
+  _moderated.get_container().swap (m);
+
+  std::sort (n.begin(), n.end());
+  n.erase (std::unique(n.begin(), n.end()), n.end()); 
+  _nopost.get_container().swap (n);
+
   delete in;
 }
 
@@ -421,6 +434,7 @@
 
     // make a groups_t of groups we didn't already have,
     // and merge it with _unsubscribed (i.e., groups we haven't seen before become unsubscribed)
+    AlphabeticalQuarkOrdering o;
     groups.clear ();
     for (const NewGroup *it=newgroups, *end=newgroups+count; it!=end; ++it)
       if (!_subscribed.count (it->group))
@@ -429,7 +443,7 @@
     tmp.clear ();
     std::set_union (groups.begin(), groups.end(),
                     _unsubscribed.begin(), _unsubscribed.end(),
-                    std::back_inserter (tmp));
+                    std::back_inserter (tmp), o);
     tmp.erase (std::unique(tmp.begin(), tmp.end()), tmp.end()); 
     _unsubscribed.get_container().swap (tmp);
   }


Index: pan.spec
===================================================================
RCS file: /cvs/extras/rpms/pan/devel/pan.spec,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- pan.spec	6 May 2006 19:19:31 -0000	1.13
+++ pan.spec	9 May 2006 00:59:08 -0000	1.14
@@ -1,12 +1,13 @@
 Summary: A GNOME/GTK+ news reader for X
 Name: pan
 Version: 0.96
-Release: 1%{?dist}
+Release: 2%{?dist}
 Epoch: 1
 License: GPL
 Group: Applications/Internet
 Source0: http://pan.rebelbase.com/download/%{version}/SOURCE/%{name}-%{version}.tar.bz2
-#Patch0: pan-0.95-upstream-tree.patch
+Patch0: pan-0.96-upstream-sort_segfault.patch
+Patch1: pan-0.96-upstream-subscribed_group.patch
 URL: http://pan.rebelbase.com/
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: desktop-file-utils
@@ -27,7 +28,8 @@
 
 %prep
 %setup -q
-#%%patch0 -p1
+%patch0 -p0
+%patch1 -p0
 
 echo "StartupNotify=true" >> pan.desktop
 
@@ -72,8 +74,12 @@
 %{_datadir}/applications/fedora-pan.desktop
 
 %changelog
+* Mon May 08 2006 Michael A. Peters <mpeters at mac.com> - 1:0.96-2
+- Two patches from upstream (pan-0.96-upstream-sort_segfault.patch
+- and pan-0.96-upstream-subscribed_group.patch)
+
 * Sat May 06 2006 Michael A. Peters <mpeters at mac.com> - 1:0.96-1
-- Update to 0.96 - patch1 no longer needed
+- Update to 0.96 - patch0 no longer needed
 
 * Mon May 01 2006 Michael A. Peters <mpeters at mac.com> - 1:0.95-3
 - Apply a patch from upstream for new tree implementation bug




More information about the fedora-extras-commits mailing list