warnings cleanup

This commit is contained in:
dockes
2004-12-15 15:00:37 +00:00
parent 91df3aef73
commit a43ebc3716
11 changed files with 208 additions and 81 deletions
+1 -5
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.1 2004-12-14 17:50:28 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.2 2004-12-15 15:00:36 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#include <iostream>
@@ -10,10 +10,6 @@ static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.1 2004-12-14 17:50:28 dockes Ex
using namespace std;
ConfTree *getConfig()
{
}
RclConfig::RclConfig()
: m_ok(false), conf(0), mimemap(0), mimeconf(0)
{
+15 -9
View File
@@ -1,6 +1,6 @@
#ifndef _RCLCONFIG_H_INCLUDED_
#define _RCLCONFIG_H_INCLUDED_
/* @(#$Id: rclconfig.h,v 1.1 2004-12-14 17:50:28 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: rclconfig.h,v 1.2 2004-12-15 15:00:36 dockes Exp $ (C) 2004 J.F.Dockes */
#include "conftree.h"
@@ -9,18 +9,30 @@ class RclConfig {
string confdir; // Directory where the files are stored
ConfTree *conf; // Parsed main configuration
string keydir; // Current directory used for parameter fetches.
string defcharset; // These are stored locally to avoid a config lookup
string deflang; // each time.
// Note: this will have to change if/when we support per directory maps
ConfTree *mimemap;
ConfTree *mimeconf;
public:
// Let some parameters be accessed directly
string defcharset; // These are stored locally to avoid a config lookup
string deflang; // each time.
bool guesscharset;
RclConfig();
~RclConfig() {delete conf;delete mimemap;delete mimeconf;}
bool ok() {return m_ok;}
ConfTree *getConfig() {return m_ok ? conf : 0;}
ConfTree *getMimeMap() {return m_ok ? mimemap : 0;}
ConfTree *getMimeConf() {return m_ok ? mimeconf : 0;}
void setKeyDir(const string &dir)
{
keydir = dir;
conf->get("defaultcharset", defcharset, keydir);
conf->get("defaultlanguage", deflang, keydir);
string str;
conf->get("guesscharset", deflang, str);
guesscharset = ConfTree::stringToBool(str);
}
bool getConfParam(const string &name, string &value)
{
if (conf == 0)
@@ -33,12 +45,6 @@ class RclConfig {
const string &getDefLang() {
return deflang;
}
void setKeyDir(const string &dir)
{
keydir = dir;
conf->get("defaultcharset", defcharset, keydir);
conf->get("defaultlanguage", deflang, keydir);
}
};
+9 -9
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: textsplit.cpp,v 1.2 2004-12-14 17:49:11 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: textsplit.cpp,v 1.3 2004-12-15 15:00:36 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#ifndef TEST_TEXTSPLIT
@@ -35,24 +35,24 @@ static void setcharclasses()
static int init = 0;
if (init)
return;
int i;
unsigned int i;
memset(charclasses, LETTER, sizeof(charclasses));
char digits[] = "0123456789";
for (i = 0; i < sizeof(digits); i++)
charclasses[digits[i]] = DIGIT;
charclasses[int(digits[i])] = DIGIT;
char blankspace[] = "\t\v\f ";
for (i = 0; i < sizeof(blankspace); i++)
charclasses[blankspace[i]] = SPACE;
charclasses[int(blankspace[i])] = SPACE;
char seps[] = "!\"$%&()/<=>[\\]^{|}~:;,*";
for (i = 0; i < sizeof(seps); i++)
charclasses[seps[i]] = SPACE;
charclasses[int(seps[i])] = SPACE;
char special[] = ".@+-,#'\n\r";
for (i = 0; i < sizeof(special); i++)
charclasses[special[i]] = special[i];
charclasses[int(special[i])] = special[i];
init = 1;
}
@@ -95,7 +95,7 @@ void TextSplit::text_to_words(const string &in)
int wordpos = 0;
int spanpos = 0;
for (int i = 0; i < in.length(); i++) {
for (unsigned int i = 0; i < in.length(); i++) {
int c = in[i];
int cc = charclasses[c];
switch (cc) {
@@ -114,7 +114,7 @@ void TextSplit::text_to_words(const string &in)
case '-':
case '+':
if (word.length() == 0) {
if (i < in.length() || charclasses[in[i+1]] == DIGIT) {
if (i < in.length() || charclasses[int(in[i+1])] == DIGIT) {
number = true;
word += c;
span += c;
@@ -155,7 +155,7 @@ void TextSplit::text_to_words(const string &in)
case '#':
// Keep it only at end of word...
if (word.length() > 0 &&
(i == in.length() -1 || charclasses[in[i+1]] == SPACE)) {
(i == in.length() -1 || charclasses[int(in[i+1])] == SPACE)) {
word += c;
span += c;
}