~ubuntu-branches/ubuntu/trusty/dansguardian/trusty

« back to all changes in this revision

Viewing changes to debian/patches/11_FixOptionContainer.cpp_on_arm.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Wirt, Thomas Viehmann
  • Date: 2008-10-13 09:29:35 UTC
  • mfrom: (1.1.7 upstream) (7.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20081013092935-g8uz3kgfjs37ikgv
Tags: 2.9.9.7-2
[ Thomas Viehmann ]
OptionContainer.cpp: If you need to iterate through all lines in the
config file to find a field, at least don't abuse the configfile deque
by accessing it as if it was an array with signed index.
Works way better on arm, too, i.e. closes: #493047.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 11_FixOptionContainer.cpp_on_arm.dpatch by Alexander Wirt <formorer@debian.org>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: If you need to iterate through all lines in the
 
6
##     config file to find a field, at least don't abuse the configfile deque
 
7
##     by accessing it as if it was an array with signed index.
 
8
##     Works way better on arm, too, i.e. closes: #493047.
 
9
 
 
10
@DPATCH@
 
11
diff -urNad dansguardian-2.9.9.7~/src/OptionContainer.cpp dansguardian-2.9.9.7/src/OptionContainer.cpp
 
12
--- dansguardian-2.9.9.7~/src/OptionContainer.cpp       2008-08-18 09:57:46.000000000 +0200
 
13
+++ dansguardian-2.9.9.7/src/OptionContainer.cpp        2008-10-13 09:23:20.000000000 +0200
 
14
@@ -662,8 +662,10 @@
 
15
        String temp;
 
16
        String temp2;
 
17
        String o(option);
 
18
-       for (int i = 0; i < (signed) conffile.size(); i++) {
 
19
-               temp = conffile[i].c_str();
 
20
+       for (std::deque<std::string>::iterator i = conffile.begin(); i != conffile.end(); i++) {
 
21
+               if ((*i).empty())
 
22
+                       continue;
 
23
+               temp = (*i).c_str();
 
24
                temp2 = temp.before("=");
 
25
                while (temp2.endsWith(" ")) {   // get rid of tailing spaces before =
 
26
                        temp2.chop();
 
27
@@ -696,8 +698,10 @@
 
28
        String temp2;
 
29
        String o(option);
 
30
        std::deque<String > results;
 
31
-       for (int i = 0; i < (signed) conffile.size(); i++) {
 
32
-               temp = conffile[i].c_str();
 
33
+       for (std::deque<std::string>::iterator i = conffile.begin(); i != conffile.end(); i++) {
 
34
+               if ((*i).empty())
 
35
+                       continue;
 
36
+               temp = (*i).c_str();
 
37
                temp2 = temp.before("=");
 
38
                while (temp2.endsWith(" ")) {   // get rid of tailing spaces before =
 
39
                        temp2.chop();