[sword-svn] r1690 - in trunk: lib/bcppmake src/mgr
scribe at crosswire.org
scribe at crosswire.org
Sun Jan 2 17:24:17 MST 2005
Author: scribe
Date: 2005-01-02 17:24:16 -0700 (Sun, 02 Jan 2005)
New Revision: 1690
Modified:
trunk/lib/bcppmake/libsword.bpr
trunk/src/mgr/ftptrans.cpp
trunk/src/mgr/installmgr.cpp
Log:
Fixed terminate and passive problems getting passed on to FTPTransport from InstallMgr
Modified: trunk/lib/bcppmake/libsword.bpr
===================================================================
--- trunk/lib/bcppmake/libsword.bpr 2005-01-01 12:43:33 UTC (rev 1689)
+++ trunk/lib/bcppmake/libsword.bpr 2005-01-03 00:24:16 UTC (rev 1690)
@@ -115,7 +115,7 @@
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<LINKER value="TLib"/>
- <USERDEFINES value="_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG"/>
+ <USERDEFINES value="_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0"/>
<SYSDEFINES value="NO_STRICT"/>
<MAINSOURCE value="libsword.bpf"/>
<INCLUDEPATH value="..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\i18n"/>
@@ -139,9 +139,9 @@
-I$(BCB)\include -I$(BCB)\include\vcl -I..\..\..\icu-sword\source\i18n
-src_suffix cpp -D_ICU_ -D_ICUSWORD_ -DUSBINARY -D_DEBUG
-DU_HAVE_PLACEMENT_NEW=0 -boa"/>
- <CFLAG1 value="-Od -Vx -X- -r- -a8 -b- -k -y -v -vi- -c -tW -tWM"/>
- <PFLAGS value="-$Y+ -$W -$O- -v -JPHNE -M"/>
- <AFLAGS value="/mx /w2 /zi"/>
+ <CFLAG1 value="-O2 -Vx -X- -a8 -b- -k- -vi -c -tW -tWM"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <AFLAGS value="/mx /w2 /zn"/>
<LFLAGS value="/P512"/>
</OPTIONS>
<LINKER>
@@ -210,8 +210,8 @@
[HistoryLists\hlConditionals]
Count=11
-Item0=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG
-Item1=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0
+Item0=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0
+Item1=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG
Item2=_ICU_;_ICUSWORD_;USBINARY;_DEBUG;U_HAVE_PLACEMENT_NEW=0
Item3=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
Item4=_ICU_;_ICUSWORD_;USBINARY
Modified: trunk/src/mgr/ftptrans.cpp
===================================================================
--- trunk/src/mgr/ftptrans.cpp 2005-01-01 12:43:33 UTC (rev 1689)
+++ trunk/src/mgr/ftptrans.cpp 2005-01-03 00:24:16 UTC (rev 1690)
@@ -95,8 +95,8 @@
int FTPTransport::copyDirectory(const char *urlPrefix, const char *dir, const char *dest, const char *suffix) {
int i;
-
- term = false;
+ int retVal = 0;
+
SWBuf url = (SWBuf)urlPrefix + (SWBuf)dir + "/"; //dont forget the final slash
fprintf(stderr, "FTPCopy: getting dir %s\n", url.c_str());
vector<struct ftpparse> dirList = getDirList(url.c_str());
@@ -112,40 +112,42 @@
long completedBytes = 0;
for (i = 0; i < dirList.size(); i++) {
struct ftpparse &dirEntry = dirList[i];
- SWBuf buffer = (SWBuf)dest + "/" + (dirEntry.name);
- if (!strcmp(&buffer.c_str()[buffer.length()-strlen(suffix)], suffix)) {
- SWBuf buffer2 = "Downloading (";
- buffer2.appendFormatted("%d", i+1);
- buffer2 += " of ";
- buffer2.appendFormatted("%d", dirList.size());
- buffer2 += "): ";
- buffer2 += (dirEntry.name);
- if (statusReporter)
- statusReporter->preStatus(totalBytes, completedBytes, buffer2.c_str());
- FileMgr::createParent(buffer.c_str()); // make sure parent directory exists
- SWTRY {
- SWBuf url = (SWBuf)urlPrefix + (SWBuf)dir + "/" + dirEntry.name; //dont forget the final slash
- if (dirEntry.flagtrycwd != 1) {
- if (getURL(buffer.c_str(), url.c_str())) {
- fprintf(stderr, "FTPCopy: failed to get file %s\n", url.c_str());
- return -2;
- }
- completedBytes += dirEntry.size;
+ SWBuf buffer = (SWBuf)dest + "/" + (dirEntry.name);
+ if (!strcmp(&buffer.c_str()[buffer.length()-strlen(suffix)], suffix)) {
+ SWBuf buffer2 = "Downloading (";
+ buffer2.appendFormatted("%d", i+1);
+ buffer2 += " of ";
+ buffer2.appendFormatted("%d", dirList.size());
+ buffer2 += "): ";
+ buffer2 += (dirEntry.name);
+ if (statusReporter)
+ statusReporter->preStatus(totalBytes, completedBytes, buffer2.c_str());
+ FileMgr::createParent(buffer.c_str()); // make sure parent directory exists
+ SWTRY {
+ SWBuf url = (SWBuf)urlPrefix + (SWBuf)dir + "/" + dirEntry.name; //dont forget the final slash
+ if (dirEntry.flagtrycwd != 1) {
+ if (getURL(buffer.c_str(), url.c_str())) {
+ fprintf(stderr, "FTPCopy: failed to get file %s\n", url.c_str());
+ return -2;
}
- else {
- SWBuf subdir = (SWBuf)dir + "/" + dirEntry.name;
- if (copyDirectory(urlPrefix, subdir, buffer.c_str(), suffix)) {
- fprintf(stderr, "FTPCopy: failed to get file %s\n", subdir.c_str());
- return -2;
- }
+ completedBytes += dirEntry.size;
+ }
+ else {
+ SWBuf subdir = (SWBuf)dir + "/" + dirEntry.name;
+ if (copyDirectory(urlPrefix, subdir, buffer.c_str(), suffix)) {
+ fprintf(stderr, "FTPCopy: failed to get file %s\n", subdir.c_str());
+ return -2;
}
}
- SWCATCH (...) {}
- if (term)
- break;
}
+ SWCATCH (...) {}
+ if (term) {
+ retVal = -3;
+ break;
+ }
+ }
}
- return 0;
+ return retVal;
}
Modified: trunk/src/mgr/installmgr.cpp
===================================================================
--- trunk/src/mgr/installmgr.cpp 2005-01-01 12:43:33 UTC (rev 1689)
+++ trunk/src/mgr/installmgr.cpp 2005-01-03 00:24:16 UTC (rev 1690)
@@ -197,14 +197,16 @@
int InstallMgr::ftpCopy(InstallSource *is, const char *src, const char *dest, bool dirTransfer, const char *suffix) {
int retVal = 0;
- term = false;
long i;
- FTPTransport *transport = createFTPTransport(is->source, statusReporter);
+ FTPTransport *trans = createFTPTransport(is->source, statusReporter);
+ transport = trans; // set classwide current transport for other thread terminate() call
+ trans->setPassive(passive);
+
SWBuf urlPrefix = (SWBuf)"ftp://" + is->source;
// let's be sure we can connect. This seems to be necessary but sucks
// SWBuf url = urlPrefix + is->directory.c_str() + "/"; //dont forget the final slash
-// if (transport->getURL("dirlist", url.c_str())) {
+// if (trans->getURL("dirlist", url.c_str())) {
// fprintf(stderr, "FTPCopy: failed to get dir %s\n", url.c_str());
// return -1;
// }
@@ -213,27 +215,27 @@
if (dirTransfer) {
SWBuf dir = (SWBuf)is->directory.c_str() + "/" + src; //dont forget the final slash
- retVal = transport->copyDirectory(urlPrefix, dir, dest, suffix);
+ retVal = trans->copyDirectory(urlPrefix, dir, dest, suffix);
}
else {
SWTRY {
SWBuf url = urlPrefix + is->directory.c_str() + "/" + src; //dont forget the final slash
- if (transport->getURL(dest, url.c_str())) {
+ if (trans->getURL(dest, url.c_str())) {
fprintf(stderr, "FTPCopy: failed to get file %s", url.c_str());
- return -1;
+ retVal = -1;
}
}
SWCATCH (...) {
- term = true;
+ retVal = -1;
}
}
SWTRY {
- FTPTransport *deleteMe = transport;
+ FTPTransport *deleteMe = trans;
// do this order for threadsafeness
// (see terminate())
- transport = 0;
+ trans = transport = 0;
delete deleteMe;
}
SWCATCH (...) {}
More information about the sword-cvs
mailing list