From 7b6c8b08e9d29332dcd0a1029e7421334bfb6f61 Mon Sep 17 00:00:00 2001 From: Daniel Glassey Date: Mon, 7 Sep 2015 11:14:57 +0100 Subject: Imported Upstream version 1.7.3+dfsg --- src/mgr/swmgr.cpp | 4 +- src/modules/comments/zcom/zcom.cpp | 22 +++++------ src/modules/common/bz2comprs.cpp | 4 +- src/modules/common/rawstr.cpp | 7 ++-- src/modules/common/rawstr4.cpp | 7 ++-- src/modules/common/rawverse.cpp | 5 ++- src/modules/common/rawverse4.cpp | 8 ++-- src/modules/common/swcomprs.cpp | 4 +- src/modules/common/xzcomprs.cpp | 4 +- src/modules/common/zipcomprs.cpp | 4 +- src/modules/common/zverse.cpp | 54 +++++++++++++++++---------- src/modules/filters/osisheadings.cpp | 18 ++++++++- src/modules/filters/osishtmlhref.cpp | 24 +++++++++--- src/modules/filters/osismorphsegmentation.cpp | 8 ++-- src/modules/filters/osisplain.cpp | 4 +- src/modules/filters/osisrtf.cpp | 6 +-- src/modules/filters/osisscripref.cpp | 6 +-- src/modules/filters/osisxhtml.cpp | 36 ++++++++++-------- src/modules/filters/teihtmlhref.cpp | 27 ++++++++------ src/modules/filters/teirtf.cpp | 19 ++++++++-- src/modules/filters/teixhtml.cpp | 22 +++++------ src/modules/filters/thmlheadings.cpp | 26 +++++++++++-- src/modules/filters/thmlscripref.cpp | 6 +-- src/modules/filters/thmlxhtml.cpp | 20 +++++----- src/modules/filters/unicodertf.cpp | 3 +- src/modules/filters/utf16utf8.cpp | 5 +-- src/modules/filters/utf8html.cpp | 3 +- src/modules/filters/utf8latin1.cpp | 5 +-- src/modules/filters/utf8nfc.cpp | 17 ++++----- src/modules/filters/utf8nfkd.cpp | 6 +-- src/modules/filters/utf8utf16.cpp | 6 +-- 31 files changed, 227 insertions(+), 163 deletions(-) (limited to 'src') diff --git a/src/mgr/swmgr.cpp b/src/mgr/swmgr.cpp index 0a2d583..b41c411 100644 --- a/src/mgr/swmgr.cpp +++ b/src/mgr/swmgr.cpp @@ -2,9 +2,9 @@ * * swmgr.cpp - used to interact with an install base of sword modules * - * $Id: swmgr.cpp 2985 2013-10-04 14:38:14Z scribe $ + * $Id: swmgr.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ * - * Copyright 1998-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 1998-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 diff --git a/src/modules/comments/zcom/zcom.cpp b/src/modules/comments/zcom/zcom.cpp index 65c4ca8..839baf5 100644 --- a/src/modules/comments/zcom/zcom.cpp +++ b/src/modules/comments/zcom/zcom.cpp @@ -3,7 +3,7 @@ * zcom.cpp - code for class 'zCom'- a module that reads raw commentary * files * - * $Id: zcom.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: zcom.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ * * Copyright 1996-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -68,24 +68,24 @@ bool zCom::isWritable() const { /****************************************************************************** - * zCom::getRawEntry - Returns the correct verse when char * cast - * is requested + * zCom::getRawEntry - Returns the current verse buffer * - * RET: string buffer with verse + * RET: buffer with verse */ + SWBuf &zCom::getRawEntryBuf() const { long start = 0; unsigned short size = 0; - unsigned long buffnum; - VerseKey *key = &getVerseKey(); + unsigned long buffnum = 0; + VerseKey &key = getVerseKey(); - findOffset(key->getTestament(), key->getTestamentIndex(), &start, &size, &buffnum); + findOffset(key.getTestament(), key.getTestamentIndex(), &start, &size, &buffnum); entrySize = size; // support getEntrySize call - + entryBuf = ""; - zReadText(key->getTestament(), start, size, buffnum, entryBuf); - - rawFilter(entryBuf, key); + + zReadText(key.getTestament(), start, size, buffnum, entryBuf); + rawFilter(entryBuf, &key); // if (!isUnicode()) prepText(entryBuf); diff --git a/src/modules/common/bz2comprs.cpp b/src/modules/common/bz2comprs.cpp index 16f6d11..7863e98 100644 --- a/src/modules/common/bz2comprs.cpp +++ b/src/modules/common/bz2comprs.cpp @@ -3,9 +3,9 @@ * bz2comprs.cpp - Bzip2Compress, a driver class that provides bzip2 * compression (Burrows–Wheeler with Huffman coding) * - * $Id: bz2comprs.cpp 2858 2013-07-08 03:08:10Z chrislit $ + * $Id: bz2comprs.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ * - * Copyright 2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 2000-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 diff --git a/src/modules/common/rawstr.cpp b/src/modules/common/rawstr.cpp index 788ab6e..12371ab 100644 --- a/src/modules/common/rawstr.cpp +++ b/src/modules/common/rawstr.cpp @@ -5,7 +5,7 @@ * and provides lookup and parsing functions based on * class StrKey * - * $Id: rawstr.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: rawstr.cpp 3181 2014-04-17 04:27:57Z greg.hellings $ * * Copyright 1998-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -43,7 +43,7 @@ SWORD_NAMESPACE_START */ int RawStr::instance = 0; -char RawStr::nl = '\n'; +const char RawStr::nl = '\n'; const int RawStr::IDXENTRYSIZE = 6; @@ -372,7 +372,6 @@ void RawStr::doSetText(const char *ikey, const char *buf, long len) __s32 shiftSize; __u16 size; __u16 outsize; - static const char nl[] = {13, 10}; char *tmpbuf = 0; char *key = 0; char *dbKey = 0; @@ -452,7 +451,7 @@ void RawStr::doSetText(const char *ikey, const char *buf, long len) datfd->write(outbuf, (int)size); // add a new line to make data file easier to read in an editor - datfd->write(&nl, 2); + datfd->write(&nl, 1); idxfd->write(&outstart, 4); idxfd->write(&outsize, 2); diff --git a/src/modules/common/rawstr4.cpp b/src/modules/common/rawstr4.cpp index e2ce899..c88e70d 100644 --- a/src/modules/common/rawstr4.cpp +++ b/src/modules/common/rawstr4.cpp @@ -5,7 +5,7 @@ * and provides lookup and parsing functions based on * class StrKey * - * $Id: rawstr4.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: rawstr4.cpp 3181 2014-04-17 04:27:57Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -44,6 +44,7 @@ SWORD_NAMESPACE_START */ int RawStr4::instance = 0; +const char RawStr4::nl = '\n'; const int RawStr4::IDXENTRYSIZE = 8; @@ -59,7 +60,6 @@ RawStr4::RawStr4(const char *ipath, int fileMode, bool caseSensitive) : caseSens { SWBuf buf; - nl = '\n'; lastoff = -1; path = 0; stdstr(&path, ipath); @@ -380,7 +380,6 @@ void RawStr4::doSetText(const char *ikey, const char *buf, long len) { __s32 shiftSize; __u32 size; __u32 outsize; - static const char nl[] = {13, 10}; char *tmpbuf = 0; char *key = 0; char *dbKey = 0; @@ -460,7 +459,7 @@ void RawStr4::doSetText(const char *ikey, const char *buf, long len) { datfd->write(outbuf, (long)size); // add a new line to make data file easier to read in an editor - datfd->write(&nl, 2); + datfd->write(&nl, 1); idxfd->write(&outstart, 4); idxfd->write(&outsize, 4); diff --git a/src/modules/common/rawverse.cpp b/src/modules/common/rawverse.cpp index 5527d38..34fba10 100644 --- a/src/modules/common/rawverse.cpp +++ b/src/modules/common/rawverse.cpp @@ -5,6 +5,7 @@ * and provides lookup and parsing functions based on * class VerseKey * + * $Id: rawverse.cpp 3181 2014-04-17 04:27:57Z greg.hellings $ * * Copyright 1997-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -44,7 +45,7 @@ SWORD_NAMESPACE_START */ int RawVerse::instance = 0; -const char *RawVerse::nl = "\r\n"; +const char RawVerse::nl = '\n'; /****************************************************************************** @@ -193,7 +194,7 @@ void RawVerse::doSetText(char testmt, long idxoff, const char *buf, long len) textfp[testmt-1]->write(buf, (int)size); // add a new line to make data file easier to read in an editor - textfp[testmt-1]->write(nl, 2); + textfp[testmt-1]->write(&nl, 1); } else { start = 0; diff --git a/src/modules/common/rawverse4.cpp b/src/modules/common/rawverse4.cpp index b87ea0d..100ef6b 100644 --- a/src/modules/common/rawverse4.cpp +++ b/src/modules/common/rawverse4.cpp @@ -6,7 +6,7 @@ * and provides lookup and parsing functions based on * class VerseKey * - * $Id: rawverse4.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: rawverse4.cpp 3182 2014-04-17 04:28:36Z greg.hellings $ * * Copyright 2007-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -46,7 +46,7 @@ SWORD_NAMESPACE_START */ int RawVerse4::instance = 0; -const char *RawVerse4::nl = "\r\n"; +const char RawVerse4::nl = '\n'; /****************************************************************************** @@ -131,7 +131,7 @@ void RawVerse4::findOffset(char testmt, long idxoff, long *start, unsigned long *start = swordtoarch32(tmpStart); *size = swordtoarch32(tmpSize); - if (len < 2) { + if (len < 4) { *size = (unsigned long)((*start) ? (textfp[testmt-1]->seek(0, SEEK_END) - (long)*start) : 0); // if for some reason we get an error reading size, make size to end of file } } @@ -195,7 +195,7 @@ void RawVerse4::doSetText(char testmt, long idxoff, const char *buf, long len) textfp[testmt-1]->write(buf, (int)size); // add a new line to make data file easier to read in an editor - textfp[testmt-1]->write(nl, 2); + textfp[testmt-1]->write(&nl, 1); } else { start = 0; diff --git a/src/modules/common/swcomprs.cpp b/src/modules/common/swcomprs.cpp index 9df8e7d..a9ac72e 100644 --- a/src/modules/common/swcomprs.cpp +++ b/src/modules/common/swcomprs.cpp @@ -2,9 +2,9 @@ * * swcomprs.cpp - a driver class that provides compression utilities * - * $Id: swcomprs.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: swcomprs.cpp 3175 2014-04-17 04:21:31Z greg.hellings $ * - * Copyright 1996-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 1996-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 diff --git a/src/modules/common/xzcomprs.cpp b/src/modules/common/xzcomprs.cpp index db8a4a8..513e170 100644 --- a/src/modules/common/xzcomprs.cpp +++ b/src/modules/common/xzcomprs.cpp @@ -3,9 +3,9 @@ * xzcomprs.cpp - XzCompress, a driver class that provides xz (LZMA2) * compression * - * $Id: xzcomprs.cpp 2850 2013-07-02 09:57:20Z chrislit $ + * $Id: xzcomprs.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ * - * Copyright 2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 2000-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 diff --git a/src/modules/common/zipcomprs.cpp b/src/modules/common/zipcomprs.cpp index 3e44abd..28471d8 100644 --- a/src/modules/common/zipcomprs.cpp +++ b/src/modules/common/zipcomprs.cpp @@ -3,9 +3,9 @@ * zipcomprs.cpp - ZipCompress, a driver class that provides zlib * compression * - * $Id: zipcomprs.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: zipcomprs.cpp 3175 2014-04-17 04:21:31Z greg.hellings $ * - * Copyright 2000-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 2000-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 diff --git a/src/modules/common/zverse.cpp b/src/modules/common/zverse.cpp index c280d98..cd63eca 100644 --- a/src/modules/common/zverse.cpp +++ b/src/modules/common/zverse.cpp @@ -5,7 +5,7 @@ * and provides lookup and parsing functions based on * class VerseKey for compressed modules * - * $Id: zverse.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: zverse.cpp 3166 2014-04-17 04:08:45Z greg.hellings $ * * Copyright 1996-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -428,7 +428,11 @@ char zVerse::createModule(const char *ipath, int blockBound, const char *v11n) { char *path = 0; char *buf = new char [ strlen (ipath) + 20 ]; + char retVal = 0; FileDesc *fd, *fd2; + __s32 offset = 0; + __s16 size = 0; + VerseKey vk; stdstr(&path, ipath); @@ -438,69 +442,81 @@ char zVerse::createModule(const char *ipath, int blockBound, const char *v11n) sprintf(buf, "%s/ot.%czs", path, uniqueIndexID[blockBound]); FileMgr::removeFile(buf); fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE); - fd->getFd(); + if (fd->getFd() < 1) goto erroropen1; FileMgr::getSystemFileMgr()->close(fd); sprintf(buf, "%s/nt.%czs", path, uniqueIndexID[blockBound]); FileMgr::removeFile(buf); fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE); - fd->getFd(); + if (fd->getFd() < 1) goto erroropen1; FileMgr::getSystemFileMgr()->close(fd); sprintf(buf, "%s/ot.%czz", path, uniqueIndexID[blockBound]); FileMgr::removeFile(buf); fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE); - fd->getFd(); + if (fd->getFd() < 1) goto erroropen1; FileMgr::getSystemFileMgr()->close(fd); sprintf(buf, "%s/nt.%czz", path, uniqueIndexID[blockBound]); FileMgr::removeFile(buf); - fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE); - fd2->getFd(); + fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE); + if (fd->getFd() < 1) goto erroropen1; FileMgr::getSystemFileMgr()->close(fd); sprintf(buf, "%s/ot.%czv", path, uniqueIndexID[blockBound]); FileMgr::removeFile(buf); fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE); - fd->getFd(); + if (fd->getFd() < 1) goto erroropen1; sprintf(buf, "%s/nt.%czv", path, uniqueIndexID[blockBound]); FileMgr::removeFile(buf); fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE); - fd2->getFd(); + if (fd2->getFd() < 1) goto erroropen2; - VerseKey vk; vk.setVersificationSystem(v11n); vk.setIntros(true); - __s32 offset = 0; - __s16 size = 0; offset = archtosword32(offset); size = archtosword16(size); for (vk = TOP; !vk.popError(); vk++) { if (vk.getTestament() < 2) { - fd->write(&offset, 4); //compBufIdxOffset - fd->write(&offset, 4); - fd->write(&size, 2); + if (fd->write(&offset, 4) != 4) goto writefailure; //compBufIdxOffset + if (fd->write(&offset, 4) != 4) goto writefailure; + if (fd->write(&size, 2) != 2) goto writefailure; } else { - fd2->write(&offset, 4); //compBufIdxOffset - fd2->write(&offset, 4); - fd2->write(&size, 2); + if (fd2->write(&offset, 4) != 4) goto writefailure; //compBufIdxOffset + if (fd2->write(&offset, 4) != 4) goto writefailure; + if (fd2->write(&size, 2) != 2) goto writefailure; } } fd2->write(&offset, 4); //compBufIdxOffset fd2->write(&offset, 4); fd2->write(&size, 2); - FileMgr::getSystemFileMgr()->close(fd); + goto cleanup; + +erroropen1: + retVal = -1; + goto cleanup1; + +erroropen2: + retVal = -1; + goto cleanup; + +writefailure: + retVal = -2; + +cleanup: FileMgr::getSystemFileMgr()->close(fd2); +cleanup1: + FileMgr::getSystemFileMgr()->close(fd); delete [] path; delete [] buf; - return 0; + return retVal; } diff --git a/src/modules/filters/osisheadings.cpp b/src/modules/filters/osisheadings.cpp index 783fa81..7a5f525 100644 --- a/src/modules/filters/osisheadings.cpp +++ b/src/modules/filters/osisheadings.cpp @@ -3,7 +3,7 @@ * osisheadings.cpp - SWFilter descendant to hide or show headings * in an OSIS module * - * $Id: osisheadings.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: osisheadings.cpp 3194 2014-04-24 03:02:47Z greg.hellings $ * * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -91,6 +91,7 @@ bool OSISHeadings::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat if (name == u->currentHeadingName) { if (tag.isEndTag(u->sID)) { if (!u->depth-- || u->sID) { + // see comment below about preverse div changed and needing to preserve the container tag for old school pre-verse titles // we've just finished a heading. It's all stored up in u->heading bool canonical = (SWBuf("true") == u->currentHeadingTag.getAttribute("canonical")); bool preverse = (SWBuf("x-preverse") == u->currentHeadingTag.getAttribute("subType") || SWBuf("x-preverse") == u->currentHeadingTag.getAttribute("subtype")); @@ -98,7 +99,20 @@ bool OSISHeadings::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat // do we want to put anything in EntryAttributes? if (u->module->isProcessEntryAttributes() && (option || canonical || !preverse)) { SWBuf buf; buf.appendFormatted("%i", u->headerNum++); - u->module->getEntryAttributes()["Heading"][(preverse)?"Preverse":"Interverse"][buf] = u->heading; + // leave the actual <title...> wrapper in if we're part of an old school preverse title + // because now frontend have to deal with preverse as a div which may or may not include <title> elements + // and they can't simply wrap all preverse material in <h1>, like they probably did previously + SWBuf heading; + if (u->currentHeadingName == "title") { + XMLTag wrapper = u->currentHeadingTag; + if (SWBuf("x-preverse") == wrapper.getAttribute("subType")) wrapper.setAttribute("subType", 0); + else if (SWBuf("x-preverse") == wrapper.getAttribute("subtype")) wrapper.setAttribute("subtype", 0); + heading = wrapper; + heading += u->heading; + heading += tag; + } + else heading = u->heading; + u->module->getEntryAttributes()["Heading"][(preverse)?"Preverse":"Interverse"][buf] = heading; StringList attributes = u->currentHeadingTag.getAttributeNames(); for (StringList::const_iterator it = attributes.begin(); it != attributes.end(); it++) { diff --git a/src/modules/filters/osishtmlhref.cpp b/src/modules/filters/osishtmlhref.cpp index 74b2da7..9cda9ab 100644 --- a/src/modules/filters/osishtmlhref.cpp +++ b/src/modules/filters/osishtmlhref.cpp @@ -2,9 +2,9 @@ * * osishtmlhref.cpp - OSIS to HTML with hrefs filter * - * $Id: osishtmlhref.cpp 3005 2014-01-09 04:06:11Z greg.hellings $ + * $Id: osishtmlhref.cpp 3173 2014-04-17 04:20:33Z greg.hellings $ * - * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 2003-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -289,7 +289,7 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat // Milestoned paragraphs, created by osis2mod // <div type="paragraph" sID.../> // <div type="paragraph" eID.../> - else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "paragraph")) { + else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && (!strcmp(tag.getAttribute("type"), "x-p") || !strcmp(tag.getAttribute("type"), "paragraph"))) { // <div type="paragraph" sID... /> if (tag.getAttribute("sID")) { // non-empty start tag outText("<!P><br />", buf, u); @@ -481,9 +481,15 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat if (type == "bold" || type == "b" || type == "x-b") { outText("<b>", buf, u); } - else if (type == "ol") { + else if (type == "ol" || type == "overline" || type == "x-overline") { outText("<span style=\"text-decoration:overline\">", buf, u); } + else if (type == "super") { + outText("<sup>", buf, u); + } + else if (type == "sub") { + outText("<sub>", buf, u); + } else { // all other types outText("<i>", buf, u); } @@ -503,7 +509,15 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat else if (type == "ol") { outText("</span>", buf, u); } - else outText("</i>", buf, u); + else if (type == "sup") { + outText("</sup>", buf, u); + } + else if (type == "sub") { + outText("</sub>", buf, u); + } + else { + outText("</i>", buf, u); + } } } diff --git a/src/modules/filters/osismorphsegmentation.cpp b/src/modules/filters/osismorphsegmentation.cpp index 9afc0a1..1d91428 100644 --- a/src/modules/filters/osismorphsegmentation.cpp +++ b/src/modules/filters/osismorphsegmentation.cpp @@ -4,7 +4,7 @@ * morphemes (for morpheme segmented Hebrew in * the WLC) * - * $Id: osismorphsegmentation.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: osismorphsegmentation.cpp 3186 2014-04-17 04:33:19Z greg.hellings $ * * Copyright 2006-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -78,13 +78,15 @@ char OSISMorphSegmentation::processText(SWBuf &text, const SWKey * /*key*/, cons if (!strncmp(token.c_str(), "seg ", 4) || !strncmp(token.c_str(), "/seg", 4)) { tag = token; - if (!tag.isEndTag() && tag.getAttribute("type") && !strcmp("morph", tag.getAttribute("type"))) { //<seg type="morph"> start tag + if (!tag.isEndTag() && tag.getAttribute("type") && + ( !strcmp("morph", tag.getAttribute("type")) + || !strcmp("x-morph", tag.getAttribute("type")))) { //<seg type="morph"> start tag hide = !option; //only hide if option is Off tagText = ""; inMorpheme = true; } - if (tag.isEndTag()) { + if (tag.isEndTag() && inMorpheme) { buf.setFormatted("%.3d", morphemeNum++); module->getEntryAttributes()["Morpheme"][buf]["body"] = tagText; inMorpheme = false; diff --git a/src/modules/filters/osisplain.cpp b/src/modules/filters/osisplain.cpp index 6e583a4..24f5518 100644 --- a/src/modules/filters/osisplain.cpp +++ b/src/modules/filters/osisplain.cpp @@ -2,7 +2,7 @@ * * osisplain.cpp - An SWFilter that provides stripping of OSIS tags * - * $Id: osisplain.cpp 2984 2013-09-20 12:18:45Z scribe $ + * $Id: osisplain.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ * * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -185,7 +185,7 @@ bool OSISPlain::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * // Milestoned paragraph, created by osis2mod // <div type="paragraph" sID... /> // <div type="paragraph" eID... /> - else if (!strcmp(u->tag.getName(), "div") && u->tag.getAttribute("type") && !strcmp(u->tag.getAttribute("type"), "paragraph") && + else if (!strcmp(u->tag.getName(), "div") && u->tag.getAttribute("type") && (!strcmp(u->tag.getAttribute("type"), "x-p") || !strcmp(u->tag.getAttribute("type"), "paragraph")) && (u->tag.isEmpty() && (u->tag.getAttribute("sID") || u->tag.getAttribute("eID")))) { userData->supressAdjacentWhitespace = true; buf.append('\n'); diff --git a/src/modules/filters/osisrtf.cpp b/src/modules/filters/osisrtf.cpp index 291aa08..7bc5639 100644 --- a/src/modules/filters/osisrtf.cpp +++ b/src/modules/filters/osisrtf.cpp @@ -2,9 +2,9 @@ * * osisrtf.cpp - OSIS to RTF filter * - * $Id: osisrtf.cpp 3005 2014-01-09 04:06:11Z greg.hellings $ * + * $Id: osisrtf.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ * * - * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 2003-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -284,7 +284,7 @@ bool OSISRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *us // Milestoned paragraphs, created by osis2mod // <div type="paragraph" sID.../> // <div type="paragraph" eID.../> - else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "paragraph")) { + else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && (!strcmp(tag.getAttribute("type"), "x-p") || !strcmp(tag.getAttribute("type"), "paragraph"))) { // <div type="paragraph" sID... /> if (tag.getAttribute("sID")) { // non-empty start tag outText("{\\fi200\\par}", buf, u); diff --git a/src/modules/filters/osisscripref.cpp b/src/modules/filters/osisscripref.cpp index 2bb7d15..99d6709 100644 --- a/src/modules/filters/osisscripref.cpp +++ b/src/modules/filters/osisscripref.cpp @@ -3,9 +3,9 @@ * osisscripref.cpp - SWFilter descendant to hide or show scripture * references in an OSIS module * - * $Id: osisscripref.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: osisscripref.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ * - * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 2003-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -35,7 +35,7 @@ namespace { static const char oTip[] = "Toggles Scripture Cross-references On and Off if they exist"; static const StringList *oValues() { - static const SWBuf choices[3] = {"On", "Off", ""}; + static const SWBuf choices[3] = {"Off", "On", ""}; static const StringList oVals(&choices[0], &choices[2]); return &oVals; } diff --git a/src/modules/filters/osisxhtml.cpp b/src/modules/filters/osisxhtml.cpp index b1040a9..3f75c4a 100644 --- a/src/modules/filters/osisxhtml.cpp +++ b/src/modules/filters/osisxhtml.cpp @@ -2,9 +2,9 @@ * * osisxhtml.cpp - Render filter for classed XHTML of an OSIS module * - * $Id: osisxhtml.cpp 3005 2014-01-09 04:06:11Z greg.hellings $ + * $Id: osisxhtml.cpp 3205 2014-05-01 02:31:28Z greg.hellings $ * - * Copyright 2011-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 2011-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -38,9 +38,7 @@ const char *OSISXHTML::getHeader() const { .divineName { font-variant: small-caps; }\n\ .wordsOfJesus { color: red; }\n\ .transChangeSupplied { font-style: italic; }\n\ - .small, .sub, .sup { font-size: .83em }\n\ - .sub { vertical-align: sub }\n\ - .sup { vertical-align: super }\n\ + .overline { text-decoration: overline; }\n\ .indent1 { margin-left: 10px }\n\ .indent2 { margin-left: 20px }\n\ .indent3 { margin-left: 30px }\n\ @@ -291,7 +289,7 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * URL::encode(vkey->getText()).c_str(), ch, ch, - (renderNoteNumbers ? URL::encode(noteName.c_str()).c_str() : "")); + (renderNoteNumbers ? noteName.c_str() : "")); } else { buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c%s</sup></small></a>", @@ -301,7 +299,7 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * URL::encode(u->key->getText()).c_str(), ch, ch, - (renderNoteNumbers ? URL::encode(noteName.c_str()).c_str() : "")); + (renderNoteNumbers ? noteName.c_str() : "")); } } } @@ -330,7 +328,7 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * // Milestoned paragraphs, created by osis2mod // <div type="paragraph" sID.../> // <div type="paragraph" eID.../> - else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "paragraph")) { + else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && (!strcmp(tag.getAttribute("type"), "x-p") || !strcmp(tag.getAttribute("type"), "paragraph"))) { // <div type="paragraph" sID... /> if (tag.getAttribute("sID")) { // non-empty start tag u->outputNewline(buf); @@ -563,15 +561,15 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * // but we have used "ol" in the past, as well. Once a valid // OSIS overline attribute is made available, these should all // eventually be deprecated and never documented that they are supported. - else if (type == "ol" || type == "overline" || type == "x-overline") { - outText("<span style=\"text-decoration:overline\">", buf, u); + else if (type == "ol" || type == "overline" || type == "x-overline") { + outText("<span class=\"overline\">", buf, u); } else if (type == "super") { - outText("<span class=\"sup\">", buf, u); + outText("<sup>", buf, u); } else if (type == "sub") { - outText("<span class=\"sub\">", buf, u); + outText("<sub>", buf, u); } else { // all other types outText("<i>", buf, u); @@ -589,12 +587,18 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * if (type == "bold" || type == "b" || type == "x-b") { outText("</b>", buf, u); } - else if ( type == "ol" - || type == "super" - || type == "sub") { + else if (type == "ol") { outText("</span>", buf, u); } - else outText("</i>", buf, u); + else if (type == "sup") { + outText("</sup>", buf, u); + } + else if (type == "sub") { + outText("</sub>", buf, u); + } + else { + outText("</i>", buf, u); + } } } diff --git a/src/modules/filters/teihtmlhref.cpp b/src/modules/filters/teihtmlhref.cpp index 43fe584..f08f994 100644 --- a/src/modules/filters/teihtmlhref.cpp +++ b/src/modules/filters/teihtmlhref.cpp @@ -2,7 +2,7 @@ * * teihtmlhref.cpp - TEI to HTML with hrefs filter * - * $Id: teihtmlhref.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: teihtmlhref.cpp 3160 2014-04-17 04:02:17Z greg.hellings $ * * Copyright 2008-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -87,26 +87,29 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData SWBuf rend = tag.getAttribute("rend"); u->lastHi = rend; - if (rend == "ital") - buf += "<i>"; - else if (rend == "italic") + if (rend == "italic" || rend == "ital") buf += "<i>"; else if (rend == "bold") buf += "<b>"; - else if (rend == "sup") - buf += "<small><sup>"; - + else if (rend == "super" || rend == "sup") + buf += "<sup>"; + else if (rend == "sub") + buf += "<sub>"; + else if (rend == "overline") + buf += "<span style=\"text-decoration:overline\">"; } else if (tag.isEndTag()) { SWBuf rend = u->lastHi; - if (rend == "ital") - buf += "</i>"; - else if (rend == "italic") + if (rend == "italic" || rend == "ital") buf += "</i>"; else if (rend == "bold") buf += "</b>"; - else if (rend == "sup") - buf += "</sup></small>"; + else if (rend == "super" || rend == "sup") + buf += "</sup>"; + else if (rend == "sub") + buf += "</sub>"; + else if (rend == "overline") + buf += "</span>"; } } diff --git a/src/modules/filters/teirtf.cpp b/src/modules/filters/teirtf.cpp index 979e4a6..1213221 100644 --- a/src/modules/filters/teirtf.cpp +++ b/src/modules/filters/teirtf.cpp @@ -2,7 +2,7 @@ * * teirtf.cpp - TEI to RTF filter * - * $Id: teirtf.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: teirtf.cpp 3160 2014-04-17 04:02:17Z greg.hellings $ * * Copyright 2006-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -76,13 +76,14 @@ bool TEIRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *use else if (!strcmp(tag.getName(), "hi") || !strcmp(tag.getName(), "emph")) { SWBuf rend = tag.getAttribute("rend"); if ((!tag.isEndTag()) && (!tag.isEmpty())) { - if (rend == "ital" || rend == "italic") + if (rend == "italic" || rend == "ital") buf += "{\\i1 "; else if (rend == "bold") buf += "{\\b1 "; - else if (rend == "sup") + else if (rend == "super" || rend == "sup") buf += "{\\super "; - + else if (rend == "sub") + buf += "{\\sub "; } else if (tag.isEndTag()) { buf += "}"; @@ -112,6 +113,16 @@ bool TEIRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *use } } + // <orth> + else if (!strcmp(tag.getName(), "orth")) { + if ((!tag.isEndTag()) && (!tag.isEmpty())) { + buf += "{\\b1 "; + } + else if (tag.isEndTag()) { + buf += "}"; + } + } + // <div> else if (!strcmp(tag.getName(), "div")) { diff --git a/src/modules/filters/teixhtml.cpp b/src/modules/filters/teixhtml.cpp index 6a390a1..4ae0d89 100644 --- a/src/modules/filters/teixhtml.cpp +++ b/src/modules/filters/teixhtml.cpp @@ -2,7 +2,7 @@ * * teixhtml.cpp - TEI to XHTML filter * - * $Id: teixhtml.cpp 2984 2013-09-20 12:18:45Z scribe $ + * $Id: teixhtml.cpp 3161 2014-04-17 04:04:03Z greg.hellings $ * * Copyright 2012-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -87,28 +87,28 @@ bool TEIXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *u SWBuf rend = tag.getAttribute("rend"); u->lastHi = rend; - if (rend == "ital") - buf += "<i>"; - else if (rend == "italic") + if (rend == "italic" || rend == "ital") buf += "<i>"; else if (rend == "bold") buf += "<b>"; - else if (rend == "sup") - buf += "<small><sup>"; + else if (rend == "super" || rend == "sup") + buf += "<sup>"; + else if (rend == "sub") + buf += "<sub>"; else if (rend == "overline") buf += "<span style=\"text-decoration:overline\">"; } else if (tag.isEndTag()) { SWBuf rend = u->lastHi; - if (rend == "ital") - buf += "</i>"; - else if (rend == "italic") + if (rend == "italic" || rend == "ital") buf += "</i>"; else if (rend == "bold") buf += "</b>"; - else if (rend == "sup") - buf += "</sup></small>"; + else if (rend == "super" || rend == "sup") + buf += "</sup>"; + else if (rend == "sub") + buf += "</sub>"; else if (rend == "overline") buf += "</span>"; } diff --git a/src/modules/filters/thmlheadings.cpp b/src/modules/filters/thmlheadings.cpp index 46498d0..99bd12a 100644 --- a/src/modules/filters/thmlheadings.cpp +++ b/src/modules/filters/thmlheadings.cpp @@ -3,7 +3,7 @@ * thmlheadings.cpp - SWFilter descendant to hide or show headings * in a ThML module * - * $Id: thmlheadings.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: thmlheadings.cpp 3195 2014-04-24 03:03:26Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -86,13 +86,22 @@ char ThMLHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *mo tag = token; if (hide && tag.isEndTag()) { if (module->isProcessEntryAttributes() && (option || (!preverse))) { + SWBuf heading; + SWBuf cls = startTag.getAttribute("class"); + if (!cls.startsWith("fromEntryAttributes")) { + cls = SWBuf("fromEntryAttributes ") + cls; + startTag.setAttribute("class", cls); + } + heading += startTag; + heading += header; + heading += tag; if (preverse) { sprintf(buf, "%i", pvHeaderNum++); - module->getEntryAttributes()["Heading"]["Preverse"][buf] = header; + module->getEntryAttributes()["Heading"]["Preverse"][buf] = heading; } else { sprintf(buf, "%i", headerNum++); - module->getEntryAttributes()["Heading"]["Interverse"][buf] = header; + module->getEntryAttributes()["Heading"]["Interverse"][buf] = heading; if (option) { // we want the tag in the text text.append(header); } @@ -143,8 +152,17 @@ char ThMLHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *mo } */ } - else + else { isheader = false; + SWBuf cls = tag.getAttribute("class"); + if (cls.startsWith("fromEntryAttributes ")) { + cls << SWBuf("fromEntryAttributes ").size(); + tag.setAttribute("class", cls); + token = tag; + token << 1; + token.setSize(token.size() - 1); + } + } } if (withinDiv && isheader) { diff --git a/src/modules/filters/thmlscripref.cpp b/src/modules/filters/thmlscripref.cpp index 1ea4a40..3a8b12a 100644 --- a/src/modules/filters/thmlscripref.cpp +++ b/src/modules/filters/thmlscripref.cpp @@ -3,9 +3,9 @@ * thmlscripref.cpp - SWFilter descendant to hide or show scripture * referebces in a ThML module * - * $Id: thmlscripref.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: thmlscripref.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ * - * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 2001-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -37,7 +37,7 @@ namespace { static const char oTip[] = "Toggles Scripture Cross-references On and Off if they exist"; static const StringList *oValues() { - static const SWBuf choices[3] = {"On", "Off", ""}; + static const SWBuf choices[3] = {"Off", "On", ""}; static const StringList oVals(&choices[0], &choices[2]); return &oVals; } diff --git a/src/modules/filters/thmlxhtml.cpp b/src/modules/filters/thmlxhtml.cpp index b17eb50..eb9c40a 100644 --- a/src/modules/filters/thmlxhtml.cpp +++ b/src/modules/filters/thmlxhtml.cpp @@ -2,7 +2,7 @@ * * thmlxhtml.cpp - ThML to classed XHTML * - * $Id: thmlxhtml.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: thmlxhtml.cpp 3205 2014-05-01 02:31:28Z greg.hellings $ * * Copyright 2011-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -230,7 +230,7 @@ bool ThMLXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * URL::encode(vkey->getText()).c_str(), ch, ch, - (renderNoteNumbers ? URL::encode(noteName.c_str()).c_str() : "")); + (renderNoteNumbers ? noteName.c_str() : "")); } else { char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n'); @@ -241,7 +241,7 @@ bool ThMLXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * URL::encode(u->key->getText()).c_str(), ch, ch, - (renderNoteNumbers ? URL::encode(noteName.c_str()).c_str() : "")); + (renderNoteNumbers ? noteName.c_str() : "")); } u->suspendTextPassThru = true; } @@ -289,7 +289,7 @@ bool ThMLXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * URL::encode(footnoteNumber.c_str()).c_str(), URL::encode(u->version.c_str()).c_str(), URL::encode(vkey->getText()).c_str(), - (renderNoteNumbers ? URL::encode(noteName.c_str()).c_str() : "")); + (renderNoteNumbers ? noteName.c_str() : "")); } } @@ -299,17 +299,19 @@ bool ThMLXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData * } else if (tag.getName() && !strcmp(tag.getName(), "div")) { if (tag.isEndTag() && u->SecHead) { - buf += "</i></b><br />"; + buf += "</h"; + buf += u->SecHead; + buf += ">"; u->SecHead = false; } else if (tag.getAttribute("class")) { if (!stricmp(tag.getAttribute("class"), "sechead")) { - u->SecHead = true; - buf += "<br /><b><i>"; + u->SecHead = '3'; + buf += "<h3>"; } else if (!stricmp(tag.getAttribute("class"), "title")) { - u->SecHead = true; - buf += "<br /><b><i>"; + u->SecHead = '2'; + buf += "<h2>"; } else { buf += tag; diff --git a/src/modules/filters/unicodertf.cpp b/src/modules/filters/unicodertf.cpp index 997597b..1cde086 100644 --- a/src/modules/filters/unicodertf.cpp +++ b/src/modules/filters/unicodertf.cpp @@ -2,7 +2,7 @@ * * unicodertf.cpp - SWFilter descendant to convert UTF-8 to RTF tags * - * $Id: unicodertf.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: unicodertf.cpp 3157 2014-04-17 03:56:12Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -20,7 +20,6 @@ * */ -#include <stdlib.h> #include <stdio.h> #include <unicodertf.h> #include <swbuf.h> diff --git a/src/modules/filters/utf16utf8.cpp b/src/modules/filters/utf16utf8.cpp index 6356284..d224db2 100644 --- a/src/modules/filters/utf16utf8.cpp +++ b/src/modules/filters/utf16utf8.cpp @@ -2,7 +2,7 @@ * * utf16utf8.cpp - SWFilter descendant to convert UTF-16 to UTF-8 * - * $Id: utf16utf8.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: utf16utf8.cpp 3157 2014-04-17 03:56:12Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -21,9 +21,6 @@ */ -#include <stdlib.h> -#include <stdio.h> - #include <utf16utf8.h> #include <swbuf.h> diff --git a/src/modules/filters/utf8html.cpp b/src/modules/filters/utf8html.cpp index 1f05ac7..d504418 100644 --- a/src/modules/filters/utf8html.cpp +++ b/src/modules/filters/utf8html.cpp @@ -3,7 +3,7 @@ * utf8html.cpp - SWFilter descendant to convert a UTF-8 stream to * HTML escapes * - * $Id: utf8html.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: utf8html.cpp 3157 2014-04-17 03:56:12Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -21,7 +21,6 @@ * */ -#include <stdlib.h> #include <stdio.h> #include <utf8html.h> #include <swbuf.h> diff --git a/src/modules/filters/utf8latin1.cpp b/src/modules/filters/utf8latin1.cpp index 1bf8d3b..db5237c 100644 --- a/src/modules/filters/utf8latin1.cpp +++ b/src/modules/filters/utf8latin1.cpp @@ -2,7 +2,7 @@ * * utf8latin1.cpp - SWFilter descendant to convert UTF-8 to Latin-1 * - * $Id: utf8latin1.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: utf8latin1.cpp 3157 2014-04-17 03:56:12Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -20,9 +20,6 @@ * */ -#include <stdlib.h> -#include <stdio.h> - #include <utf8latin1.h> #include <swbuf.h> diff --git a/src/modules/filters/utf8nfc.cpp b/src/modules/filters/utf8nfc.cpp index 49f12bb..06bd76f 100644 --- a/src/modules/filters/utf8nfc.cpp +++ b/src/modules/filters/utf8nfc.cpp @@ -3,7 +3,7 @@ * utf8nfc.cpp - SWFilter descendant to perform NFC (canonical * composition normalization) on UTF-8 text * - * $Id: utf8nfc.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: utf8nfc.cpp 3157 2014-04-17 03:56:12Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -23,9 +23,6 @@ #ifdef _ICU_ -#include <stdlib.h> - -#include <utilstr.h> #include <unicode/unistr.h> #include <unicode/normlzr.h> #include <unicode/unorm.h> @@ -48,16 +45,16 @@ char UTF8NFC::processText(SWBuf &text, const SWKey *key, const SWModule *module) if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering return -1; - UErrorCode status = U_ZERO_ERROR; - UnicodeString source(text.getRawData(), text.length(), conv, status); + err = U_ZERO_ERROR; + UnicodeString source(text.getRawData(), text.length(), conv, err); UnicodeString target; - status = U_ZERO_ERROR; - Normalizer::normalize(source, UNORM_NFC, 0, target, status); + err = U_ZERO_ERROR; + Normalizer::normalize(source, UNORM_NFC, 0, target, err); - status = U_ZERO_ERROR; + err = U_ZERO_ERROR; text.setSize(text.size()*2); // potentially, it can grow to 2x the original size - int32_t len = target.extract(text.getRawData(), text.size(), conv, status); + int32_t len = target.extract(text.getRawData(), text.size(), conv, err); text.setSize(len); return 0; diff --git a/src/modules/filters/utf8nfkd.cpp b/src/modules/filters/utf8nfkd.cpp index e4454d2..3a782ab 100644 --- a/src/modules/filters/utf8nfkd.cpp +++ b/src/modules/filters/utf8nfkd.cpp @@ -3,7 +3,7 @@ * utf8nfkd.cpp - SWFilter descendant to perform NFKD (compatability * decomposition normalization) on UTF-8 text * - * $Id: utf8nfkd.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: utf8nfkd.cpp 3157 2014-04-17 03:56:12Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -23,10 +23,6 @@ #ifdef _ICU_ -#include <stdlib.h> - -#include <utilstr.h> - #include <utf8nfkd.h> #include <swbuf.h> diff --git a/src/modules/filters/utf8utf16.cpp b/src/modules/filters/utf8utf16.cpp index be8ad4b..958f1d9 100644 --- a/src/modules/filters/utf8utf16.cpp +++ b/src/modules/filters/utf8utf16.cpp @@ -2,7 +2,7 @@ * * utf8utf16.cpp - SWFilter descendant to convert UTF-8 to UTF-16 * - * $Id: utf8utf16.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: utf8utf16.cpp 3157 2014-04-17 03:56:12Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -20,10 +20,7 @@ * */ -#include <stdlib.h> -#include <stdio.h> -#include <sysdata.h> #include <utf8utf16.h> #include <utilstr.h> #include <swbuf.h> @@ -68,7 +65,6 @@ char UTF8UTF16::processText(SWBuf &text, const SWKey *key, const SWModule *modul text.setSize(text.size()-2); return 0; - } SWORD_NAMESPACE_END -- cgit v1.2.3