[sword-cvs] sword/src/modules/common zverse.cpp,1.36,1.37 zstr.cpp,1.25,1.26 rawverse.cpp,1.35,1.36 rawstr4.cpp,1.24,1.25 rawstr.cpp,1.42,1.43

sword@www.crosswire.org sword@www.crosswire.org
Fri, 2 Apr 2004 16:54:48 -0700


Update of /cvs/core/sword/src/modules/common
In directory www:/tmp/cvs-serv28564/src/modules/common

Modified Files:
	zverse.cpp zstr.cpp rawverse.cpp rawstr4.cpp rawstr.cpp 
Log Message:
Added SWBuf method setFormatted(). Altered all remaining uses of char[127] for file names to use SWBufs.

Index: zverse.cpp
===================================================================
RCS file: /cvs/core/sword/src/modules/common/zverse.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- zverse.cpp	6 Feb 2004 21:01:02 -0000	1.36
+++ zverse.cpp	2 Apr 2004 23:54:45 -0000	1.37
@@ -51,7 +51,7 @@
 
 zVerse::zVerse(const char *ipath, int fileMode, int blockType, SWCompress *icomp)
 {
-	char buf[127];
+	SWBuf buf;
 
 	nl = '\n';
 	path = 0;
@@ -70,22 +70,22 @@
 		fileMode = O_RDWR;
 	}
 		
-	sprintf(buf, "%s/ot.%czs", path, uniqueIndexID[blockType]);
+	buf.setFormatted("%s/ot.%czs", path, uniqueIndexID[blockType]);
 	idxfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s/nt.%czs", path, uniqueIndexID[blockType]);
+	buf.setFormatted("%s/nt.%czs", path, uniqueIndexID[blockType]);
 	idxfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s/ot.%czz", path, uniqueIndexID[blockType]);
+	buf.setFormatted("%s/ot.%czz", path, uniqueIndexID[blockType]);
 	textfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s/nt.%czz", path, uniqueIndexID[blockType]);
+	buf.setFormatted("%s/nt.%czz", path, uniqueIndexID[blockType]);
 	textfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s/ot.%czv", path, uniqueIndexID[blockType]);
+	buf.setFormatted("%s/ot.%czv", path, uniqueIndexID[blockType]);
 	compfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s/nt.%czv", path, uniqueIndexID[blockType]);
+	buf.setFormatted("%s/nt.%czv", path, uniqueIndexID[blockType]);
 	compfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 	
 	instance++;

Index: zstr.cpp
===================================================================
RCS file: /cvs/core/sword/src/modules/common/zstr.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- zstr.cpp	6 Feb 2004 21:01:02 -0000	1.25
+++ zstr.cpp	2 Apr 2004 23:54:45 -0000	1.26
@@ -39,8 +39,9 @@
  * ENT:	ipath - path of the directory where data and index files are located.
  */
 
-zStr::zStr(const char *ipath, int fileMode, long blockCount, SWCompress *icomp) {
-	char buf[127];
+zStr::zStr(const char *ipath, int fileMode, long blockCount, SWCompress *icomp)
+{
+	SWBuf buf;
 
 	nl = '\n';
 	lastoff = -1;
@@ -57,20 +58,20 @@
 		fileMode = O_RDWR;
 	}
 		
-	sprintf(buf, "%s.idx", path);
+	buf.setFormatted("%s.idx", path);
 	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s.dat", path);
+	buf.setFormatted("%s.dat", path);
 	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s.zdx", path);
+	buf.setFormatted("%s.zdx", path);
 	zdxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s.zdt", path);
+	buf.setFormatted("%s.zdt", path);
 	zdtfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
 	if (datfd <= 0) {
-		sprintf(buf, "Error: %d", errno);
+		buf.setFormatted("Error: %d", errno);
 		perror(buf);
 	}
 

Index: rawverse.cpp
===================================================================
RCS file: /cvs/core/sword/src/modules/common/rawverse.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- rawverse.cpp	6 Feb 2004 21:01:02 -0000	1.35
+++ rawverse.cpp	2 Apr 2004 23:54:45 -0000	1.36
@@ -47,11 +47,11 @@
 
 RawVerse::RawVerse(const char *ipath, int fileMode)
 {
-	char *buf;
+	SWBuf buf;
 
 	path = 0;
 	stdstr(&path, ipath);
-     buf = new char [ strlen(path) + 80 ];
+	
 	if ((path[strlen(path)-1] == '/') || (path[strlen(path)-1] == '\\'))
 		path[strlen(path)-1] = 0;
 
@@ -59,19 +59,18 @@
 		fileMode = O_RDWR;
 	}
 		
-	sprintf(buf, "%s/ot.vss", path);
+	buf.setFormatted("%s/ot.vss", path);
 	idxfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s/nt.vss", path);
+	buf.setFormatted("%s/nt.vss", path);
 	idxfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s/ot", path);
+	buf.setFormatted("%s/ot", path);
 	textfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s/nt", path);
+	buf.setFormatted("%s/nt", path);
 	textfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	delete [] buf;
 	instance++;
 }
 

Index: rawstr4.cpp
===================================================================
RCS file: /cvs/core/sword/src/modules/common/rawstr4.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- rawstr4.cpp	6 Feb 2004 21:01:01 -0000	1.24
+++ rawstr4.cpp	2 Apr 2004 23:54:45 -0000	1.25
@@ -39,7 +39,7 @@
 
 RawStr4::RawStr4(const char *ipath, int fileMode)
 {
-	char buf[127];
+	SWBuf buf;
 
 	nl = '\n';
 	lastoff = -1;
@@ -54,14 +54,14 @@
 		fileMode = O_RDWR;
 	}
 		
-	sprintf(buf, "%s.idx", path);
+	buf.setFormatted("%s.idx", path);
 	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s.dat", path);
+	buf.setFormatted("%s.dat", path);
 	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
 	if (datfd < 0) {
-		sprintf(buf, "Error: %d", errno);
+		buf.setFormatted("Error: %d", errno);
 		perror(buf);
 	}
 

Index: rawstr.cpp
===================================================================
RCS file: /cvs/core/sword/src/modules/common/rawstr.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- rawstr.cpp	6 Feb 2004 21:01:01 -0000	1.42
+++ rawstr.cpp	2 Apr 2004 23:54:45 -0000	1.43
@@ -41,7 +41,7 @@
 
 RawStr::RawStr(const char *ipath, int fileMode)
 {
-	char buf[127];
+	SWBuf buf;
 
 	lastoff = -1;
 	path = 0;
@@ -55,14 +55,14 @@
 		fileMode = O_RDWR;
 	}
 		
-	sprintf(buf, "%s.idx", path);
+	buf.setFormatted("%s.idx", path);
 	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
-	sprintf(buf, "%s.dat", path);
+	buf.setFormatted("%s.dat", path);
 	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
 
 	if (datfd < 0) {
-		sprintf(buf, "Error: %d", errno);
+		buf.setFormatted("Error: %d", errno);
 		perror(buf);
 	}