[sword-svn] r2114 - in trunk: include src/frontend src/modules/filters src/utilfuns
scribe at www.crosswire.org
scribe at www.crosswire.org
Mon Oct 15 17:03:20 MST 2007
Author: scribe
Date: 2007-10-15 17:03:19 -0700 (Mon, 15 Oct 2007)
New Revision: 2114
Modified:
trunk/include/swbuf.h
trunk/src/frontend/swlog.cpp
trunk/src/modules/filters/osishtmlhref.cpp
trunk/src/modules/filters/osisrtf.cpp
trunk/src/utilfuns/utilstr.cpp
Log:
small cleanups
Modified: trunk/include/swbuf.h
===================================================================
--- trunk/include/swbuf.h 2007-10-15 00:16:27 UTC (rev 2113)
+++ trunk/include/swbuf.h 2007-10-16 00:03:19 UTC (rev 2114)
@@ -398,8 +398,8 @@
inline bool endsWith(const SWBuf &postfix) const { return (size() >= postfix.size())?!strncmp(end-postfix.size(), postfix.c_str(), postfix.size()):false; }
inline int compare(const SWBuf &other) const { return strcmp(c_str(), other.c_str()); }
- inline bool operator ==(const SWBuf &other) const { return !compare(other); }
- inline bool operator !=(const SWBuf &other) const { return compare(other); }
+ inline bool operator ==(const SWBuf &other) const { return compare(other) == 0; }
+ inline bool operator !=(const SWBuf &other) const { return compare(other) != 0; }
inline bool operator > (const SWBuf &other) const { return compare(other) > 0; }
inline bool operator < (const SWBuf &other) const { return compare(other) < 0; }
inline bool operator <=(const SWBuf &other) const { return compare(other) <= 0; }
@@ -416,8 +416,8 @@
inline bool endsWith(const char *postfix) const { unsigned int psize = strlen(postfix); return (size() >= psize)?!strncmp(end-psize, postfix, psize):false; }
inline int compare(const char *other) const { return strcmp(c_str(), other); }
- inline bool operator ==(const char *other) const { return !compare(other); }
- inline bool operator !=(const char *other) const { return compare(other); }
+ inline bool operator ==(const char *other) const { return compare(other) == 0; }
+ inline bool operator !=(const char *other) const { return compare(other) != 0; }
inline bool operator > (const char *other) const { return compare(other) > 0; }
inline bool operator < (const char *other) const { return compare(other) < 0; }
inline bool operator <=(const char *other) const { return compare(other) <= 0; }
Modified: trunk/src/frontend/swlog.cpp
===================================================================
--- trunk/src/frontend/swlog.cpp 2007-10-15 00:16:27 UTC (rev 2113)
+++ trunk/src/frontend/swlog.cpp 2007-10-16 00:03:19 UTC (rev 2114)
@@ -2,9 +2,7 @@
#include <stdarg.h>
#include <stdio.h>
-#ifndef _WIN32_WCE
#include <iostream>
-#endif
#if defined(_ICU_) && !defined(_ICUSWORD_)
#define _USTDIO_
#include <unicode/ustdio.h>
Modified: trunk/src/modules/filters/osishtmlhref.cpp
===================================================================
--- trunk/src/modules/filters/osishtmlhref.cpp 2007-10-15 00:16:27 UTC (rev 2113)
+++ trunk/src/modules/filters/osishtmlhref.cpp 2007-10-16 00:03:19 UTC (rev 2114)
@@ -26,7 +26,7 @@
SWORD_NAMESPACE_START
-class OSISHTMLHREF::QuoteStack : public std::stack<const char*> {
+class OSISHTMLHREF::QuoteStack : public std::stack<char *> {
};
OSISHTMLHREF::MyUserData::MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {
@@ -50,9 +50,9 @@
OSISHTMLHREF::MyUserData::~MyUserData() {
// Just in case the quotes are not well formed
while (!quoteStack->empty()) {
- const char *tagData = quoteStack->top();
+ char *tagData = quoteStack->top();
quoteStack->pop();
- delete tagData;
+ delete [] tagData;
}
delete quoteStack;
}
@@ -470,10 +470,10 @@
else if ((tag.isEndTag()) || (tag.isEmpty() && tag.getAttribute("eID"))) {
// if it is </q> then pop the stack for the attributes
if (tag.isEndTag() && !u->quoteStack->empty()) {
- const char *tagData = u->quoteStack->top();
+ char *tagData = u->quoteStack->top();
u->quoteStack->pop();
XMLTag qTag(tagData);
- delete tagData;
+ delete [] tagData;
type = qTag.getAttribute("type");
who = qTag.getAttribute("who");
Modified: trunk/src/modules/filters/osisrtf.cpp
===================================================================
--- trunk/src/modules/filters/osisrtf.cpp 2007-10-15 00:16:27 UTC (rev 2113)
+++ trunk/src/modules/filters/osisrtf.cpp 2007-10-16 00:03:19 UTC (rev 2114)
@@ -32,7 +32,7 @@
bool BiblicalText;
bool inXRefNote;
int suspendLevel;
- std::stack<const char*> quoteStack;
+ std::stack<char *> quoteStack;
SWBuf w;
SWBuf version;
MyUserData(const SWModule *module, const SWKey *key);
@@ -55,9 +55,9 @@
MyUserData::~MyUserData() {
// Just in case the quotes are not well formed
while (!quoteStack.empty()) {
- const char *tagData = quoteStack.top();
+ char *tagData = quoteStack.top();
quoteStack.pop();
- delete tagData;
+ delete [] tagData;
}
}
static inline void outText(const char *t, SWBuf &o, BasicFilterUserData *u) { if (!u->suspendTextPassThru) o += t; else u->lastSuspendSegment += t; }
@@ -382,10 +382,10 @@
else if ((tag.isEndTag()) || (tag.getAttribute("eID"))) {
// if it is </q> then pop the stack for the attributes
if (tag.isEndTag() && !u->quoteStack.empty()) {
- const char *tagData = u->quoteStack.top();
+ char *tagData = u->quoteStack.top();
u->quoteStack.pop();
XMLTag qTag(tagData);
- delete tagData;
+ delete [] tagData;
type = qTag.getAttribute("type");
who = qTag.getAttribute("who");
Modified: trunk/src/utilfuns/utilstr.cpp
===================================================================
--- trunk/src/utilfuns/utilstr.cpp 2007-10-15 00:16:27 UTC (rev 2113)
+++ trunk/src/utilfuns/utilstr.cpp 2007-10-16 00:03:19 UTC (rev 2114)
@@ -163,10 +163,14 @@
}
int stricmp(const char *s1, const char *s2) {
-#if defined(__GNUC__) || defined(_WIN32_WCE)
+#if defined(__GNUC__)
return ::strcasecmp(s1, s2);
#else
+ #if defined(_WIN32_WCE)
+ return ::_stricmp(s1, s2);
+ #else
return ::stricmp(s1, s2);
+ #endif
#endif
}
More information about the sword-cvs
mailing list