[sword-svn] r2495 - in trunk/src: mgr modules/filters
scribe at crosswire.org
scribe at crosswire.org
Thu Dec 24 15:22:16 MST 2009
Author: scribe
Date: 2009-12-24 15:22:16 -0700 (Thu, 24 Dec 2009)
New Revision: 2495
Modified:
trunk/src/mgr/filemgr.cpp
trunk/src/mgr/ftplibftpt.cpp
trunk/src/modules/filters/teirtf.cpp
Log:
avoided a few warnings presented by FORTIFY_SOURCE=2 for jmarsden and the ubuntu team
Modified: trunk/src/mgr/filemgr.cpp
===================================================================
--- trunk/src/mgr/filemgr.cpp 2009-12-24 17:28:03 UTC (rev 2494)
+++ trunk/src/mgr/filemgr.cpp 2009-12-24 22:22:16 UTC (rev 2495)
@@ -282,20 +282,23 @@
file->seek(0, SEEK_SET);
while (size > 0) {
bytes = file->read(nibble, 32767);
- write(fd, nibble, (bytes < size)?bytes:size);
+ bytes = (bytes < size)?bytes:size;
+ if (write(fd, nibble, bytes) != bytes) { break; }
size -= bytes;
}
- // zero out the file
- ::close(file->fd);
- file->fd = ::open(file->path, O_TRUNC, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- ::close(file->fd);
- file->fd = -77; // force file open by filemgr
- // copy tmp file back (dumb, but must preserve file permissions)
- lseek(fd, 0, SEEK_SET);
- do {
- bytes = read(fd, nibble, 32767);
- file->write(nibble, bytes);
- } while (bytes == 32767);
+ if (size < 1) {
+ // zero out the file
+ ::close(file->fd);
+ file->fd = ::open(file->path, O_TRUNC, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
+ ::close(file->fd);
+ file->fd = -77; // force file open by filemgr
+ // copy tmp file back (dumb, but must preserve file permissions)
+ lseek(fd, 0, SEEK_SET);
+ do {
+ bytes = read(fd, nibble, 32767);
+ file->write(nibble, bytes);
+ } while (bytes == 32767);
+ }
::close(fd);
::close(file->fd);
@@ -415,7 +418,7 @@
do {
len = read(sfd, buf, 4096);
- write(dfd, buf, len);
+ if (write(dfd, buf, len) != len) break;
}
while(len == 4096);
::close(dfd);
Modified: trunk/src/mgr/ftplibftpt.cpp
===================================================================
--- trunk/src/mgr/ftplibftpt.cpp 2009-12-24 17:28:03 UTC (rev 2494)
+++ trunk/src/mgr/ftplibftpt.cpp 2009-12-24 22:22:16 UTC (rev 2495)
@@ -106,7 +106,7 @@
// yeah yeah, I know I know. Compile with curl support if you don't like it
#pragma GCC diagnostic ignored "-Wall"
void my_tmpnam(char *tmpName) {
- tmpnam(tmpName);
+ tmpName = tmpnam(tmpName);
}
#pragma GCC diagnostic warning "-Wall"
Modified: trunk/src/modules/filters/teirtf.cpp
===================================================================
--- trunk/src/modules/filters/teirtf.cpp 2009-12-24 17:28:03 UTC (rev 2494)
+++ trunk/src/modules/filters/teirtf.cpp 2009-12-24 22:22:16 UTC (rev 2495)
@@ -159,7 +159,7 @@
SWBuf type = tag.getAttribute("type");
SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
- VerseKey *vkey;
+ VerseKey *vkey = 0;
// see if we have a VerseKey * or descendant
SWTRY {
vkey = SWDYNAMIC_CAST(VerseKey, u->key);
More information about the sword-cvs
mailing list