[sword-svn] r3764 - in trunk/src: mgr modules/common
scribe at crosswire.org
scribe at crosswire.org
Sun Jul 26 04:44:21 EDT 2020
Author: scribe
Date: 2020-07-26 04:44:21 -0400 (Sun, 26 Jul 2020)
New Revision: 3764
Modified:
trunk/src/mgr/filemgr.cpp
trunk/src/mgr/ftplibftpt.cpp
trunk/src/modules/common/zipcomprs.cpp
Log:
Whitespace updates only
Modified: trunk/src/mgr/filemgr.cpp
===================================================================
--- trunk/src/mgr/filemgr.cpp 2020-07-26 08:29:46 UTC (rev 3763)
+++ trunk/src/mgr/filemgr.cpp 2020-07-26 08:44:21 UTC (rev 3764)
@@ -267,7 +267,7 @@
if (i == 9999)
return -2;
- FileDesc *fd = open(buf, CREAT|RDWR);
+ FileDesc *fd = open(buf, CREAT|RDWR);
if (!fd || fd->getFd() < 0)
return -3;
@@ -393,12 +393,12 @@
#else
// Crappy Windows-specific code because well... They can't be conformant
WIN32_FIND_DATAW fileData;
- SWBuf wcharBuf = utf8ToWChar(basePath+"*");
- const wchar_t *wcharPath = (const wchar_t *)wcharBuf.getRawData();
+ SWBuf wcharBuf = utf8ToWChar(basePath+"*");
+ const wchar_t *wcharPath = (const wchar_t *)wcharBuf.getRawData();
HANDLE findIterator = FindFirstFileW(wcharPath, &fileData);
if (findIterator != INVALID_HANDLE_VALUE) {
do {
- SWBuf dirEntName = wcharToUTF8(fileData.cFileName);
+ SWBuf dirEntName = wcharToUTF8(fileData.cFileName);
if (dirEntName != "." && dirEntName != "..") {
struct DirEntry i;
i.name = dirEntName;
@@ -455,7 +455,7 @@
int FileMgr::openFile(const char *fName, int mode, int perms) {
int fd =
#ifndef WIN32
- ::open(fName, mode, perms);
+ ::open(fName, mode, perms);
#else
::_wopen((const wchar_t *)utf8ToWChar(fName).getRawData(), mode, perms);
#endif
@@ -504,7 +504,7 @@
int FileMgr::removeFile(const char *fName) {
return
#ifndef WIN32
- ::remove(fName);
+ ::remove(fName);
#else
::_wremove((const wchar_t *)utf8ToWChar(fName).getRawData());
#endif
@@ -584,7 +584,7 @@
struct _stat stats;
int error = _wstat((const wchar_t *)utf8ToWChar(path).getRawData(), &stats);
#endif
- if (error) return 0;
+ if (error) return 0;
return ((stats.st_mode & S_IFDIR) == S_IFDIR);
}
@@ -597,7 +597,7 @@
struct _stat stats;
int error = _wstat((const wchar_t *)utf8ToWChar(path).getRawData(), &stats);
#endif
- if (error) return 0;
+ if (error) return 0;
return stats.st_size;
}
Modified: trunk/src/mgr/ftplibftpt.cpp
===================================================================
--- trunk/src/mgr/ftplibftpt.cpp 2020-07-26 08:29:46 UTC (rev 3763)
+++ trunk/src/mgr/ftplibftpt.cpp 2020-07-26 08:44:21 UTC (rev 3764)
@@ -152,13 +152,13 @@
pd.sr = statusReporter;
pd.term = &term;
pd.totalSize = 0;
- FileDesc *fd = 0;
+ FileDesc *fd = 0;
if (destBuf) {
FtpOptions(FTPLIB_CALLBACK_WRITER, (long)&my_swbufwriter, ftpConnection);
FtpOptions(FTPLIB_CALLBACK_WRITERARG, (long)destBuf, ftpConnection);
}
else {
- fd = FileMgr::getSystemFileMgr()->open(outFile, FileMgr::CREAT|FileMgr::WRONLY);
+ fd = FileMgr::getSystemFileMgr()->open(outFile, FileMgr::CREAT|FileMgr::WRONLY);
FtpOptions(FTPLIB_CALLBACK_WRITER, (long)&my_filewriter, ftpConnection);
FtpOptions(FTPLIB_CALLBACK_WRITERARG, (long)fd, ftpConnection);
}
@@ -181,7 +181,7 @@
pd.totalSize = size;
retVal = FtpGet(0, sourcePath, FTPLIB_IMAGE, ftpConnection) - 1;
}
- if (fd) FileMgr::getSystemFileMgr()->close(fd);
+ if (fd) FileMgr::getSystemFileMgr()->close(fd);
SWLog::getSystemLog()->logDebug("FTPLibFTPTransport - returning: %d\n", retVal);
return retVal;
}
Modified: trunk/src/modules/common/zipcomprs.cpp
===================================================================
--- trunk/src/modules/common/zipcomprs.cpp 2020-07-26 08:29:46 UTC (rev 3763)
+++ trunk/src/modules/common/zipcomprs.cpp 2020-07-26 08:44:21 UTC (rev 3764)
@@ -44,53 +44,54 @@
*/
namespace {
+
#define BLOCKSIZE 512
#define REGTYPE '0' /* regular file */
#define AREGTYPE '\0' /* regular file */
#define DIRTYPE '5' /* directory */
-struct tar_header { /* byte offset */
- char name[100]; /* 0 */
- char mode[8]; /* 100 */
- char uid[8]; /* 108 */
- char gid[8]; /* 116 */
- char size[12]; /* 124 */
- char mtime[12]; /* 136 */
- char chksum[8]; /* 148 */
- char typeflag; /* 156 */
- char linkname[100]; /* 157 */
- char magic[6]; /* 257 */
- char version[2]; /* 263 */
- char uname[32]; /* 265 */
- char gname[32]; /* 297 */
- char devmajor[8]; /* 329 */
- char devminor[8]; /* 337 */
- char prefix[155]; /* 345 */
- /* 500 */
+
+struct tar_header { /* byte offset */
+ char name[100]; /* 0 */
+ char mode[8]; /* 100 */
+ char uid[8]; /* 108 */
+ char gid[8]; /* 116 */
+ char size[12]; /* 124 */
+ char mtime[12]; /* 136 */
+ char chksum[8]; /* 148 */
+ char typeflag; /* 156 */
+ char linkname[100]; /* 157 */
+ char magic[6]; /* 257 */
+ char version[2]; /* 263 */
+ char uname[32]; /* 265 */
+ char gname[32]; /* 297 */
+ char devmajor[8]; /* 329 */
+ char devminor[8]; /* 337 */
+ char prefix[155]; /* 345 */
+ /* 500 */
};
+
union tar_buffer {
- char buffer[BLOCKSIZE];
- struct tar_header header;
+ char buffer[BLOCKSIZE];
+ struct tar_header header;
};
-int getoct(char *p,int width)
-{
- int result = 0;
- char c;
-
- while (width --)
- {
- c = *p++;
- if (c == ' ')
- continue;
- if (c == 0)
- break;
- result = result * 8 + (c - '0');
- }
- return result;
+
+int getoct(char *p, int width) {
+ int result = 0;
+ char c;
+
+ while (width--) {
+ c = *p++;
+ if (c == ' ') continue;
+ if (c == 0 ) break;
+ result = result * 8 + (c - '0');
+ }
+ return result;
}
+
int untar (gzFile in, const char *dest) {
union tar_buffer buffer;
int len;
@@ -100,7 +101,7 @@
sword::FileDesc *outfile = NULL;
sword::SWBuf fname;
time_t tartime;
-
+
while (1) {
len = gzread(in, &buffer, BLOCKSIZE);
if (len < 0)
@@ -111,7 +112,7 @@
*/
if (len != BLOCKSIZE)
sword::SWLog::getSystemLog()->logError("gzread: incomplete block read");
-
+
/*
* If we have to get a tar header
*/
@@ -127,7 +128,7 @@
fname = dest;
if (!fname.endsWith("/") && !fname.endsWith("\\")) fname += '/';
fname += buffer.header.name;
-
+
switch (buffer.header.typeflag) {
case DIRTYPE: {
sword::SWBuf dummyFile = fname + "dummyFile";
@@ -185,11 +186,11 @@
FILETIME ftm,ftLocal;
SYSTEMTIME st;
struct tm localt;
-
+
localt = *localtime(&tartime);
hFile = CreateFileW((const wchar_t *)sword::utf8ToWChar(fname).getRawData(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
-
+
st.wYear = (WORD)localt.tm_year+1900;
st.wMonth = (WORD)localt.tm_mon;
st.wDayOfWeek = (WORD)localt.tm_wday;
More information about the sword-cvs
mailing list