sword/sword-1.8.1-integer-types.diff

1489 lines
50 KiB
Diff

Author: Jaak Ristioja <jaak@ristioja.ee>
Date: Sat Aug 24 14:31:34 2019 +0300
Removed all __[su](8|16|32|64) types from sysdata.h, use <cstdint> types
diff --git a/examples/cmdline/search.cpp b/examples/cmdline/search.cpp
index 6e5d0ac9..e80f3541 100644
--- a/examples/cmdline/search.cpp
+++ b/examples/cmdline/search.cpp
@@ -129,7 +129,7 @@ int main(int argc, char **argv)
// listkey.sort();
while (!listkey.popError()) {
std::cout << (const char *)listkey;
- if (listkey.getElement()->userData) std::cout << " : " << (__u64)listkey.getElement()->userData << "%";
+ if (listkey.getElement()->userData) std::cout << " : " << (std::uint64_t)listkey.getElement()->userData << "%";
std::cout << std::endl;
listkey++;
}
diff --git a/include/rawstr.h b/include/rawstr.h
index d25ebc37..782cd0e0 100644
--- a/include/rawstr.h
+++ b/include/rawstr.h
@@ -54,8 +54,8 @@ public:
virtual ~RawStr();
void getIDXBuf(long ioffset, char **buf) const;
void getIDXBufDat(long ioffset, char **buf) const;
- signed char findOffset(const char *key, __u32 *start, __u16 *size, long away = 0, __u32 *idxoff = 0) const;
- void readText(__u32 start, __u16 *size, char **idxbuf, SWBuf &buf) const;
+ signed char findOffset(const char *key, std::uint32_t *start, std::uint16_t *size, long away = 0, std::uint32_t *idxoff = 0) const;
+ void readText(std::uint32_t start, std::uint16_t *size, char **idxbuf, SWBuf &buf) const;
static signed char createModule(const char *path);
};
diff --git a/include/rawstr4.h b/include/rawstr4.h
index 0277a25a..95d2e268 100644
--- a/include/rawstr4.h
+++ b/include/rawstr4.h
@@ -53,8 +53,8 @@ public:
virtual ~RawStr4();
void getIDXBuf(long ioffset, char **buf) const;
void getIDXBufDat(long ioffset, char **buf) const;
- signed char findOffset(const char *key, __u32 *start, __u32 *size, long away = 0, __u32 *idxoff = 0) const;
- void readText(__u32 start, __u32 *size, char **idxbuf, SWBuf &buf) const;
+ signed char findOffset(const char *key, std::uint32_t *start, std::uint32_t *size, long away = 0, std::uint32_t *idxoff = 0) const;
+ void readText(std::uint32_t start, std::uint32_t *size, char **idxbuf, SWBuf &buf) const;
static signed char createModule(const char *path);
};
diff --git a/include/swkey.h b/include/swkey.h
index f7c94f13..68c9e5d6 100644
--- a/include/swkey.h
+++ b/include/swkey.h
@@ -114,7 +114,7 @@ protected:
public:
// misc storage for whatever
- __u64 userData;
+ std::uint64_t userData;
/** initializes instance of SWKey from a string
* All keys can be reduced to a string representation which should be able
diff --git a/include/sysdata.h b/include/sysdata.h
index f979f29f..75bcdefd 100644
--- a/include/sysdata.h
+++ b/include/sysdata.h
@@ -22,6 +22,9 @@
#ifndef SIZEDTYPES_H
#define SIZEDTYPES_H
+
+#include <cstdint>
+
/*
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
* header files exported to user space
@@ -31,55 +34,34 @@
#endif
-typedef signed char __s8;
-typedef unsigned char __u8;
-
-typedef signed short __s16;
-typedef unsigned short __u16;
-
-typedef signed int __s32;
-typedef unsigned int __u32;
-
-#ifdef OS_ANDROID
-#elif defined(__GNUC__)
-__extension__ typedef __signed__ long long __s64;
-__extension__ typedef unsigned long long __u64;
-#elif defined(__BORLANDC__)
-typedef signed __int64 __s64;
-typedef unsigned __int64 __u64;
-#else
-typedef signed long long __s64;
-typedef unsigned long long __u64;
-#endif
-
#undef __swswap16
#undef __swswap32
#undef __swswap64
#define __swswap16(x) \
- ((__u16)( \
- (((__u16)(x) & (__u16)0x00ffU) << 8) | \
- (((__u16)(x) & (__u16)0xff00U) >> 8) ))
+ ((std::uint16_t)( \
+ (((std::uint16_t)(x) & (std::uint16_t)0x00ffU) << 8) | \
+ (((std::uint16_t)(x) & (std::uint16_t)0xff00U) >> 8) ))
#define __swswap32(x) \
- ((__u32)( \
- (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
- (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
- (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
- (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
+ ((std::uint32_t)( \
+ (((std::uint32_t)(x) & (std::uint32_t)0x000000ffUL) << 24) | \
+ (((std::uint32_t)(x) & (std::uint32_t)0x0000ff00UL) << 8) | \
+ (((std::uint32_t)(x) & (std::uint32_t)0x00ff0000UL) >> 8) | \
+ (((std::uint32_t)(x) & (std::uint32_t)0xff000000UL) >> 24) ))
#define __swswap64(x) \
- ((__u64)( \
- (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
- (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
- (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
- (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
- (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
- (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
- (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
- (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
+ ((std::uint64_t)( \
+ (std::uint64_t)(((std::uint64_t)(x) & (std::uint64_t)0x00000000000000ffULL) << 56) | \
+ (std::uint64_t)(((std::uint64_t)(x) & (std::uint64_t)0x000000000000ff00ULL) << 40) | \
+ (std::uint64_t)(((std::uint64_t)(x) & (std::uint64_t)0x0000000000ff0000ULL) << 24) | \
+ (std::uint64_t)(((std::uint64_t)(x) & (std::uint64_t)0x00000000ff000000ULL) << 8) | \
+ (std::uint64_t)(((std::uint64_t)(x) & (std::uint64_t)0x000000ff00000000ULL) >> 8) | \
+ (std::uint64_t)(((std::uint64_t)(x) & (std::uint64_t)0x0000ff0000000000ULL) >> 24) | \
+ (std::uint64_t)(((std::uint64_t)(x) & (std::uint64_t)0x00ff000000000000ULL) >> 40) | \
+ (std::uint64_t)(((std::uint64_t)(x) & (std::uint64_t)0xff00000000000000ULL) >> 56) ))
diff --git a/include/treekeyidx.h b/include/treekeyidx.h
index 331b7e83..3aa6c668 100644
--- a/include/treekeyidx.h
+++ b/include/treekeyidx.h
@@ -42,12 +42,12 @@ class SWDLLEXPORT TreeKeyIdx : public TreeKey {
TreeNode();
~TreeNode();
void clear();
- __s32 offset;
- __s32 parent;
- __s32 next;
- __s32 firstChild;
+ std::int32_t offset;
+ std::int32_t parent;
+ std::int32_t next;
+ std::int32_t firstChild;
char *name;
- __u16 dsize;
+ std::uint16_t dsize;
char *userData;
} currentNode;
diff --git a/include/utilstr.h b/include/utilstr.h
index a20706ed..aeec6db3 100644
--- a/include/utilstr.h
+++ b/include/utilstr.h
@@ -86,8 +86,8 @@ extern const unsigned char SW_toupper_array[256];
* unicode codepoint value (0 with buf incremented is invalid UTF8 byte
*/
-inline __u32 getUniCharFromUTF8(const unsigned char **buf, bool skipValidation = false) {
- __u32 ch = 0;
+inline std::uint32_t getUniCharFromUTF8(const unsigned char **buf, bool skipValidation = false) {
+ std::uint32_t ch = 0;
//case: We're at the end
if (!(**buf)) {
@@ -163,7 +163,7 @@ inline __u32 getUniCharFromUTF8(const unsigned char **buf, bool skipValidation =
* to work with
*/
-inline SWBuf *getUTF8FromUniChar(__u32 uchar, SWBuf *appendTo) {
+inline SWBuf *getUTF8FromUniChar(std::uint32_t uchar, SWBuf *appendTo) {
unsigned long base = appendTo->size();
// This would be out of Unicode bounds
diff --git a/include/xzcomprs.h b/include/xzcomprs.h
index f3fe42b2..1483240a 100644
--- a/include/xzcomprs.h
+++ b/include/xzcomprs.h
@@ -42,7 +42,7 @@ public:
virtual void Decode(void);
virtual void setLevel(int l);
private:
- __u64 memlimit; // memory usage limit during decompression
+ std::uint64_t memlimit; // memory usage limit during decompression
};
SWORD_NAMESPACE_END
diff --git a/src/keys/treekeyidx.cpp b/src/keys/treekeyidx.cpp
index c4716868..915873b6 100644
--- a/src/keys/treekeyidx.cpp
+++ b/src/keys/treekeyidx.cpp
@@ -177,7 +177,7 @@ bool TreeKeyIdx::nextSibling() {
bool TreeKeyIdx::previousSibling() {
TreeNode iterator;
- __s32 target = currentNode.offset;
+ std::int32_t target = currentNode.offset;
if (currentNode.parent > -1) {
getTreeNodeFromIdxOffset(currentNode.parent, &iterator);
getTreeNodeFromIdxOffset(iterator.firstChild, &iterator);
@@ -207,10 +207,10 @@ void TreeKeyIdx::append() {
while (lastSib.next > -1) {
getTreeNodeFromIdxOffset(lastSib.next, &lastSib);
}
- __u32 idxOffset = (__u32)idxfd->seek(0, SEEK_END);
+ std::uint32_t idxOffset = (std::uint32_t)idxfd->seek(0, SEEK_END);
lastSib.next = idxOffset;
saveTreeNodeOffsets(&lastSib);
- __u32 parent = currentNode.parent;
+ std::uint32_t parent = currentNode.parent;
currentNode.clear();
currentNode.offset = idxOffset;
currentNode.parent = parent;
@@ -224,10 +224,10 @@ void TreeKeyIdx::appendChild() {
append();
}
else {
- __u32 idxOffset = (__u32)idxfd->seek(0, SEEK_END);
+ std::uint32_t idxOffset = (std::uint32_t)idxfd->seek(0, SEEK_END);
currentNode.firstChild = idxOffset;
saveTreeNodeOffsets(&currentNode);
- __u32 parent = currentNode.offset;
+ std::uint32_t parent = currentNode.offset;
currentNode.clear();
currentNode.offset = idxOffset;
currentNode.parent = parent;
@@ -257,7 +257,7 @@ void TreeKeyIdx::remove() {
}
if (!done) {
TreeNode iterator;
- __s32 target = currentNode.offset;
+ std::int32_t target = currentNode.offset;
if (currentNode.parent > -1) {
getTreeNodeFromIdxOffset(currentNode.parent, &iterator);
getTreeNodeFromIdxOffset(iterator.firstChild, &iterator);
@@ -331,8 +331,8 @@ signed char TreeKeyIdx::create(const char *ipath) {
void TreeKeyIdx::getTreeNodeFromDatOffset(long ioffset, TreeNode *node) const {
unsnappedKeyText = "";
char ch;
- __s32 tmp;
- __u16 tmp2;
+ std::int32_t tmp;
+ std::uint16_t tmp2;
if (datfd && datfd->getFd() >= 0) {
@@ -379,7 +379,7 @@ void TreeKeyIdx::getTreeNodeFromDatOffset(long ioffset, TreeNode *node) const {
char TreeKeyIdx::getTreeNodeFromIdxOffset(long ioffset, TreeNode *node) const {
unsnappedKeyText = "";
- __u32 offset;
+ std::uint32_t offset;
char error = KEYERR_OUTOFBOUNDS;
if (ioffset < 0) {
@@ -387,7 +387,7 @@ char TreeKeyIdx::getTreeNodeFromIdxOffset(long ioffset, TreeNode *node) const {
error = 77; // out of bounds but still position to 0;
}
- node->offset = (__s32)ioffset;
+ node->offset = (std::int32_t)ioffset;
if (idxfd && idxfd->getFd() >= 0) {
idxfd->seek(ioffset, SEEK_SET);
if (idxfd->read(&offset, 4) == 4) {
@@ -421,13 +421,13 @@ void TreeKeyIdx::setOffset(unsigned long offset) {
void TreeKeyIdx::saveTreeNodeOffsets(TreeNode *node) {
unsnappedKeyText = "";
long datOffset = 0;
- __s32 tmp;
+ std::int32_t tmp;
if (idxfd && idxfd->getFd() >= 0) {
idxfd->seek(node->offset, SEEK_SET);
if (idxfd->read(&tmp, 4) != 4) {
datOffset = datfd->seek(0, SEEK_END);
- tmp = (__s32)archtosword32(datOffset);
+ tmp = (std::int32_t)archtosword32(datOffset);
idxfd->write(&tmp, 4);
}
else {
@@ -435,13 +435,13 @@ void TreeKeyIdx::saveTreeNodeOffsets(TreeNode *node) {
datfd->seek(datOffset, SEEK_SET);
}
- tmp = (__s32)archtosword32(node->parent);
+ tmp = (std::int32_t)archtosword32(node->parent);
datfd->write(&tmp, 4);
- tmp = (__s32)archtosword32(node->next);
+ tmp = (std::int32_t)archtosword32(node->next);
datfd->write(&tmp, 4);
- tmp = (__s32)archtosword32(node->firstChild);
+ tmp = (std::int32_t)archtosword32(node->firstChild);
datfd->write(&tmp, 4);
}
}
@@ -488,12 +488,12 @@ void TreeKeyIdx::copyFrom(const TreeKeyIdx &ikey) {
void TreeKeyIdx::saveTreeNode(TreeNode *node) {
long datOffset = 0;
- __s32 tmp;
+ std::int32_t tmp;
if (idxfd && idxfd->getFd() >= 0) {
idxfd->seek(node->offset, SEEK_SET);
datOffset = datfd->seek(0, SEEK_END);
- tmp = (__s32)archtosword32(datOffset);
+ tmp = (std::int32_t)archtosword32(datOffset);
idxfd->write(&tmp, 4);
saveTreeNodeOffsets(node);
@@ -502,7 +502,7 @@ void TreeKeyIdx::saveTreeNode(TreeNode *node) {
char null = 0;
datfd->write(&null, 1);
- __u16 tmp2 = archtosword16(node->dsize);
+ std::uint16_t tmp2 = archtosword16(node->dsize);
datfd->write(&tmp2, 2);
if (node->dsize) {
diff --git a/src/keys/versekey.cpp b/src/keys/versekey.cpp
index bad90fbf..01101634 100644
--- a/src/keys/versekey.cpp
+++ b/src/keys/versekey.cpp
@@ -776,7 +776,7 @@ terminate_range:
lastKey->setPosition(TOP);
tmpListKey << *lastKey;
((VerseKey *)tmpListKey.getElement())->setAutoNormalize(isAutoNormalize());
- tmpListKey.getElement()->userData = (__u64)(bufStart+(buf-iBuf.c_str()));
+ tmpListKey.getElement()->userData = (std::uint64_t)(bufStart+(buf-iBuf.c_str()));
}
else {
if (!dash) { // if last separator was not a dash just add
@@ -790,7 +790,7 @@ terminate_range:
*lastKey = TOP;
tmpListKey << *lastKey;
((VerseKey *)tmpListKey.getElement())->setAutoNormalize(isAutoNormalize());
- tmpListKey.getElement()->userData = (__u64)(bufStart+(buf-iBuf.c_str()));
+ tmpListKey.getElement()->userData = (std::uint64_t)(bufStart+(buf-iBuf.c_str()));
}
else {
bool f = false;
@@ -805,7 +805,7 @@ terminate_range:
*lastKey = TOP;
tmpListKey << *lastKey;
((VerseKey *)tmpListKey.getElement())->setAutoNormalize(isAutoNormalize());
- tmpListKey.getElement()->userData = (__u64)(bufStart+(buf-iBuf.c_str()));
+ tmpListKey.getElement()->userData = (std::uint64_t)(bufStart+(buf-iBuf.c_str()));
}
}
else if (expandRange) {
@@ -818,7 +818,7 @@ terminate_range:
newElement->setUpperBound(*curKey);
*lastKey = *curKey;
*newElement = TOP;
- tmpListKey.getElement()->userData = (__u64)(bufStart+(buf-iBuf.c_str()));
+ tmpListKey.getElement()->userData = (std::uint64_t)(bufStart+(buf-iBuf.c_str()));
}
}
}
@@ -1049,7 +1049,7 @@ terminate_range:
lastKey->setLowerBound(*curKey);
*lastKey = TOP;
tmpListKey << *lastKey;
- tmpListKey.getElement()->userData = (__u64)(bufStart+(buf-iBuf.c_str()));
+ tmpListKey.getElement()->userData = (std::uint64_t)(bufStart+(buf-iBuf.c_str()));
}
else {
if (!dash) { // if last separator was not a dash just add
@@ -1062,7 +1062,7 @@ terminate_range:
lastKey->setUpperBound(*curKey);
*lastKey = TOP;
tmpListKey << *lastKey;
- tmpListKey.getElement()->userData = (__u64)(bufStart+(buf-iBuf.c_str()));
+ tmpListKey.getElement()->userData = (std::uint64_t)(bufStart+(buf-iBuf.c_str()));
}
else {
bool f = false;
@@ -1076,7 +1076,7 @@ terminate_range:
lastKey->setUpperBound(*curKey);
*lastKey = TOP;
tmpListKey << *lastKey;
- tmpListKey.getElement()->userData = (__u64)(bufStart+(buf-iBuf.c_str()));
+ tmpListKey.getElement()->userData = (std::uint64_t)(bufStart+(buf-iBuf.c_str()));
}
}
else if (expandRange) {
@@ -1088,7 +1088,7 @@ terminate_range:
*curKey = MAXVERSE;
newElement->setUpperBound(*curKey);
*newElement = TOP;
- tmpListKey.getElement()->userData = (__u64)(bufStart+(buf-iBuf.c_str()));
+ tmpListKey.getElement()->userData = (std::uint64_t)(bufStart+(buf-iBuf.c_str()));
}
}
}
diff --git a/src/modules/comments/rawfiles/rawfiles.cpp b/src/modules/comments/rawfiles/rawfiles.cpp
index bfd3e1da..d32fb104 100644
--- a/src/modules/comments/rawfiles/rawfiles.cpp
+++ b/src/modules/comments/rawfiles/rawfiles.cpp
@@ -187,7 +187,7 @@ void RawFiles::deleteEntry() {
const char *RawFiles::getNextFilename() {
static SWBuf incfile;
- __u32 number = 0;
+ std::uint32_t number = 0;
FileDesc *datafile;
incfile.setFormatted("%s/incfile", path);
@@ -213,7 +213,7 @@ const char *RawFiles::getNextFilename() {
char RawFiles::createModule(const char *path) {
char *incfile = new char [ strlen (path) + 16 ];
- __u32 zero = 0;
+ std::uint32_t zero = 0;
zero = archtosword32(zero);
FileDesc *datafile;
diff --git a/src/modules/common/entriesblk.cpp b/src/modules/common/entriesblk.cpp
index c2c02e41..d1383711 100644
--- a/src/modules/common/entriesblk.cpp
+++ b/src/modules/common/entriesblk.cpp
@@ -37,13 +37,13 @@ EntriesBlock::EntriesBlock(const char *iBlock, unsigned long size) {
memcpy(block, iBlock, size);
}
else {
- block = (char *)calloc(1, sizeof(__u32));
+ block = (char *)calloc(1, sizeof(std::uint32_t));
}
}
EntriesBlock::EntriesBlock() {
- block = (char *)calloc(1, sizeof(__u32));
+ block = (char *)calloc(1, sizeof(std::uint32_t));
}
@@ -53,22 +53,22 @@ EntriesBlock::~EntriesBlock() {
void EntriesBlock::setCount(int count) {
- __u32 rawCount = archtosword32(count);
- memcpy(block, &rawCount, sizeof(__u32));
+ std::uint32_t rawCount = archtosword32(count);
+ memcpy(block, &rawCount, sizeof(std::uint32_t));
}
int EntriesBlock::getCount() {
- __u32 count = 0;
- memcpy(&count, block, sizeof(__u32));
+ std::uint32_t count = 0;
+ memcpy(&count, block, sizeof(std::uint32_t));
count = swordtoarch32(count);
return count;
}
void EntriesBlock::getMetaEntry(int index, unsigned long *offset, unsigned long *size) {
- __u32 rawOffset = 0;
- __u32 rawSize = 0;
+ std::uint32_t rawOffset = 0;
+ std::uint32_t rawSize = 0;
*offset = 0;
*size = 0;
if (index >= getCount()) // assert index < count
@@ -84,8 +84,8 @@ void EntriesBlock::getMetaEntry(int index, unsigned long *offset, unsigned long
void EntriesBlock::setMetaEntry(int index, unsigned long offset, unsigned long size) {
- __u32 rawOffset = (__u32)archtosword32(offset);
- __u32 rawSize = (__u32)archtosword32(size);
+ std::uint32_t rawOffset = (std::uint32_t)archtosword32(offset);
+ std::uint32_t rawSize = (std::uint32_t)archtosword32(size);
if (index >= getCount()) // assert index < count
return;
diff --git a/src/modules/common/rawstr.cpp b/src/modules/common/rawstr.cpp
index 0541b5c3..4bec07c5 100644
--- a/src/modules/common/rawstr.cpp
+++ b/src/modules/common/rawstr.cpp
@@ -145,7 +145,7 @@ void RawStr::getIDXBufDat(long ioffset, char **buf) const
void RawStr::getIDXBuf(long ioffset, char **buf) const
{
- __u32 offset;
+ std::uint32_t offset;
if (idxfd && idxfd->getFd() >= 0) {
idxfd->seek(ioffset, SEEK_SET);
@@ -170,7 +170,7 @@ void RawStr::getIDXBuf(long ioffset, char **buf) const
* RET: error status -1 general error; -2 new file
*/
-signed char RawStr::findOffset(const char *ikey, __u32 *start, __u16 *size, long away, __u32 *idxoff) const
+signed char RawStr::findOffset(const char *ikey, std::uint32_t *start, std::uint16_t *size, long away, std::uint32_t *idxoff) const
{
char *trybuf, *maxbuf, *key = 0, quitflag = 0;
signed char retval = -1;
@@ -239,13 +239,13 @@ signed char RawStr::findOffset(const char *ikey, __u32 *start, __u16 *size, long
idxfd->seek(tryoff, SEEK_SET);
- __u32 tmpStart;
- __u16 tmpSize;
+ std::uint32_t tmpStart;
+ std::uint16_t tmpSize;
*start = *size = tmpStart = tmpSize = 0;
idxfd->read(&tmpStart, 4);
idxfd->read(&tmpSize, 2);
if (idxoff)
- *idxoff = (__u32)tryoff;
+ *idxoff = (std::uint32_t)tryoff;
*start = swordtoarch32(tmpStart);
*size = swordtoarch16(tmpSize);
@@ -264,17 +264,17 @@ signed char RawStr::findOffset(const char *ikey, __u32 *start, __u16 *size, long
if (bad) {
if(!awayFromSubstrCheck)
retval = -1;
- *start = (__u32)laststart;
+ *start = (std::uint32_t)laststart;
*size = lastsize;
tryoff = lasttry;
if (idxoff)
- *idxoff = (__u32)tryoff;
+ *idxoff = (std::uint32_t)tryoff;
break;
}
idxfd->read(&tmpStart, 4);
idxfd->read(&tmpSize, 2);
if (idxoff)
- *idxoff = (__u32)tryoff;
+ *idxoff = (std::uint32_t)tryoff;
*start = swordtoarch32(tmpStart);
*size = swordtoarch16(tmpSize);
@@ -306,12 +306,12 @@ signed char RawStr::findOffset(const char *ikey, __u32 *start, __u16 *size, long
*
*/
-void RawStr::readText(__u32 istart, __u16 *isize, char **idxbuf, SWBuf &buf) const
+void RawStr::readText(std::uint32_t istart, std::uint16_t *isize, char **idxbuf, SWBuf &buf) const
{
unsigned int ch;
char *idxbuflocal = 0;
getIDXBufDat(istart, &idxbuflocal);
- __u32 start = istart;
+ std::uint32_t start = istart;
do {
if (*idxbuf)
@@ -368,12 +368,12 @@ void RawStr::readText(__u32 istart, __u16 *isize, char **idxbuf, SWBuf &buf) con
void RawStr::doSetText(const char *ikey, const char *buf, long len)
{
- __u32 start, outstart;
- __u32 idxoff;
- __u32 endoff;
- __s32 shiftSize;
- __u16 size;
- __u16 outsize;
+ std::uint32_t start, outstart;
+ std::uint32_t idxoff;
+ std::uint32_t endoff;
+ std::int32_t shiftSize;
+ std::uint16_t size;
+ std::uint16_t outsize;
char *tmpbuf = 0;
char *key = 0;
char *dbKey = 0;
@@ -426,7 +426,7 @@ void RawStr::doSetText(const char *ikey, const char *buf, long len)
while (true); // while we're resolving links
}
- endoff = (__u32)idxfd->seek(0, SEEK_END);
+ endoff = (std::uint32_t)idxfd->seek(0, SEEK_END);
shiftSize = endoff - idxoff;
@@ -442,7 +442,7 @@ void RawStr::doSetText(const char *ikey, const char *buf, long len)
memcpy(outbuf + size, buf, len);
size = outsize = size + (len);
- start = outstart = (__u32)datfd->seek(0, SEEK_END);
+ start = outstart = (std::uint32_t)datfd->seek(0, SEEK_END);
outstart = archtosword32(start);
outsize = archtosword16(size);
diff --git a/src/modules/common/rawstr4.cpp b/src/modules/common/rawstr4.cpp
index 2d49b3d7..bf249516 100644
--- a/src/modules/common/rawstr4.cpp
+++ b/src/modules/common/rawstr4.cpp
@@ -145,7 +145,7 @@ void RawStr4::getIDXBufDat(long ioffset, char **buf) const
void RawStr4::getIDXBuf(long ioffset, char **buf) const
{
- __u32 offset;
+ std::uint32_t offset;
if ((unsigned long)idxfd > 0) {
idxfd->seek(ioffset, SEEK_SET);
@@ -179,7 +179,7 @@ void RawStr4::getIDXBuf(long ioffset, char **buf) const
* RET: error status -1 general error; -2 new file
*/
-signed char RawStr4::findOffset(const char *ikey, __u32 *start, __u32 *size, long away, __u32 *idxoff) const
+signed char RawStr4::findOffset(const char *ikey, std::uint32_t *start, std::uint32_t *size, long away, std::uint32_t *idxoff) const
{
char *trybuf, *maxbuf, *key = 0, quitflag = 0;
signed char retval = -1;
@@ -249,12 +249,12 @@ signed char RawStr4::findOffset(const char *ikey, __u32 *start, __u32 *size, lon
idxfd->seek(tryoff, SEEK_SET);
- __u32 tmpStart, tmpSize;
+ std::uint32_t tmpStart, tmpSize;
*start = *size = tmpStart = tmpSize = 0;
idxfd->read(&tmpStart, 4);
idxfd->read(&tmpSize, 4);
if (idxoff)
- *idxoff = (__u32)tryoff;
+ *idxoff = (std::uint32_t)tryoff;
*start = swordtoarch32(tmpStart);
*size = swordtoarch32(tmpSize);
@@ -273,17 +273,17 @@ signed char RawStr4::findOffset(const char *ikey, __u32 *start, __u32 *size, lon
if (bad) {
if(!awayFromSubstrCheck)
retval = -1;
- *start = (__u32)laststart;
- *size = (__u32)lastsize;
+ *start = (std::uint32_t)laststart;
+ *size = (std::uint32_t)lastsize;
tryoff = lasttry;
if (idxoff)
- *idxoff = (__u32)tryoff;
+ *idxoff = (std::uint32_t)tryoff;
break;
}
idxfd->read(&tmpStart, 4);
idxfd->read(&tmpSize, 4);
if (idxoff)
- *idxoff = (__u32)tryoff;
+ *idxoff = (std::uint32_t)tryoff;
*start = swordtoarch32(tmpStart);
*size = swordtoarch32(tmpSize);
@@ -315,12 +315,12 @@ signed char RawStr4::findOffset(const char *ikey, __u32 *start, __u32 *size, lon
*
*/
-void RawStr4::readText(__u32 istart, __u32 *isize, char **idxbuf, SWBuf &buf) const
+void RawStr4::readText(std::uint32_t istart, std::uint32_t *isize, char **idxbuf, SWBuf &buf) const
{
unsigned int ch;
char *idxbuflocal = 0;
getIDXBufDat(istart, &idxbuflocal);
- __u32 start = istart;
+ std::uint32_t start = istart;
do {
if (*idxbuf)
@@ -376,12 +376,12 @@ void RawStr4::readText(__u32 istart, __u32 *isize, char **idxbuf, SWBuf &buf) co
void RawStr4::doSetText(const char *ikey, const char *buf, long len) {
- __u32 start, outstart;
- __u32 idxoff;
- __u32 endoff;
- __s32 shiftSize;
- __u32 size;
- __u32 outsize;
+ std::uint32_t start, outstart;
+ std::uint32_t idxoff;
+ std::uint32_t endoff;
+ std::int32_t shiftSize;
+ std::uint32_t size;
+ std::uint32_t outsize;
char *tmpbuf = 0;
char *key = 0;
char *dbKey = 0;
@@ -434,7 +434,7 @@ void RawStr4::doSetText(const char *ikey, const char *buf, long len) {
while (true); // while we're resolving links
}
- endoff = (__u32)idxfd->seek(0, SEEK_END);
+ endoff = (std::uint32_t)idxfd->seek(0, SEEK_END);
shiftSize = endoff - idxoff;
@@ -448,9 +448,9 @@ void RawStr4::doSetText(const char *ikey, const char *buf, long len) {
sprintf(outbuf, "%s%c%c", key, 13, 10);
size = strlen(outbuf);
memcpy(outbuf + size, buf, len);
- size = outsize = size + (__u32)len;
+ size = outsize = size + (std::uint32_t)len;
- start = outstart = (__u32)datfd->seek(0, SEEK_END);
+ start = outstart = (std::uint32_t)datfd->seek(0, SEEK_END);
outstart = archtosword32(start);
outsize = archtosword32(size);
diff --git a/src/modules/common/rawverse.cpp b/src/modules/common/rawverse.cpp
index 3e79b88d..39560a3b 100644
--- a/src/modules/common/rawverse.cpp
+++ b/src/modules/common/rawverse.cpp
@@ -122,8 +122,8 @@ void RawVerse::findOffset(char testmt, long idxoff, long *start, unsigned short
if (idxfp[testmt-1]->getFd() >= 0) {
idxfp[testmt-1]->seek(idxoff, SEEK_SET);
- __s32 tmpStart;
- __u16 tmpSize;
+ std::int32_t tmpStart;
+ std::uint16_t tmpSize;
idxfp[testmt-1]->read(&tmpStart, 4);
long len = idxfp[testmt-1]->read(&tmpSize, 2); // read size
@@ -177,8 +177,8 @@ void RawVerse::readText(char testmt, long start, unsigned short size, SWBuf &buf
void RawVerse::doSetText(char testmt, long idxoff, const char *buf, long len)
{
- __s32 start;
- __u16 size;
+ std::int32_t start;
+ std::uint16_t size;
idxoff *= 6;
if (!testmt)
@@ -186,7 +186,7 @@ void RawVerse::doSetText(char testmt, long idxoff, const char *buf, long len)
size = (len < 0) ? strlen(buf) : len;
- start = (__s32)textfp[testmt-1]->seek(0, SEEK_END);
+ start = (std::int32_t)textfp[testmt-1]->seek(0, SEEK_END);
idxfp[testmt-1]->seek(idxoff, SEEK_SET);
if (size) {
@@ -217,8 +217,8 @@ void RawVerse::doSetText(char testmt, long idxoff, const char *buf, long len)
*/
void RawVerse::doLinkEntry(char testmt, long destidxoff, long srcidxoff) {
- __s32 start;
- __u16 size;
+ std::int32_t start;
+ std::uint16_t size;
destidxoff *= 6;
srcidxoff *= 6;
@@ -282,8 +282,8 @@ char RawVerse::createModule(const char *ipath, const char *v11n)
vk.setVersificationSystem(v11n);
vk.setIntros(1);
- __s32 offset = 0;
- __u16 size = 0;
+ std::int32_t offset = 0;
+ std::uint16_t size = 0;
offset = archtosword32(offset);
size = archtosword16(size);
diff --git a/src/modules/common/rawverse4.cpp b/src/modules/common/rawverse4.cpp
index 67a43d8f..35d64f51 100644
--- a/src/modules/common/rawverse4.cpp
+++ b/src/modules/common/rawverse4.cpp
@@ -123,8 +123,8 @@ void RawVerse4::findOffset(char testmt, long idxoff, long *start, unsigned long
if (idxfp[testmt-1]->getFd() >= 0) {
idxfp[testmt-1]->seek(idxoff, SEEK_SET);
- __u32 tmpStart;
- __u32 tmpSize;
+ std::uint32_t tmpStart;
+ std::uint32_t tmpSize;
idxfp[testmt-1]->read(&tmpStart, 4);
long len = idxfp[testmt-1]->read(&tmpSize, 4); // read size
@@ -178,16 +178,16 @@ void RawVerse4::readText(char testmt, long start, unsigned long size, SWBuf &buf
void RawVerse4::doSetText(char testmt, long idxoff, const char *buf, long len)
{
- __u32 start;
- __u32 size;
+ std::uint32_t start;
+ std::uint32_t size;
idxoff *= 8;
if (!testmt)
testmt = ((idxfp[1]) ? 1:2);
- size = (__u32)((len < 0) ? strlen(buf) : len);
+ size = (std::uint32_t)((len < 0) ? strlen(buf) : len);
- start = (__u32)textfp[testmt-1]->seek(0, SEEK_END);
+ start = (std::uint32_t)textfp[testmt-1]->seek(0, SEEK_END);
idxfp[testmt-1]->seek(idxoff, SEEK_SET);
if (size) {
@@ -218,8 +218,8 @@ void RawVerse4::doSetText(char testmt, long idxoff, const char *buf, long len)
*/
void RawVerse4::doLinkEntry(char testmt, long destidxoff, long srcidxoff) {
- __u32 start;
- __u32 size;
+ std::uint32_t start;
+ std::uint32_t size;
destidxoff *= 8;
srcidxoff *= 8;
@@ -282,8 +282,8 @@ char RawVerse4::createModule(const char *ipath, const char *v11n)
VerseKey vk;
vk.setVersificationSystem(v11n);
vk.setIntros(1);
- __u32 offset = 0;
- __u32 size = 0;
+ std::uint32_t offset = 0;
+ std::uint32_t size = 0;
offset = archtosword32(offset);
size = archtosword32(size);
diff --git a/src/modules/common/zstr.cpp b/src/modules/common/zstr.cpp
index 324372da..6bbb6e84 100644
--- a/src/modules/common/zstr.cpp
+++ b/src/modules/common/zstr.cpp
@@ -167,7 +167,7 @@ void zStr::getKeyFromDatOffset(long ioffset, char **buf) const
void zStr::getKeyFromIdxOffset(long ioffset, char **buf) const
{
- __u32 offset;
+ std::uint32_t offset;
if (idxfd && idxfd->getFd() >= 0) {
idxfd->seek(ioffset, SEEK_SET);
@@ -194,13 +194,13 @@ signed char zStr::findKeyIndex(const char *ikey, long *idxoff, long away) const
{
char *maxbuf = 0, *trybuf = 0, *key = 0, quitflag = 0;
signed char retval = 0;
- __s32 headoff, tailoff, tryoff = 0, maxoff = 0;
- __u32 start, size;
+ std::int32_t headoff, tailoff, tryoff = 0, maxoff = 0;
+ std::uint32_t start, size;
int diff = 0;
bool awayFromSubstrCheck = false;
if (idxfd->getFd() >= 0) {
- tailoff = maxoff = (__s32)idxfd->seek(0, SEEK_END) - IDXENTRYSIZE;
+ tailoff = maxoff = (std::int32_t)idxfd->seek(0, SEEK_END) - IDXENTRYSIZE;
if (*ikey) {
headoff = 0;
stdstr(&key, ikey, 3);
@@ -212,7 +212,7 @@ signed char zStr::findKeyIndex(const char *ikey, long *idxoff, long away) const
getKeyFromIdxOffset(maxoff, &maxbuf);
while (headoff < tailoff) {
- tryoff = ((__s32)lastoff == -1) ? headoff + (((((tailoff / IDXENTRYSIZE) - (headoff / IDXENTRYSIZE))) / 2) * IDXENTRYSIZE) : (__s32)lastoff;
+ tryoff = ((std::int32_t)lastoff == -1) ? headoff + (((((tailoff / IDXENTRYSIZE) - (headoff / IDXENTRYSIZE))) / 2) * IDXENTRYSIZE) : (std::int32_t)lastoff;
lastoff = -1;
getKeyFromIdxOffset(tryoff, &trybuf);
@@ -268,9 +268,9 @@ signed char zStr::findKeyIndex(const char *ikey, long *idxoff, long away) const
*idxoff = tryoff;
while (away) {
- __u32 laststart = start;
- __u32 lastsize = size;
- __s32 lasttry = tryoff;
+ std::uint32_t laststart = start;
+ std::uint32_t lastsize = size;
+ std::int32_t lasttry = tryoff;
tryoff += (away > 0) ? IDXENTRYSIZE : -IDXENTRYSIZE;
bool bad = false;
@@ -328,8 +328,8 @@ void zStr::getText(long offset, char **idxbuf, char **buf) const {
char *ch;
char *idxbuflocal = 0;
getKeyFromIdxOffset(offset, &idxbuflocal);
- __u32 start;
- __u32 size;
+ std::uint32_t start;
+ std::uint32_t size;
do {
idxfd->seek(offset, SEEK_SET);
@@ -368,16 +368,16 @@ void zStr::getText(long offset, char **idxbuf, char **buf) const {
while (true); // while we're resolving links
if (idxbuflocal) {
- __u32 localsize = (__u32)strlen(idxbuflocal);
+ std::uint32_t localsize = (std::uint32_t)strlen(idxbuflocal);
localsize = (localsize < (size - 1)) ? localsize : (size - 1);
strncpy(*idxbuf, idxbuflocal, localsize);
(*idxbuf)[localsize] = 0;
free(idxbuflocal);
}
- __u32 block = 0;
- __u32 entry = 0;
- memmove(&block, *buf, sizeof(__u32));
- memmove(&entry, *buf + sizeof(__u32), sizeof(__u32));
+ std::uint32_t block = 0;
+ std::uint32_t entry = 0;
+ memmove(&block, *buf, sizeof(std::uint32_t));
+ memmove(&entry, *buf + sizeof(std::uint32_t), sizeof(std::uint32_t));
block = swordtoarch32(block);
entry = swordtoarch32(entry);
getCompressedText(block, entry, buf);
@@ -391,10 +391,10 @@ void zStr::getText(long offset, char **idxbuf, char **buf) const {
void zStr::getCompressedText(long block, long entry, char **buf) const {
- __u32 size = 0;
+ std::uint32_t size = 0;
if (cacheBlockIndex != block) {
- __u32 start = 0;
+ std::uint32_t start = 0;
zdxfd->seek(block * ZDXENTRYSIZE, SEEK_SET);
zdxfd->read(&start, 4);
@@ -418,7 +418,7 @@ void zStr::getCompressedText(long block, long entry, char **buf) const {
cacheBlock = new EntriesBlock(rawBuf, len);
cacheBlockIndex = block;
}
- size = (__u32)cacheBlock->getEntrySize(entry);
+ size = (std::uint32_t)cacheBlock->getEntrySize(entry);
*buf = (*buf) ? (char *)realloc(*buf, size*2 + 1) : (char *)malloc(size*2 + 1);
strcpy(*buf, cacheBlock->getEntry(entry));
}
@@ -436,11 +436,11 @@ void zStr::setText(const char *ikey, const char *buf, long len) {
static const char nl[] = {13, 10};
- __u32 start, outstart;
- __u32 size, outsize;
- __s32 endoff;
+ std::uint32_t start, outstart;
+ std::uint32_t size, outsize;
+ std::int32_t endoff;
long idxoff = 0;
- __s32 shiftSize;
+ std::int32_t shiftSize;
char *tmpbuf = 0;
char *key = 0;
char *dbKey = 0;
@@ -499,9 +499,9 @@ void zStr::setText(const char *ikey, const char *buf, long len) {
}
}
- endoff = (__s32)idxfd->seek(0, SEEK_END);
+ endoff = (std::int32_t)idxfd->seek(0, SEEK_END);
- shiftSize = endoff - (__s32)idxoff;
+ shiftSize = endoff - (std::int32_t)idxoff;
if (shiftSize > 0) {
idxBytes = new char [ shiftSize ];
@@ -511,7 +511,7 @@ void zStr::setText(const char *ikey, const char *buf, long len) {
outbuf = new char [ len + strlen(key) + 5 ];
sprintf(outbuf, "%s%c%c", key, 13, 10);
- size = (__u32)strlen(outbuf);
+ size = (std::uint32_t)strlen(outbuf);
if (len > 0) { // NOT a link
if (!cacheBlock) {
flushCache();
@@ -523,20 +523,20 @@ void zStr::setText(const char *ikey, const char *buf, long len) {
cacheBlock = new EntriesBlock();
cacheBlockIndex = (zdxfd->seek(0, SEEK_END) / ZDXENTRYSIZE);
}
- __u32 entry = cacheBlock->addEntry(buf);
+ std::uint32_t entry = cacheBlock->addEntry(buf);
cacheDirty = true;
- outstart = (__u32)archtosword32(cacheBlockIndex);
+ outstart = (std::uint32_t)archtosword32(cacheBlockIndex);
outsize = archtosword32(entry);
- memcpy (outbuf + size, &outstart, sizeof(__u32));
- memcpy (outbuf + size + sizeof(__u32), &outsize, sizeof(__u32));
- size += (sizeof(__u32) * 2);
+ memcpy (outbuf + size, &outstart, sizeof(std::uint32_t));
+ memcpy (outbuf + size + sizeof(std::uint32_t), &outsize, sizeof(std::uint32_t));
+ size += (sizeof(std::uint32_t) * 2);
}
else { // link
memcpy(outbuf + size, buf, len);
size += len;
}
- start = (__u32)datfd->seek(0, SEEK_END);
+ start = (std::uint32_t)datfd->seek(0, SEEK_END);
outstart = archtosword32(start);
outsize = archtosword32(size);
@@ -593,9 +593,9 @@ void zStr::flushCache() const {
if (cacheBlock) {
if (cacheDirty) {
- __u32 start = 0;
+ std::uint32_t start = 0;
unsigned long size = 0;
- __u32 outstart = 0, outsize = 0;
+ std::uint32_t outstart = 0, outsize = 0;
const char *rawBuf = cacheBlock->getRawData(&size);
compressor->Buf(rawBuf, &size);
@@ -611,7 +611,7 @@ void zStr::flushCache() const {
unsigned long zdtSize = zdtfd->seek(0, SEEK_END);
if ((cacheBlockIndex * ZDXENTRYSIZE) > (zdxSize - ZDXENTRYSIZE)) { // New Block
- start = (__u32)zdtSize;
+ start = (std::uint32_t)zdtSize;
}
else {
zdxfd->seek(cacheBlockIndex * ZDXENTRYSIZE, SEEK_SET);
@@ -626,14 +626,14 @@ void zStr::flushCache() const {
size = outsize;
}
else { // middle and bigger-- we have serious problems, for now let's put it at the end = lots of wasted space
- start = (__u32)zdtSize;
+ start = (std::uint32_t)zdtSize;
}
}
outstart = archtosword32(start);
- outsize = archtosword32((__u32)size);
+ outsize = archtosword32((std::uint32_t)size);
zdxfd->seek(cacheBlockIndex * ZDXENTRYSIZE, SEEK_SET);
zdtfd->seek(start, SEEK_SET);
diff --git a/src/modules/common/zverse.cpp b/src/modules/common/zverse.cpp
index d54c67d9..6ccd9111 100644
--- a/src/modules/common/zverse.cpp
+++ b/src/modules/common/zverse.cpp
@@ -149,9 +149,9 @@ zVerse::~zVerse()
void zVerse::findOffset(char testmt, long idxoff, long *start, unsigned short *size, unsigned long *buffnum) const
{
- __u32 ulBuffNum = 0; // buffer number
- __u32 ulVerseStart = 0; // verse offset within buffer
- __u16 usVerseSize = 0; // verse size
+ std::uint32_t ulBuffNum = 0; // buffer number
+ std::uint32_t ulVerseStart = 0; // verse offset within buffer
+ std::uint16_t usVerseSize = 0; // verse size
// set start to offset in
// set size to
// set
@@ -204,9 +204,9 @@ void zVerse::findOffset(char testmt, long idxoff, long *start, unsigned short *s
*/
void zVerse::zReadText(char testmt, long start, unsigned short size, unsigned long ulBuffNum, SWBuf &inBuf) const {
- __u32 ulCompOffset = 0; // compressed buffer start
- __u32 ulCompSize = 0; // buffer size compressed
- __u32 ulUnCompSize = 0; // buffer size uncompressed
+ std::uint32_t ulCompOffset = 0; // compressed buffer start
+ std::uint32_t ulCompSize = 0; // buffer size compressed
+ std::uint32_t ulUnCompSize = 0; // buffer size uncompressed
if (!testmt) {
testmt = ((idxfp[0]) ? 1:2);
@@ -312,14 +312,14 @@ void zVerse::doSetText(char testmt, long idxoff, const char *buf, long len) {
dirtyCache = true;
- __u32 start;
- __u16 size;
- __u32 outBufIdx = (__u32)cacheBufIdx;
+ std::uint32_t start;
+ std::uint16_t size;
+ std::uint32_t outBufIdx = (std::uint32_t)cacheBufIdx;
idxoff *= 10;
size = len;
- start = (__u32)strlen(cacheBuf);
+ start = (std::uint32_t)strlen(cacheBuf);
if (!size)
start = outBufIdx = 0;
@@ -338,14 +338,14 @@ void zVerse::doSetText(char testmt, long idxoff, const char *buf, long len) {
void zVerse::flushCache() const {
if (dirtyCache) {
- __u32 idxoff;
- __u32 start, outstart;
- __u32 size, outsize;
- __u32 zsize, outzsize;
+ std::uint32_t idxoff;
+ std::uint32_t start, outstart;
+ std::uint32_t size, outsize;
+ std::uint32_t zsize, outzsize;
- idxoff = (__u32)cacheBufIdx * 12;
+ idxoff = (std::uint32_t)cacheBufIdx * 12;
if (cacheBuf) {
- size = outsize = zsize = outzsize = (__u32)strlen(cacheBuf);
+ size = outsize = zsize = outzsize = (std::uint32_t)strlen(cacheBuf);
if (size) {
// if (compressor) {
// delete compressor;
@@ -354,16 +354,16 @@ void zVerse::flushCache() const {
compressor->Buf(cacheBuf);
unsigned long tmpSize;
compressor->zBuf(&tmpSize);
- outzsize = zsize = (__u32)tmpSize;
+ outzsize = zsize = (std::uint32_t)tmpSize;
SWBuf buf;
buf.setSize(zsize + 5);
memcpy(buf.getRawData(), compressor->zBuf(&tmpSize), tmpSize);
- outzsize = zsize = (__u32)tmpSize;
+ outzsize = zsize = (std::uint32_t)tmpSize;
buf.setSize(zsize);
rawZFilter(buf, 1); // 1 = encipher
- start = outstart = (__u32)textfp[cacheTestament-1]->seek(0, SEEK_END);
+ start = outstart = (std::uint32_t)textfp[cacheTestament-1]->seek(0, SEEK_END);
outstart = archtosword32(start);
outsize = archtosword32(size);
@@ -392,9 +392,9 @@ void zVerse::flushCache() const {
*/
void zVerse::doLinkEntry(char testmt, long destidxoff, long srcidxoff) {
- __s32 bufidx;
- __s32 start;
- __u16 size;
+ std::int32_t bufidx;
+ std::int32_t start;
+ std::uint16_t size;
destidxoff *= 10;
srcidxoff *= 10;
@@ -429,8 +429,8 @@ char zVerse::createModule(const char *ipath, int blockBound, const char *v11n)
char *buf = new char [ strlen (ipath) + 20 ];
char retVal = 0;
FileDesc *fd, *fd2;
- __s32 offset = 0;
- __s16 size = 0;
+ std::int32_t offset = 0;
+ std::int16_t size = 0;
VerseKey vk;
stdstr(&path, ipath);
diff --git a/src/modules/common/zverse4.cpp b/src/modules/common/zverse4.cpp
index c5f7d79b..8496416e 100644
--- a/src/modules/common/zverse4.cpp
+++ b/src/modules/common/zverse4.cpp
@@ -147,9 +147,9 @@ zVerse4::~zVerse4()
void zVerse4::findOffset(char testmt, long idxoff, long *start, unsigned long *size, unsigned long *buffnum) const
{
- __u32 ulBuffNum = 0; // buffer number
- __u32 ulVerseStart = 0; // verse offset within buffer
- __u32 usVerseSize = 0; // verse size
+ std::uint32_t ulBuffNum = 0; // buffer number
+ std::uint32_t ulVerseStart = 0; // verse offset within buffer
+ std::uint32_t usVerseSize = 0; // verse size
// set start to offset in
// set size to
// set
@@ -202,9 +202,9 @@ void zVerse4::findOffset(char testmt, long idxoff, long *start, unsigned long *s
*/
void zVerse4::zReadText(char testmt, long start, unsigned long size, unsigned long ulBuffNum, SWBuf &inBuf) const {
- __u32 ulCompOffset = 0; // compressed buffer start
- __u32 ulCompSize = 0; // buffer size compressed
- __u32 ulUnCompSize = 0; // buffer size uncompressed
+ std::uint32_t ulCompOffset = 0; // compressed buffer start
+ std::uint32_t ulCompSize = 0; // buffer size compressed
+ std::uint32_t ulUnCompSize = 0; // buffer size uncompressed
if (!testmt) {
testmt = ((idxfp[0]) ? 1:2);
@@ -310,14 +310,14 @@ void zVerse4::doSetText(char testmt, long idxoff, const char *buf, long len) {
dirtyCache = true;
- __u32 start;
- __u32 size;
- __u32 outBufIdx = (__u32)cacheBufIdx;
+ std::uint32_t start;
+ std::uint32_t size;
+ std::uint32_t outBufIdx = (std::uint32_t)cacheBufIdx;
idxoff *= 12;
- size = (__u32)len;
+ size = (std::uint32_t)len;
- start = (__u32)strlen(cacheBuf);
+ start = (std::uint32_t)strlen(cacheBuf);
if (!size)
start = outBufIdx = 0;
@@ -336,28 +336,28 @@ void zVerse4::doSetText(char testmt, long idxoff, const char *buf, long len) {
void zVerse4::flushCache() const {
if (dirtyCache) {
- __u32 idxoff;
- __u32 start, outstart;
- __u32 size, outsize;
- __u32 zsize, outzsize;
+ std::uint32_t idxoff;
+ std::uint32_t start, outstart;
+ std::uint32_t size, outsize;
+ std::uint32_t zsize, outzsize;
- idxoff = (__u32)cacheBufIdx * 12;
+ idxoff = (std::uint32_t)cacheBufIdx * 12;
if (cacheBuf) {
- size = outsize = zsize = outzsize = (__u32)strlen(cacheBuf);
+ size = outsize = zsize = outzsize = (std::uint32_t)strlen(cacheBuf);
if (size) {
compressor->Buf(cacheBuf);
unsigned long tmpSize;
compressor->zBuf(&tmpSize);
- outzsize = zsize = (__u32)tmpSize;
+ outzsize = zsize = (std::uint32_t)tmpSize;
SWBuf buf;
buf.setSize(zsize + 5);
memcpy(buf.getRawData(), compressor->zBuf(&tmpSize), tmpSize);
- outzsize = zsize = (__u32)tmpSize;
+ outzsize = zsize = (std::uint32_t)tmpSize;
buf.setSize(zsize);
rawZFilter(buf, 1); // 1 = encipher
- start = outstart = (__u32)textfp[cacheTestament-1]->seek(0, SEEK_END);
+ start = outstart = (std::uint32_t)textfp[cacheTestament-1]->seek(0, SEEK_END);
outstart = archtosword32(start);
outsize = archtosword32(size);
@@ -386,9 +386,9 @@ void zVerse4::flushCache() const {
*/
void zVerse4::doLinkEntry(char testmt, long destidxoff, long srcidxoff) {
- __s32 bufidx;
- __s32 start;
- __u32 size;
+ std::int32_t bufidx;
+ std::int32_t start;
+ std::uint32_t size;
destidxoff *= 12;
srcidxoff *= 12;
@@ -423,8 +423,8 @@ char zVerse4::createModule(const char *ipath, int blockBound, const char *v11n)
char *buf = new char [ strlen (ipath) + 20 ];
char retVal = 0;
FileDesc *fd, *fd2;
- __s32 offset = 0;
- __s32 size = 0;
+ std::int32_t offset = 0;
+ std::int32_t size = 0;
VerseKey vk;
stdstr(&path, ipath);
diff --git a/src/modules/filters/rtfhtml.cpp b/src/modules/filters/rtfhtml.cpp
index c2cf73e0..c92c46e3 100644
--- a/src/modules/filters/rtfhtml.cpp
+++ b/src/modules/filters/rtfhtml.cpp
@@ -53,8 +53,8 @@ char RTFHTML::processText(SWBuf &text, const SWKey *key, const SWModule *module)
while (isdigit(*++end));
SWBuf num;
num.append(from, end-from);
- __s16 n = atoi(num.c_str());
- __u32 u = (__u16)n;
+ std::int16_t n = atoi(num.c_str());
+ std::uint32_t u = (std::uint16_t)n;
getUTF8FromUniChar(u, &text);
from += (end-from);
continue;
diff --git a/src/modules/filters/utf8greekaccents.cpp b/src/modules/filters/utf8greekaccents.cpp
index 15e885f4..9387ada0 100644
--- a/src/modules/filters/utf8greekaccents.cpp
+++ b/src/modules/filters/utf8greekaccents.cpp
@@ -48,7 +48,7 @@ namespace {
return &oVals;
}
- std::map<__u32, SWBuf> converters;
+ std::map<std::uint32_t, SWBuf> converters;
class converters_init {
public:
converters_init() {
@@ -354,9 +354,9 @@ char UTF8GreekAccents::processText(SWBuf &text, const SWKey *key, const SWModule
SWBuf orig = text;
const unsigned char* from = (unsigned char*)orig.c_str();
text = "";
- map<__u32, SWBuf>::const_iterator it = converters.end();
+ map<std::uint32_t, SWBuf>::const_iterator it = converters.end();
while (*from) {
- __u32 ch = getUniCharFromUTF8(&from, true);
+ std::uint32_t ch = getUniCharFromUTF8(&from, true);
// if ch is bad, then convert to replacement char
if (!ch) ch = 0xFFFD;
diff --git a/src/modules/filters/utf8utf16.cpp b/src/modules/filters/utf8utf16.cpp
index 7cbfe596..bdd022da 100644
--- a/src/modules/filters/utf8utf16.cpp
+++ b/src/modules/filters/utf8utf16.cpp
@@ -43,25 +43,25 @@ char UTF8UTF16::processText(SWBuf &text, const SWKey *key, const SWModule *modul
text = "";
while (*from) {
- __u32 ch = getUniCharFromUTF8(&from);
+ std::uint32_t ch = getUniCharFromUTF8(&from);
if (!ch) continue; // invalid char
if (ch < 0x10000) {
text.setSize(text.size()+2);
- *((__u16 *)(text.getRawData()+(text.size()-2))) = (__u16)ch;
+ *((std::uint16_t *)(text.getRawData()+(text.size()-2))) = (std::uint16_t)ch;
}
else {
- __u16 utf16;
- utf16 = (__s16)((ch - 0x10000) / 0x400 + 0xD800);
+ std::uint16_t utf16;
+ utf16 = (std::int16_t)((ch - 0x10000) / 0x400 + 0xD800);
text.setSize(text.size()+4);
- *((__u16 *)(text.getRawData()+(text.size()-4))) = utf16;
- utf16 = (__s16)((ch - 0x10000) % 0x400 + 0xDC00);
- *((__u16 *)(text.getRawData()+(text.size()-2))) = utf16;
+ *((std::uint16_t *)(text.getRawData()+(text.size()-4))) = utf16;
+ utf16 = (std::int16_t)((ch - 0x10000) % 0x400 + 0xDC00);
+ *((std::uint16_t *)(text.getRawData()+(text.size()-2))) = utf16;
}
}
text.setSize(text.size()+2);
- *((__u16 *)(text.getRawData()+(text.size()-2))) = (__u16)0;
+ *((std::uint16_t *)(text.getRawData()+(text.size()-2))) = (std::uint16_t)0;
text.setSize(text.size()-2);
return 0;
diff --git a/src/modules/genbook/rawgenbook/rawgenbook.cpp b/src/modules/genbook/rawgenbook/rawgenbook.cpp
index 4074cf9b..47931dc8 100644
--- a/src/modules/genbook/rawgenbook/rawgenbook.cpp
+++ b/src/modules/genbook/rawgenbook/rawgenbook.cpp
@@ -98,8 +98,8 @@ bool RawGenBook::isWritable() const {
SWBuf &RawGenBook::getRawEntryBuf() const {
- __u32 offset = 0;
- __u32 size = 0;
+ std::uint32_t offset = 0;
+ std::uint32_t size = 0;
const TreeKey &key = getTreeKey();
@@ -133,8 +133,8 @@ SWBuf &RawGenBook::getRawEntryBuf() const {
void RawGenBook::setEntry(const char *inbuf, long len) {
- __u32 offset = (__u32)archtosword32(bdtfd->seek(0, SEEK_END));
- __u32 size = 0;
+ std::uint32_t offset = (std::uint32_t)archtosword32(bdtfd->seek(0, SEEK_END));
+ std::uint32_t size = 0;
TreeKeyIdx *key = ((TreeKeyIdx *)&(getTreeKey()));
char userData[8];
@@ -144,7 +144,7 @@ void RawGenBook::setEntry(const char *inbuf, long len) {
bdtfd->write(inbuf, len);
- size = (__u32)archtosword32(len);
+ size = (std::uint32_t)archtosword32(len);
memcpy(userData, &offset, 4);
memcpy(userData+4, &size, 4);
key->setUserData(userData, 8);
diff --git a/src/modules/lexdict/rawld/rawld.cpp b/src/modules/lexdict/rawld/rawld.cpp
index 2e758599..e1c3f7c3 100644
--- a/src/modules/lexdict/rawld/rawld.cpp
+++ b/src/modules/lexdict/rawld/rawld.cpp
@@ -73,8 +73,8 @@ bool RawLD::isWritable() const {
char RawLD::getEntry(long away) const
{
- __u32 start = 0;
- __u16 size = 0;
+ std::uint32_t start = 0;
+ std::uint16_t size = 0;
char *idxbuf = 0;
char retval = 0;
@@ -195,8 +195,8 @@ long RawLD::getEntryCount() const {
long RawLD::getEntryForKey(const char *key) const {
- __u32 start, offset;
- __u16 size;
+ std::uint32_t start, offset;
+ std::uint16_t size;
char *buf = new char [ strlen(key) + 6 ];
strcpy(buf, key);
diff --git a/src/modules/lexdict/rawld4/rawld4.cpp b/src/modules/lexdict/rawld4/rawld4.cpp
index bfbe0cb5..fdfe8706 100644
--- a/src/modules/lexdict/rawld4/rawld4.cpp
+++ b/src/modules/lexdict/rawld4/rawld4.cpp
@@ -73,8 +73,8 @@ bool RawLD4::isWritable() const {
char RawLD4::getEntry(long away) const
{
- __u32 start = 0;
- __u32 size = 0;
+ std::uint32_t start = 0;
+ std::uint32_t size = 0;
char *idxbuf = 0;
char retval = 0;
@@ -193,8 +193,8 @@ long RawLD4::getEntryCount() const {
long RawLD4::getEntryForKey(const char *key) const {
- __u32 start, offset;
- __u32 size;
+ std::uint32_t start, offset;
+ std::uint32_t size;
char *buf = new char [ strlen(key) + 6 ];
strcpy(buf, key);
diff --git a/src/modules/swmodule.cpp b/src/modules/swmodule.cpp
index 2ae8ca22..50e1a1db 100644
--- a/src/modules/swmodule.cpp
+++ b/src/modules/swmodule.cpp
@@ -543,7 +543,7 @@ ListKey &SWModule::search(const char *istr, int searchType, int flags, SWKey *sc
Xapian::MSetIterator i;
for (i = h.begin(); i != h.end(); ++i) {
// cout << "Document ID " << *i << "\t";
- __u64 score = i.get_percent();
+ std::uint64_t score = i.get_percent();
Xapian::Document doc = i.get_document();
*resultKey = doc.get_data().c_str();
#elif defined USELUCENE
@@ -551,7 +551,7 @@ ListKey &SWModule::search(const char *istr, int searchType, int flags, SWKey *sc
Document &doc = h->doc(i);
// set a temporary verse key to this module position
*resultKey = wcharToUTF8(doc.get(_T("key"))); //TODO Does a key always accept utf8?
- __u64 score = (__u64)((__u32)(h->score(i)*100));
+ std::uint64_t score = (std::uint64_t)((std::uint32_t)(h->score(i)*100));
#endif
// check to see if it sets ok (within our bounds) and if not, skip
diff --git a/tests/filtertest.cpp b/tests/filtertest.cpp
index 03c86954..91652b87 100644
--- a/tests/filtertest.cpp
+++ b/tests/filtertest.cpp
@@ -72,7 +72,7 @@ int main(int argc, char **argv) {
/*
// Example showing safe to cast to u16 stream
unsigned int size = lineBuffer.size() / 2;
- __u16 *wcharBuf = (__u16 *)lineBuffer.getRawData();
+ std::uint16_t *wcharBuf = (std::uint16_t *)lineBuffer.getRawData();
for (unsigned int i = 0; i < size; ++i) {
std::wcout << (wchar_t)wcharBuf[i]; // must cast for correct output and because wchar_t is different size on linux we couldn't declare out wcharBuf a wchar_t *
}
diff --git a/tests/utf8norm.cpp b/tests/utf8norm.cpp
index 06143c43..27ebb825 100644
--- a/tests/utf8norm.cpp
+++ b/tests/utf8norm.cpp
@@ -67,7 +67,7 @@ int main(int argc, char **argv) {
}
const unsigned char *c = (const unsigned char *)filteredContents.getRawData();
// UTF-32 BOM
- __u32 ch = 0xfeff;
+ std::uint32_t ch = 0xfeff;
// write(STDOUT_FILENO, &ch, 4);
while (c && *c) {
ch = getUniCharFromUTF8(&c);