~ubuntu-branches/ubuntu/raring/dansguardian/raring

« back to all changes in this revision

Viewing changes to src/FOptionContainer.cpp

  • 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:
23
23
 
24
24
// INCLUDES
25
25
 
 
26
#ifdef HAVE_CONFIG_H
 
27
        #include "dgconfig.h"
 
28
#endif
26
29
#include "FOptionContainer.hpp"
27
30
#include "OptionContainer.hpp"
28
31
 
203
206
                std::string linebuffer;
204
207
                String temp;  // for tempory conversion and storage
205
208
                int j;  // counter
206
 
                ifstream conffiles(filename, ios::in);  // dansguardianfN.conf
 
209
                std::ifstream conffiles(filename, std::ios::in);  // dansguardianfN.conf
207
210
                if (!conffiles.good()) {
208
211
                        if (!is_daemonised) {
209
212
                                std::cerr << "Error reading: " << filename << std::endl;
247
250
                        disable_content_scan = false;
248
251
                }
249
252
 
250
 
#ifdef __EMAIL
 
253
#ifdef ENABLE_EMAIL
251
254
                // Email notification patch by J. Gauthier
252
255
                if (findoptionS("usesmtp") == "on") {
253
256
                        use_smtp = true;
432
435
 
433
436
                        if (enable_PICS) {
434
437
                                linebuffer = findoptionS("picsfile");
435
 
                                ifstream picsfiles(linebuffer.c_str(), ios::in);  // pics file
 
438
                                std::ifstream picsfiles(linebuffer.c_str(), std::ios::in);  // pics file
436
439
                                if (!picsfiles.good()) {
437
440
                                        if (!is_daemonised) {
438
441
                                                std::cerr << "Error reading PICS file: " << linebuffer << std::endl;
766
769
                        }
767
770
                }
768
771
        }
769
 
        catch(exception & e) {
 
772
        catch(std::exception & e) {
770
773
                if (!is_daemonised) {
771
774
                        std::cerr << e.what() << std::endl;  // when called the daemon has not
772
775
                        // detached so we can do this
1336
1339
        return "";
1337
1340
}
1338
1341
 
1339
 
bool FOptionContainer::realitycheck(int l, int minl, int maxl, char *emessage)
 
1342
bool FOptionContainer::realitycheck(int l, int minl, int maxl, const char *emessage)
1340
1343
{
1341
1344
        // realitycheck checks a String for certain expected criteria
1342
1345
        // so we can spot problems in the conf files easier