[sword-svn] r1794 - in trunk: src/mgr src/modules/texts/rawtext tests utilities/diatheke

scribe at crosswire.org scribe at crosswire.org
Tue May 3 12:40:41 MST 2005


Author: scribe
Date: 2005-05-03 12:40:40 -0700 (Tue, 03 May 2005)
New Revision: 1794

Modified:
   trunk/src/mgr/filemgr.cpp
   trunk/src/modules/texts/rawtext/rawtext.cpp
   trunk/tests/rawldidxtest.cpp
   trunk/utilities/diatheke/corediatheke.cpp
   trunk/utilities/diatheke/diatheke.cpp
   trunk/utilities/diatheke/thmlcgi.cpp
Log:


Modified: trunk/src/mgr/filemgr.cpp
===================================================================
--- trunk/src/mgr/filemgr.cpp	2005-05-03 09:47:40 UTC (rev 1793)
+++ trunk/src/mgr/filemgr.cpp	2005-05-03 19:40:40 UTC (rev 1794)
@@ -246,11 +246,11 @@
 signed char FileMgr::trunc(FileDesc *file) {
 
 	static const char *writeTest = "x";
-	long size = lseek(file->getFd(), 1, SEEK_CUR);
+	long size = file->seek(1, SEEK_CUR);
 	if (size == 1) // was empty
 		size = 0;
 	char nibble [ 32767 ];
-	bool writable = write(file->getFd(), writeTest, 1);
+	bool writable = file->write(writeTest, 1);
 	int bytes = 0;
 
 	if (writable) {
@@ -269,9 +269,9 @@
 		if (fd < 0)
 			return -3;
 	
-		lseek(file->getFd(), 0, SEEK_SET);
+		file->seek(0, SEEK_SET);
 		while (size > 0) {	 
-			bytes = read(file->getFd(), nibble, 32767);
+			bytes = file->read(nibble, 32767);
 			write(fd, nibble, (bytes < size)?bytes:size);
 			size -= bytes;
 		}
@@ -284,7 +284,7 @@
 		lseek(fd, 0, SEEK_SET);
 		do {
 			bytes = read(fd, nibble, 32767);
-			write(file->getFd(), nibble, bytes);
+			file->write(nibble, bytes);
 		} while (bytes == 32767);
 		
 		::close(fd);
@@ -293,7 +293,7 @@
 		file->fd = -77;	// causes file to be swapped out forcing open on next call to getFd()
 	}
 	else { // put offset back and return failure
-		lseek(file->getFd(), -1, SEEK_CUR);
+		file->seek(-1, SEEK_CUR);
 		return -1;
 	}
 	return 0;
@@ -426,8 +426,8 @@
 
 	while (more) {
 		more = false;
-		long index = lseek(fDesc->getFd(), 0, SEEK_CUR);
-		len = read(fDesc->getFd(), chunk, 254);
+		long index = fDesc->seek(0, SEEK_CUR);
+		len = fDesc->read(chunk, 254);
 		if (len < 1)
 			break;
 		// clean up any preceding white space
@@ -449,7 +449,7 @@
 		index += (end + 1);
 
 		// reposition to next valid place to read
-		lseek(fDesc->getFd(), index, SEEK_SET);
+		fDesc->seek(index, SEEK_SET);
 
 		// clean up any trailing junk on line
 		for (; end > start; end--) {

Modified: trunk/src/modules/texts/rawtext/rawtext.cpp
===================================================================
--- trunk/src/modules/texts/rawtext/rawtext.cpp	2005-05-03 09:47:40 UTC (rev 1793)
+++ trunk/src/modules/texts/rawtext/rawtext.cpp	2005-05-03 19:40:40 UTC (rev 1794)
@@ -232,12 +232,12 @@
 
 			// get our current offset in our word.dat file and write this as the start
 			// of the next entry in our database
-			offset = lseek(datfd->getFd(), 0, SEEK_CUR);
-			write(idxfd->getFd(), &offset, 4);
+			offset = datfd->seek(0, SEEK_CUR);
+			idxfd->write(&offset, 4);
 
 			// write our word out to the word.dat file, delineating with a \n
-			write(datfd->getFd(), it->first.c_str(), strlen(it->first.c_str()));
-			write(datfd->getFd(), "\n", 1);
+			datfd->write(it->first.c_str(), strlen(it->first.c_str()));
+			datfd->write("\n", 1);
 
 			// force our mod position list for this word to be unique (remove
 			// duplicates that may exist if the word was found more than once
@@ -249,16 +249,16 @@
 			unsigned short count = 0;
 			for (it2 = it->second.begin(); it2 != it->second.end(); it2++) {
 				entryoff= *it2;
-				write(datfd->getFd(), &entryoff, 4);
+				datfd->write(&entryoff, 4);
 				count++;
 			}
 			
 			// now see what our new position is in our word.dat file and
 			// determine the size of this database entry
-			size = lseek(datfd->getFd(), 0, SEEK_CUR) - offset;
+			size = datfd->seek(0, SEEK_CUR) - offset;
 
 			// store the size of this database entry
-			write(idxfd->getFd(), &size, 2);
+			idxfd->write(&size, 2);
 			printf("%d entries (size: %d)\n", count, size);
 		}
 		FileMgr::getSystemFileMgr()->close(datfd);

Modified: trunk/tests/rawldidxtest.cpp
===================================================================
--- trunk/tests/rawldidxtest.cpp	2005-05-03 09:47:40 UTC (rev 1793)
+++ trunk/tests/rawldidxtest.cpp	2005-05-03 19:40:40 UTC (rev 1794)
@@ -24,7 +24,7 @@
 
 	sprintf(buf, "%s.idx", argv[1]);
 	FileDesc *idxfd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::RDONLY, true);
-	long maxoff = lseek(idxfd->getFd(), 0, SEEK_END) - 6;
+	long maxoff = idxfd->seek(0, SEEK_END) - 6;
 	FileMgr::getSystemFileMgr()->close(idxfd);
 
 	SWBuf last = "";

Modified: trunk/utilities/diatheke/corediatheke.cpp
===================================================================
--- trunk/utilities/diatheke/corediatheke.cpp	2005-05-03 09:47:40 UTC (rev 1793)
+++ trunk/utilities/diatheke/corediatheke.cpp	2005-05-03 19:40:40 UTC (rev 1794)
@@ -8,6 +8,7 @@
 #include <regex.h>
 #include <iostream>
 #include <list>
+#include <utilstr.h>
 
 using std::list;
 using std::cout;

Modified: trunk/utilities/diatheke/diatheke.cpp
===================================================================
--- trunk/utilities/diatheke/diatheke.cpp	2005-05-03 09:47:40 UTC (rev 1793)
+++ trunk/utilities/diatheke/diatheke.cpp	2005-05-03 19:40:40 UTC (rev 1794)
@@ -9,6 +9,7 @@
 #include "diathekemgr.h"
 #include "diafiltmgr.h"
 #include <iostream>
+#include <utilstr.h>
 
 using std::cout;
 

Modified: trunk/utilities/diatheke/thmlcgi.cpp
===================================================================
--- trunk/utilities/diatheke/thmlcgi.cpp	2005-05-03 09:47:40 UTC (rev 1793)
+++ trunk/utilities/diatheke/thmlcgi.cpp	2005-05-03 19:40:40 UTC (rev 1794)
@@ -17,6 +17,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "thmlcgi.h"
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 



More information about the sword-cvs mailing list