summaryrefslogtreecommitdiff
path: root/utilities/cipherraw.cpp
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-05-12 08:21:30 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-05-12 08:21:30 -0400
commit7a00574163029c0c2b649878c95d5acbd083564a (patch)
treec13cc5736025834df2874ed87ee8598070025ea6 /utilities/cipherraw.cpp
parentb745315323de9f27538edac9453205ca70e6186e (diff)
Imported Upstream version 1.7.2+dfsg
Diffstat (limited to 'utilities/cipherraw.cpp')
-rw-r--r--utilities/cipherraw.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/utilities/cipherraw.cpp b/utilities/cipherraw.cpp
index 1d0df9c..a8de3e7 100644
--- a/utilities/cipherraw.cpp
+++ b/utilities/cipherraw.cpp
@@ -1,5 +1,10 @@
-/*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+/******************************************************************************
+ *
+ * cipherraw.cpp - Utility to encipher a raw (uncompressed) module
+ *
+ * $Id: cipherraw.cpp 2833 2013-06-29 06:40:28Z chrislit $
+ *
+ * Copyright 1999-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -79,18 +84,18 @@ int main(int argc, char **argv) {
write(oxfd[1], &lzoffset, 4);
write(oxfd[1], &lzsize, 2);
- key.AutoNormalize(0);
- key.Headings(1);
- for (key.Index(0); (!key.Error()); key++) {
- rawdrv->findOffset(key.Testament(), key.Index(), &offset, &size);
+ key.setAutoNormalize(false);
+ key.setIntros(true);
+ for (key.setIndex(0); (!key.popError()); key++) {
+ rawdrv->findOffset(key.getTestament(), key.getIndex(), &offset, &size);
printf("%s: OLD offset: %ld; size: %d\n", (const char *)key, offset, size);
if ((offset == loffset) && (size == lsize)) {
printf("using previous offset,size %d\n", size);
- offset = lseek(oxfd[key.Testament() - 1], 0, SEEK_CUR);
+ offset = lseek(oxfd[key.getTestament() - 1], 0, SEEK_CUR);
printf("%ld %ld %d \n", offset, lzoffset, lzsize);
- write(oxfd[key.Testament() - 1], &lzoffset, 4);
- write(oxfd[key.Testament() - 1], &lzsize, 2);
+ write(oxfd[key.getTestament() - 1], &lzoffset, 4);
+ write(oxfd[key.getTestament() - 1], &lzsize, 2);
}
else {
lsize = size;
@@ -98,22 +103,22 @@ int main(int argc, char **argv) {
if (size) {
SWBuf tmpbuf;
- rawdrv->readText(key.Testament(), offset, size, tmpbuf);
+ rawdrv->readText(key.getTestament(), offset, size, tmpbuf);
zobj->Buf(tmpbuf.c_str(), size);
unsigned long ulSize = size;
zobj->cipherBuf(&ulSize);
size = (unsigned int)ulSize;
}
- offset = lseek(ofd[key.Testament() - 1], 0, SEEK_CUR);
- tmpoff = lseek(oxfd[key.Testament() - 1], 0, SEEK_CUR);
+ offset = lseek(ofd[key.getTestament() - 1], 0, SEEK_CUR);
+ tmpoff = lseek(oxfd[key.getTestament() - 1], 0, SEEK_CUR);
printf("%s: (%ld) NEW offset: %ld; size: %d\n", (const char *)key, tmpoff, offset, size);
- write(oxfd[key.Testament() - 1], &offset, 4);
+ write(oxfd[key.getTestament() - 1], &offset, 4);
unsigned long ulSize = size;
if (size)
- write(ofd[key.Testament() - 1], zobj->cipherBuf(&ulSize), size);
+ write(ofd[key.getTestament() - 1], zobj->cipherBuf(&ulSize), size);
size = (unsigned int)ulSize;
lzoffset = offset;
- write(oxfd[key.Testament() - 1], &size, 2);
+ write(oxfd[key.getTestament() - 1], &size, 2);
lzsize = size;
}
}