[Box Backup-dev] COMMIT r304 - in box/chris/win32/type-changes: . bin/bbackupctl bin/bbackupd bin/bbackupquery lib/backupclient lib/common lib/server lib/win32
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Fri Jan 6 19:21:35 GMT 2006
Author: chris
Date: 2006-01-06 19:21:16 +0000 (Fri, 06 Jan 2006)
New Revision: 304
Modified:
box/chris/win32/type-changes/bin/bbackupctl/bbackupctl.cpp
box/chris/win32/type-changes/bin/bbackupd/BackupClientDirectoryRecord.cpp
box/chris/win32/type-changes/bin/bbackupd/BackupDaemon.cpp
box/chris/win32/type-changes/bin/bbackupd/Win32ServiceFunctions.cpp
box/chris/win32/type-changes/bin/bbackupd/bbackupd.cpp
box/chris/win32/type-changes/bin/bbackupquery/BackupQueries.cpp
box/chris/win32/type-changes/bin/bbackupquery/bbackupquery.cpp
box/chris/win32/type-changes/configure.ac
box/chris/win32/type-changes/lib/backupclient/BackupClientFileAttributes.cpp
box/chris/win32/type-changes/lib/backupclient/BackupClientRestore.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreDirectory.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreDirectory.h
box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.h
box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCmbDiff.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCmbIdx.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCombine.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreFileDiff.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreFileEncodeStream.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreFileRevDiff.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreFilename.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreFilenameClear.cpp
box/chris/win32/type-changes/lib/common/BoxTimeToUnix.h
box/chris/win32/type-changes/lib/common/DebugMemLeakFinder.cpp
box/chris/win32/type-changes/lib/server/Daemon.cpp
box/chris/win32/type-changes/lib/server/LocalProcessStream.cpp
box/chris/win32/type-changes/lib/server/Protocol.cpp
box/chris/win32/type-changes/lib/server/Socket.cpp
box/chris/win32/type-changes/lib/server/SocketListen.h
box/chris/win32/type-changes/lib/server/SocketStream.cpp
box/chris/win32/type-changes/lib/server/SocketStreamTLS.cpp
box/chris/win32/type-changes/lib/win32/WinNamedPipeStream.cpp
box/chris/win32/type-changes/lib/win32/config.h.win32
box/chris/win32/type-changes/lib/win32/emu.cpp
box/chris/win32/type-changes/lib/win32/emu.h
Log:
* Many files
- Reverted typecasts to the same type as the destination. The remaining
changes should be all (and only) the significant ones
Modified: box/chris/win32/type-changes/bin/bbackupctl/bbackupctl.cpp
===================================================================
--- box/chris/win32/type-changes/bin/bbackupctl/bbackupctl.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/bin/bbackupctl/bbackupctl.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -10,11 +10,8 @@
#include "Box.h"
#include <stdio.h>
+#include <unistd.h>
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#include "MainHelper.h"
#include "BoxPortsAndFiles.h"
#include "BackupDaemonConfigVerify.h"
@@ -215,7 +212,7 @@
// No? Just send the command given plus a quit command.
std::string cmd(argv[0]);
cmd += "\nquit\n";
- connection.Write(cmd.c_str(), (int)cmd.size());
+ connection.Write(cmd.c_str(), cmd.size());
}
// Read the response
Modified: box/chris/win32/type-changes/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/chris/win32/type-changes/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/bin/bbackupd/BackupClientDirectoryRecord.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -9,10 +9,7 @@
#include "Box.h"
-#ifdef HAVE_DIRENT_H
- #include <dirent.h>
-#endif
-
+#include <dirent.h>
#include <errno.h>
#include <string.h>
@@ -260,7 +257,7 @@
checksum_info.mAttributeModificationTime = FileAttrModificationTime(st);
checksum_info.mSize = st.st_size;
currentStateChecksum.Add(&checksum_info, sizeof(checksum_info));
- currentStateChecksum.Add(en->d_name, (int)strlen(en->d_name));
+ currentStateChecksum.Add(en->d_name, strlen(en->d_name));
// If the file has been modified madly into the future, download the
// directory record anyway to ensure that it doesn't get uploaded
Modified: box/chris/win32/type-changes/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/win32/type-changes/bin/bbackupd/BackupDaemon.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/bin/bbackupd/BackupDaemon.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -10,11 +10,8 @@
#include "Box.h"
#include <stdio.h>
+#include <unistd.h>
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#ifndef WIN32
#include <signal.h>
#include <syslog.h>
@@ -31,9 +28,6 @@
#include <cstdio>
#include <sys/mnttab.h>
#endif
-#ifdef HAVE_PROCESS_H
- #include <process.h>
-#endif
#include "Configuration.h"
#include "IOStream.h"
@@ -265,7 +259,7 @@
conf.GetKeyValueInt("MaxUploadWait"),
mState);
- mpCommandSocketInfo->mListeningSocket.Write(summary, (int)summarySize);
+ mpCommandSocketInfo->mListeningSocket.Write(summary, summarySize);
mpCommandSocketInfo->mListeningSocket.Write("ping\n", 5);
IOStreamGetLine readLine(mpCommandSocketInfo->mListeningSocket);
@@ -320,7 +314,7 @@
{
const char* response = sendOK ? "ok\n" : "error\n";
mpCommandSocketInfo->mListeningSocket.Write(
- response, (int)strlen(response));
+ response, strlen(response));
}
if (disconnect)
@@ -514,7 +508,7 @@
{
// No command socket or connection, just do a normal sleep
time_t sleepSeconds = BoxTimeToSeconds(requiredDelay);
- ::sleep((unsigned int)((sleepSeconds <= 0)?1:sleepSeconds));
+ ::sleep((sleepSeconds <= 0)?1:sleepSeconds);
}
}
@@ -669,8 +663,7 @@
}
// Calculate when the next sync run should be
- nextSyncTime = currentSyncStartTime + updateStoreInterval +
- Random::RandomInt((uint32_t)updateStoreInterval >> SYNC_PERIOD_RANDOM_EXTRA_TIME_SHIFT_BY);
+ nextSyncTime = currentSyncStartTime + updateStoreInterval + Random::RandomInt(updateStoreInterval >> SYNC_PERIOD_RANDOM_EXTRA_TIME_SHIFT_BY);
// Commit the ID Maps
CommitIDMapsAfterSync();
@@ -843,7 +836,7 @@
#ifdef WIN32
// Really could use some interprocess protection, mutex etc
// any side effect should be too bad???? :)
- DWORD timeout = (DWORD)BoxTimeToMilliSeconds(RequiredDelay);
+ DWORD timeout = BoxTimeToMilliSeconds(RequiredDelay);
while ( this->mReceivedCommandConn == false )
{
@@ -1094,7 +1087,7 @@
{
#ifdef WIN32
mpCommandSocketInfo->mListeningSocket.Write(message,
- (int)strlen(message));
+ strlen(message));
#else
mpCommandSocketInfo->mpConnectedSocket->Write(message,
strlen(message));
@@ -1691,9 +1684,7 @@
char newStateSize = sprintf(newState, "state %d\n", State);
#ifdef WIN32
-#ifndef _MSC_VER
-#warning FIX ME: race condition
-#endif
+ #warning FIX ME: race condition
// what happens if the socket is closed by the other thread before
// we can write to it? Null pointer deref at best.
if (mpCommandSocketInfo &&
Modified: box/chris/win32/type-changes/bin/bbackupd/Win32ServiceFunctions.cpp
===================================================================
--- box/chris/win32/type-changes/bin/bbackupd/Win32ServiceFunctions.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/bin/bbackupd/Win32ServiceFunctions.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -14,12 +14,10 @@
#include "Box.h"
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-#ifdef HAVE_PROCESS_H
- #include <process.h>
-#endif
+//#include <stdio.h>
+//#include <stdlib.h>
+#include <unistd.h>
+//#include <windows.h>
extern void TerminateService(void);
extern unsigned int WINAPI RunService(LPVOID lpParameter);
@@ -33,23 +31,18 @@
#define SERVICE_NAME "boxbackup"
-void ShowMessage(char *s)
-{
- MessageBox(0, s, "Box Backup Message",
- MB_OK | MB_SETFOREGROUND | MB_DEFAULT_DESKTOP_ONLY);
-}
-
void ErrorHandler(char *s, DWORD err)
{
char buf[256];
memset(buf, 0, sizeof(buf));
- _snprintf(buf, sizeof(buf)-1, "%s (%d)", s, err);
+ snprintf(buf, sizeof(buf)-1, "%s (%d)", s, err);
::syslog(LOG_ERR, "%s", buf);
MessageBox(0, buf, "Error",
MB_OK | MB_SETFOREGROUND | MB_DEFAULT_DESKTOP_ONLY);
ExitProcess(err);
}
+
void WINAPI ServiceControlHandler( DWORD controlCode )
{
switch ( controlCode )
@@ -125,8 +118,6 @@
return;
}
- ShowMessage("Starting...");
-
HANDLE ourThread = (HANDLE)_beginthreadex(
NULL,
0,
@@ -194,7 +185,7 @@
cmd[sizeof(cmd)-1] = 0;
char cmd_args[MAX_PATH];
- _snprintf(cmd_args, sizeof(cmd_args)-1, "%s --service", cmd);
+ snprintf(cmd_args, sizeof(cmd_args)-1, "%s --service", cmd);
cmd_args[sizeof(cmd_args)-1] = 0;
newService = CreateService(
Modified: box/chris/win32/type-changes/bin/bbackupd/bbackupd.cpp
===================================================================
--- box/chris/win32/type-changes/bin/bbackupd/bbackupd.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/bin/bbackupd/bbackupd.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -54,7 +54,7 @@
WSADATA info;
- if (WSAStartup(0x0101, &info) == SOCKET_ERROR)
+ if (WSAStartup(MAKELONG(1, 1), &info) == SOCKET_ERROR)
{
// box backup will not run without sockets
::syslog(LOG_ERR, "Failed to initialise Windows Sockets");
Modified: box/chris/win32/type-changes/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/chris/win32/type-changes/bin/bbackupquery/BackupQueries.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/bin/bbackupquery/BackupQueries.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -9,22 +9,16 @@
#include "Box.h"
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#include <string.h>
#include <stdio.h>
+#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <dirent.h>
-#ifdef HAVE_DIRENT_H
- #include <dirent.h>
-#endif
-
#include <set>
#include "BackupQueries.h"
@@ -1253,7 +1247,7 @@
for(std::set<std::pair<std::string, BackupStoreDirectory::Entry *> >::const_iterator i = storeFiles.begin(); i != storeFiles.end(); ++i)
{
// Does the file exist locally?
- std::set<std::string>::iterator local(localFiles.find(i->first));
+ std::set<std::string>::const_iterator local(localFiles.find(i->first));
if(local == localFiles.end())
{
// Not found -- report
@@ -1421,7 +1415,7 @@
}
// Report any files which exist on the locally, but not on the store
- for(std::set<std::string>::iterator i = localFiles.begin(); i != localFiles.end(); ++i)
+ for(std::set<std::string>::const_iterator i = localFiles.begin(); i != localFiles.end(); ++i)
{
std::string localName(rLocalDir + DIRECTORY_SEPARATOR + *i);
// Should this be ignored (ie is excluded)?
@@ -1458,7 +1452,7 @@
for(std::set<std::pair<std::string, BackupStoreDirectory::Entry *> >::const_iterator i = storeDirs.begin(); i != storeDirs.end(); ++i)
{
// Does the directory exist locally?
- std::set<std::string>::iterator local(localDirs.find(i->first));
+ std::set<std::string>::const_iterator local(localDirs.find(i->first));
if(local == localDirs.end())
{
// Not found -- report
Modified: box/chris/win32/type-changes/bin/bbackupquery/bbackupquery.cpp
===================================================================
--- box/chris/win32/type-changes/bin/bbackupquery/bbackupquery.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/bin/bbackupquery/bbackupquery.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -9,9 +9,7 @@
#include "Box.h"
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
+#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_LIBREADLINE
@@ -64,7 +62,7 @@
// Under Win32 we must initialise the Winsock library
// before using it.
- if (WSAStartup(0x0101, &info) == SOCKET_ERROR)
+ if (WSAStartup(MAKELONG(1, 1), &info) == SOCKET_ERROR)
{
// throw error? perhaps give it its own id in the furture
THROW_EXCEPTION(BackupStoreException, Internal)
Modified: box/chris/win32/type-changes/configure.ac
===================================================================
--- box/chris/win32/type-changes/configure.ac 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/configure.ac 2006-01-06 19:21:16 UTC (rev 304)
@@ -65,7 +65,7 @@
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([execinfo.h netinet/in.h regex.h sys/types.h sys/xattr.h pwd.h process.h sys/socket.h dirent.h])
+AC_CHECK_HEADERS([execinfo.h netinet/in.h regex.h sys/types.h sys/xattr.h pwd.h])
### Checks for typedefs, structures, and compiler characteristics.
@@ -110,7 +110,7 @@
AC_FUNC_ERROR_AT_LINE
AC_TYPE_SIGNAL
AC_FUNC_STAT
-AC_CHECK_FUNCS([getpeereid kqueue lchown setproctitle getpid])
+AC_CHECK_FUNCS([getpeereid kqueue lchown setproctitle])
AX_FUNC_SYSCALL
AX_CHECK_SYSCALL_LSEEK
Modified: box/chris/win32/type-changes/lib/backupclient/BackupClientFileAttributes.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupClientFileAttributes.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupClientFileAttributes.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -9,13 +9,10 @@
#include "Box.h"
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
+#include <unistd.h>
#include <limits.h>
#include <algorithm>
#include <new>
@@ -623,7 +620,7 @@
}
#endif
- xattrOffset += (int)std::strlen(reinterpret_cast<char*>(pattr+1))+1;
+ xattrOffset += std::strlen(reinterpret_cast<char*>(pattr+1))+1;
}
// If working as root, set user IDs
@@ -977,7 +974,7 @@
MD5Digest digest;
digest.Add(&hashData, sizeof(hashData));
digest.Add(xattr.GetBuffer(), xattr.GetSize());
- digest.Add(leafname.c_str(), (int)leafname.size());
+ digest.Add(leafname.c_str(), leafname.size());
digest.Add(sAttributeHashSecret, sAttributeHashSecretLength);
digest.Finish();
Modified: box/chris/win32/type-changes/lib/backupclient/BackupClientRestore.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupClientRestore.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupClientRestore.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -9,14 +9,11 @@
#include "Box.h"
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#include <sys/types.h>
#include <sys/stat.h>
#include <string>
#include <set>
+#include <unistd.h>
#include <limits.h>
#include <stdio.h>
@@ -106,7 +103,7 @@
// Name string
std::string::size_type nsize = mNextLevelLocalName.size();
rWrite.Write(&nsize, sizeof(nsize));
- rWrite.Write(mNextLevelLocalName.c_str(), (int)nsize);
+ rWrite.Write(mNextLevelLocalName.c_str(), nsize);
// And then the level itself
mpNextLevel->SaveLevel(rWrite);
}
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreDirectory.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreDirectory.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreDirectory.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -230,7 +230,7 @@
// Build header
dir_StreamFormat hdr;
hdr.mMagicValue = htonl(OBJECTMAGIC_DIR_MAGIC_VALUE);
- hdr.mNumEntries = htonl((u_long)count);
+ hdr.mNumEntries = htonl(count);
hdr.mObjectID = box_hton64(mObjectID);
hdr.mContainerID = box_hton64(mContainerID);
hdr.mAttributesModTime = box_hton64(mAttributesModTime);
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreDirectory.h
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreDirectory.h 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreDirectory.h 2006-01-06 19:21:16 UTC (rev 304)
@@ -146,8 +146,7 @@
int64_t GetRevisionID() const {return mRevisionID;}
void SetRevisionID(int64_t RevisionID) {mRevisionID = RevisionID;}
- unsigned int GetNumberOfEntries() const
- {return (unsigned int)mEntries.size();}
+ unsigned int GetNumberOfEntries() const {return mEntries.size();}
// User info -- not serialised into streams
int64_t GetUserInfo1_SizeInBlocks() const {return mUserInfo1;}
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -9,10 +9,7 @@
#include "Box.h"
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
+#include <unistd.h>
#include <sys/stat.h>
#include <string.h>
#include <new>
@@ -522,22 +519,21 @@
if(mNumBlocks > 0)
{
// Find the maximum encoded data size
- uint64_t maxEncodedDataSize = 0;
+ int32_t maxEncodedDataSize = 0;
const file_BlockIndexEntry *entry = (file_BlockIndexEntry *)mpBlockIndex;
ASSERT(entry != 0);
for(int64_t e = 0; e < mNumBlocks; e++)
{
// Get the clear and encoded size
- uint64_t encodedSize = box_ntoh64(entry[e].mEncodedSize);
+ int32_t encodedSize = box_ntoh64(entry[e].mEncodedSize);
ASSERT(encodedSize > 0);
// Larger?
- if(encodedSize > maxEncodedDataSize)
- maxEncodedDataSize = encodedSize;
+ if(encodedSize > maxEncodedDataSize) maxEncodedDataSize = encodedSize;
}
// Allocate those blocks!
- mpEncodedData = (uint8_t*)BackupStoreFile::CodingChunkAlloc((int)maxEncodedDataSize + 32);
+ mpEncodedData = (uint8_t*)BackupStoreFile::CodingChunkAlloc(maxEncodedDataSize + 32);
// Allocate the block for the clear data, using the hint from the header.
// If this is wrong, things will exception neatly later on, so it can't be used
@@ -605,15 +601,14 @@
int64_t indexSize = sizeof(file_BlockIndexEntry) * mNumBlocks;
// Allocate some memory
- mpBlockIndex = ::malloc((size_t)indexSize);
+ mpBlockIndex = ::malloc(indexSize);
if(mpBlockIndex == 0)
{
throw std::bad_alloc();
}
// Read it in
- if(!mrEncodedFile.ReadFullBuffer(mpBlockIndex, (int)indexSize,
- 0 /* not interested in bytes read if this fails */, mTimeout))
+ if(!mrEncodedFile.ReadFullBuffer(mpBlockIndex, indexSize, 0 /* not interested in bytes read if this fails */, mTimeout))
{
// Couldn't read header
THROW_EXCEPTION(BackupStoreException, WhenDecodingExpectedToReadButCouldnt)
@@ -680,7 +675,7 @@
// Get the size from the block index
const file_BlockIndexEntry *entry = (file_BlockIndexEntry *)mpBlockIndex;
- uint64_t encodedSize = box_ntoh64(entry[mCurrentBlock].mEncodedSize);
+ int32_t encodedSize = box_ntoh64(entry[mCurrentBlock].mEncodedSize);
if(encodedSize <= 0)
{
// The caller is attempting to decode a file which is the direct result of a diff
@@ -690,16 +685,14 @@
}
// Load in next block
- if(!mrEncodedFile.ReadFullBuffer(mpEncodedData, (int)encodedSize,
- 0 /* not interested in bytes read if this fails */, mTimeout))
+ if(!mrEncodedFile.ReadFullBuffer(mpEncodedData, encodedSize, 0 /* not interested in bytes read if this fails */, mTimeout))
{
// Couldn't read header
THROW_EXCEPTION(BackupStoreException, WhenDecodingExpectedToReadButCouldnt)
}
// Decode the data
- mCurrentBlockClearSize = BackupStoreFile::DecodeChunk(mpEncodedData,
- (int)encodedSize, mpClearData, mClearDataSize);
+ mCurrentBlockClearSize = BackupStoreFile::DecodeChunk(mpEncodedData, encodedSize, mpClearData, mClearDataSize);
// Calculate IV for this entry
uint64_t iv = mEntryIVBase;
@@ -938,7 +931,7 @@
}
// Check alignment of the block
- ASSERT((((long long)rOutput.mpBuffer) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+ ASSERT((((uint32_t)(long)rOutput.mpBuffer) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
// Want to compress it?
bool compressChunk = (ChunkSize >= BACKUP_FILE_MIN_COMPRESSED_CHUNK_SIZE);
@@ -1026,7 +1019,7 @@
int BackupStoreFile::DecodeChunk(const void *Encoded, int EncodedSize, void *Output, int OutputSize)
{
// Check alignment of the encoded block
- ASSERT((((long long)Encoded) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+ ASSERT((((uint32_t)(long)Encoded) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
// First check
if(EncodedSize < 1)
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.h
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.h 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.h 2006-01-06 19:21:16 UTC (rev 304)
@@ -125,7 +125,7 @@
// Align to main block size
ASSERT(sizeof(unsigned long) >= sizeof(void*)); // make sure casting the right pointer size
uint8_t adjustment = BACKUPSTOREFILE_CODING_BLOCKSIZE
- - (uint8_t)(((unsigned long long)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE);
+ - (uint8_t)(((unsigned long)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE);
uint8_t *b = (a + adjustment);
// Store adjustment
*b = adjustment;
@@ -136,7 +136,7 @@
{
// Check alignment is as expected
ASSERT(sizeof(unsigned long) >= sizeof(void*)); // make sure casting the right pointer size
- ASSERT((uint8_t)(((unsigned long long)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+ ASSERT((uint8_t)(((unsigned long)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
uint8_t *a = (uint8_t*)Block;
a -= BACKUPSTOREFILE_CODING_OFFSET;
// Adjust downwards...
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCmbDiff.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCmbDiff.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCmbDiff.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -79,7 +79,7 @@
}
int64_t diff1NumBlocks = box_ntoh64(diff1IdxHdr.mNumBlocks);
// Allocate some memory
- int64_t *diff1BlockStartPositions = (int64_t*)::malloc(((size_t)diff1NumBlocks + 1) * sizeof(int64_t));
+ int64_t *diff1BlockStartPositions = (int64_t*)::malloc((diff1NumBlocks + 1) * sizeof(int64_t));
if(diff1BlockStartPositions == 0)
{
throw std::bad_alloc();
@@ -201,14 +201,14 @@
// Block is in the old diff file, copy it across
copyBlock = true;
copyFrom = diff1BlockStartPositions[blockIndex];
- int nb = (int)blockIndex + 1;
+ int nb = blockIndex + 1;
while(diff1BlockStartPositions[nb] <= 0)
{
// This is safe, because the last entry will terminate it properly!
++nb;
ASSERT(nb <= diff1NumBlocks);
}
- copySize = (int)(diff1BlockStartPositions[nb] - copyFrom);
+ copySize = diff1BlockStartPositions[nb] - copyFrom;
fromFileDiff1 = true;
}
}
@@ -284,7 +284,7 @@
if(diff1BlockStartPositions[blockIndex] > 0)
{
// Block is in the first diff file, stick in size
- int nb = (int)blockIndex + 1;
+ int nb = blockIndex + 1;
while(diff1BlockStartPositions[nb] <= 0)
{
// This is safe, because the last entry will terminate it properly!
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCmbIdx.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCmbIdx.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCmbIdx.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -174,7 +174,7 @@
// Then... allocate memory for the list of sizes
mNumEntriesInFromFile = box_ntoh64(fromHdr.mNumBlocks);
- mFromBlockSizes = (int64_t*)::malloc((size_t)mNumEntriesInFromFile * sizeof(int64_t));
+ mFromBlockSizes = (int64_t*)::malloc(mNumEntriesInFromFile * sizeof(int64_t));
if(mFromBlockSizes == 0)
{
throw std::bad_alloc();
@@ -241,7 +241,7 @@
int entriesToWrite = NBytes / sizeof(file_BlockIndexEntry);
if(entriesToWrite > mNumEntriesToGo)
{
- entriesToWrite = (int)mNumEntriesToGo;
+ entriesToWrite = mNumEntriesToGo;
}
// Setup ready to go
@@ -256,7 +256,7 @@
}
// Does this need adjusting?
- int s = (int)box_ntoh64(poutput[b].mEncodedSize);
+ int s = box_ntoh64(poutput[b].mEncodedSize);
if(s <= 0)
{
// A reference to a block in the from file
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCombine.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCombine.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFileCombine.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -96,7 +96,7 @@
// Allocate memory for the block index of the From file
int64_t fromNumBlocks = box_ntoh64(fromHdr.mNumBlocks);
// NOTE: An extra entry is required so that the length of the last block can be calculated
- FromIndexEntry *pFromIndex = (FromIndexEntry*)::malloc(((int)fromNumBlocks+1) * sizeof(FromIndexEntry));
+ FromIndexEntry *pFromIndex = (FromIndexEntry*)::malloc((fromNumBlocks+1) * sizeof(FromIndexEntry));
if(pFromIndex == 0)
{
throw std::bad_alloc();
@@ -252,7 +252,7 @@
if(encodedSize > 0)
{
// The block is actually in the diff file
- blockSize = (int32_t)encodedSize;
+ blockSize = encodedSize;
}
else
{
@@ -264,9 +264,7 @@
THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
}
// Calculate size. This operation is safe because of the extra entry at the end
- blockSize = (int32_t)(
- pFromIndex[blockIdx + 1].mFilePosition -
- pFromIndex[blockIdx].mFilePosition );
+ blockSize = pFromIndex[blockIdx + 1].mFilePosition - pFromIndex[blockIdx].mFilePosition;
}
ASSERT(blockSize > 0);
@@ -396,9 +394,7 @@
THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
}
// Calculate size. This operation is safe because of the extra entry at the end
- int32_t blockSize = (int32_t)(
- pFromIndex[blockIdx + 1].mFilePosition -
- pFromIndex[blockIdx].mFilePosition );
+ int32_t blockSize = pFromIndex[blockIdx + 1].mFilePosition - pFromIndex[blockIdx].mFilePosition;
// Then replace entry
en.mEncodedSize = box_hton64(((uint64_t)blockSize));
}
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFileDiff.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFileDiff.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFileDiff.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -317,7 +317,7 @@
//TODO: Verify that these sizes look reasonable
// Allocate space for the index
- BlocksAvailableEntry *pindex = (BlocksAvailableEntry*)::malloc(sizeof(BlocksAvailableEntry) * (size_t)numBlocks);
+ BlocksAvailableEntry *pindex = (BlocksAvailableEntry*)::malloc(sizeof(BlocksAvailableEntry) * numBlocks);
if(pindex == 0)
{
throw std::bad_alloc();
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFileEncodeStream.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFileEncodeStream.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFileEncodeStream.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -270,7 +270,7 @@
} while(rBlockSizeOut <= BACKUP_FILE_MAX_BLOCK_SIZE && rNumBlocksOut > BACKUP_FILE_INCREASE_BLOCK_SIZE_AFTER);
// Last block size
- rLastBlockSizeOut = (int32_t)(DataSize - ((rNumBlocksOut - 1) * rBlockSizeOut));
+ rLastBlockSizeOut = DataSize - ((rNumBlocksOut - 1) * rBlockSizeOut);
// Avoid small blocks?
if(rLastBlockSizeOut < BACKUP_FILE_AVOID_BLOCKS_LESS_THAN
@@ -451,7 +451,7 @@
}
// Index of the first block in old file (being diffed from)
- int firstIndex = (int)mpRecipe->BlockPtrToIndex((*mpRecipe)[mInstructionNumber].mpStartBlock);
+ int firstIndex = mpRecipe->BlockPtrToIndex((*mpRecipe)[mInstructionNumber].mpStartBlock);
int64_t sizeToSkip = 0;
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFileRevDiff.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFileRevDiff.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFileRevDiff.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -60,7 +60,7 @@
// For each block in the from file, we want to know it's index in the
// diff file. Allocate memory for this information.
int64_t fromNumBlocks = box_ntoh64(hdr.mNumBlocks);
- int64_t *pfromIndexInfo = (int64_t*)::malloc((size_t)fromNumBlocks * sizeof(int64_t));
+ int64_t *pfromIndexInfo = (int64_t*)::malloc(fromNumBlocks * sizeof(int64_t));
if(pfromIndexInfo == 0)
{
throw std::bad_alloc();
@@ -176,21 +176,21 @@
bufferSize = 0;
}
// Allocate new block
- buffer = ::malloc((size_t)blockSize);
+ buffer = ::malloc(blockSize);
if(buffer == 0)
{
throw std::bad_alloc();
}
- bufferSize = (int)blockSize;
+ bufferSize = blockSize;
}
ASSERT(bufferSize >= blockSize);
// Copy the block
- if(!rFrom.ReadFullBuffer(buffer, (int)blockSize, 0))
+ if(!rFrom.ReadFullBuffer(buffer, blockSize, 0))
{
THROW_EXCEPTION(BackupStoreException, FailedToReadBlockOnCombine)
}
- rOut.Write(buffer, (int)blockSize);
+ rOut.Write(buffer, blockSize);
// Store the size
pfromIndexInfo[b] = blockSize;
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFilename.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFilename.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFilename.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -141,7 +141,7 @@
{
CheckValid();
- rProtocol.Write(c_str(), (int)size());
+ rProtocol.Write(c_str(), size());
}
// --------------------------------------------------------------------------
@@ -216,7 +216,7 @@
{
CheckValid();
- rStream.Write(c_str(), (int)size());
+ rStream.Write(c_str(), size());
}
// --------------------------------------------------------------------------
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFilenameClear.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFilenameClear.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFilenameClear.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -218,7 +218,7 @@
void BackupStoreFilenameClear::EncryptClear(const std::string &rToEncode, CipherContext &rCipherContext, int StoreAsEncoding)
{
// Work out max size
- int maxOutSize = rCipherContext.MaxOutSizeForInBufferSize((int)rToEncode.size()) + 4;
+ int maxOutSize = rCipherContext.MaxOutSizeForInBufferSize(rToEncode.size()) + 4;
// Make sure encode/decode buffer has enough space
if(sEncDecBufferSize < maxOutSize)
@@ -233,7 +233,7 @@
MEMLEAKFINDER_NOT_A_LEAK(buffer);
// Encode -- do entire block in one go
- int encSize = rCipherContext.TransformBlock(buffer + 2, sEncDecBufferSize - 2, rToEncode.c_str(), (int)rToEncode.size());
+ int encSize = rCipherContext.TransformBlock(buffer + 2, sEncDecBufferSize - 2, rToEncode.c_str(), rToEncode.size());
// and add in header size
encSize += 2;
@@ -256,7 +256,7 @@
void BackupStoreFilenameClear::DecryptEncoded(CipherContext &rCipherContext) const
{
// Work out max size
- int maxOutSize = rCipherContext.MaxOutSizeForInBufferSize((int)size()) + 4;
+ int maxOutSize = rCipherContext.MaxOutSizeForInBufferSize(size()) + 4;
// Make sure encode/decode buffer has enough space
if(sEncDecBufferSize < maxOutSize)
@@ -272,7 +272,7 @@
// Decrypt
const char *str = c_str() + 2;
- int sizeOut = rCipherContext.TransformBlock(buffer, sEncDecBufferSize, str, (int)size() - 2);
+ int sizeOut = rCipherContext.TransformBlock(buffer, sEncDecBufferSize, str, size() - 2);
// Assign to this
mClearFilename.assign((char*)buffer, sizeOut);
Modified: box/chris/win32/type-changes/lib/common/BoxTimeToUnix.h
===================================================================
--- box/chris/win32/type-changes/lib/common/BoxTimeToUnix.h 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/common/BoxTimeToUnix.h 2006-01-06 19:21:16 UTC (rev 304)
@@ -26,7 +26,7 @@
inline void BoxTimeToTimespec(box_time_t Time, struct timespec &tv)
{
- tv.tv_sec = (long)(Time / MICRO_SEC_IN_SEC_LL);
+ tv.tv_sec = (time_t)(Time / MICRO_SEC_IN_SEC_LL);
tv.tv_nsec = ((long)(Time % MICRO_SEC_IN_SEC_LL)) * NANO_SEC_IN_USEC;
}
Modified: box/chris/win32/type-changes/lib/common/DebugMemLeakFinder.cpp
===================================================================
--- box/chris/win32/type-changes/lib/common/DebugMemLeakFinder.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/common/DebugMemLeakFinder.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -274,11 +274,7 @@
{
if(memleakfinder_numleaks() > 0)
{
-#ifdef HAVE_GETPID
fprintf(file, "MEMORY LEAKS FROM PROCESS %d (%s)\n", getpid(), markertext);
-#else
- fprintf(file, "MEMORY LEAKS (%s)\n", markertext);
-#endif
memleakfinder_reportleaks_file(file);
}
Modified: box/chris/win32/type-changes/lib/server/Daemon.cpp
===================================================================
--- box/chris/win32/type-changes/lib/server/Daemon.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/server/Daemon.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -9,11 +9,8 @@
#include "Box.h"
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#include <stdio.h>
+#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <stdarg.h>
Modified: box/chris/win32/type-changes/lib/server/LocalProcessStream.cpp
===================================================================
--- box/chris/win32/type-changes/lib/server/LocalProcessStream.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/server/LocalProcessStream.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -9,14 +9,11 @@
#include "Box.h"
-#ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
+#ifndef WIN32
+#include <sys/socket.h>
#endif
+#include <unistd.h>
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#include "LocalProcessStream.h"
#include "SocketStream.h"
#include "autogen_ServerException.h"
Modified: box/chris/win32/type-changes/lib/server/Protocol.cpp
===================================================================
--- box/chris/win32/type-changes/lib/server/Protocol.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/server/Protocol.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -638,7 +638,7 @@
Write((int32_t)(rValue.size()));
WRITE_ENSURE_BYTES_AVAILABLE(rValue.size())
- Write(rValue.c_str(), (int)rValue.size());
+ Write(rValue.c_str(), rValue.size());
}
// --------------------------------------------------------------------------
@@ -706,11 +706,11 @@
}
// Inform sub class
- InformStreamSending((u_int32_t)streamSize);
+ InformStreamSending(streamSize);
// Make header
PW_ObjectHeader objHeader;
- objHeader.mObjSize = htonl((u_long)(uncertainSize?(ProtocolStream_SizeUncertain):streamSize));
+ objHeader.mObjSize = htonl(uncertainSize?(ProtocolStream_SizeUncertain):streamSize);
objHeader.mObjType = htonl(SPECIAL_STREAM_OBJECT_TYPE);
// Write header
Modified: box/chris/win32/type-changes/lib/server/Socket.cpp
===================================================================
--- box/chris/win32/type-changes/lib/server/Socket.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/server/Socket.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -9,10 +9,7 @@
#include "Box.h"
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
+#include <unistd.h>
#include <sys/types.h>
#ifndef WIN32
#include <sys/socket.h>
Modified: box/chris/win32/type-changes/lib/server/SocketListen.h
===================================================================
--- box/chris/win32/type-changes/lib/server/SocketListen.h 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/server/SocketListen.h 2006-01-06 19:21:16 UTC (rev 304)
@@ -11,11 +11,8 @@
#define SOCKETLISTEN__H
#include <errno.h>
+#include <unistd.h>
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#ifdef HAVE_KQUEUE
#include <sys/event.h>
#include <sys/time.h>
Modified: box/chris/win32/type-changes/lib/server/SocketStream.cpp
===================================================================
--- box/chris/win32/type-changes/lib/server/SocketStream.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/server/SocketStream.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -9,10 +9,7 @@
#include "Box.h"
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
+#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
@@ -70,7 +67,7 @@
//
// --------------------------------------------------------------------------
SocketStream::SocketStream(const SocketStream &rToCopy)
- : mSocketHandle(::dup((int)rToCopy.mSocketHandle)),
+ : mSocketHandle(::dup(rToCopy.mSocketHandle)),
mReadClosed(rToCopy.mReadClosed),
mWriteClosed(rToCopy.mWriteClosed)
Modified: box/chris/win32/type-changes/lib/server/SocketStreamTLS.cpp
===================================================================
--- box/chris/win32/type-changes/lib/server/SocketStreamTLS.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/server/SocketStreamTLS.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -125,7 +125,7 @@
}
tOSSocketHandle socket = GetSocketHandle();
- BIO_set_fd(mpBIO, (int)socket, BIO_NOCLOSE);
+ BIO_set_fd(mpBIO, socket, BIO_NOCLOSE);
// Then the SSL object
mpSSL = ::SSL_new(rContext.GetRawContext());
Modified: box/chris/win32/type-changes/lib/win32/WinNamedPipeStream.cpp
===================================================================
--- box/chris/win32/type-changes/lib/win32/WinNamedPipeStream.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/win32/WinNamedPipeStream.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -11,10 +11,7 @@
#ifdef WIN32
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
+#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
#include <windows.h>
Modified: box/chris/win32/type-changes/lib/win32/config.h.win32
===================================================================
--- box/chris/win32/type-changes/lib/win32/config.h.win32 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/win32/config.h.win32 2006-01-06 19:21:16 UTC (rev 304)
@@ -55,7 +55,7 @@
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
-// #define HAVE_DIRENT_H 1
+#define HAVE_DIRENT_H 1
/* define if the compiler supports exceptions */
#define HAVE_EXCEPTIONS
@@ -120,8 +120,6 @@
/* Define to 1 if you have the <netinet/in.h> header file. */
/* #undef HAVE_NETINET_IN_H */
-#define HAVE_PROCESS_H 1
-
/* Define to 1 if SSL is pre-0.9.7 */
/* #undef HAVE_OLD_SSL */
Modified: box/chris/win32/type-changes/lib/win32/emu.cpp
===================================================================
--- box/chris/win32/type-changes/lib/win32/emu.cpp 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/win32/emu.cpp 2006-01-06 19:21:16 UTC (rev 304)
@@ -12,18 +12,11 @@
#include <windows.h>
#include <fcntl.h>
// #include <atlenc.h>
+#include <unistd.h>
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#include <string>
#include <list>
-#ifdef HAVE_PROCESS_H
- #include <process.h>
-#endif
-
//our implimentation for a timer
//based on a simple thread which sleeps for a
//period of time
@@ -350,7 +343,7 @@
// This next example is how we get our INODE (equivalent) information
conv.HighPart = fi.nFileIndexHigh;
conv.LowPart = fi.nFileIndexLow;
- st->st_ino = (_ino_t)conv.QuadPart;
+ st->st_ino = conv.QuadPart;
// get the time information
st->st_ctime = ConvertFileTimeToTime_t(&fi.ftCreationTime);
@@ -369,7 +362,7 @@
conv.HighPart = st_size.HighPart;
conv.LowPart = st_size.LowPart;
- st->st_size = (_off_t)conv.QuadPart;
+ st->st_size = conv.QuadPart;
//the mode of the file
st->st_mode = 0;
@@ -885,7 +878,7 @@
void syslog(int loglevel, const char *frmt, ...)
{
- WORD errinfo;
+ DWORD errinfo;
char* buffer;
std::string sixfour(frmt);
@@ -912,7 +905,7 @@
int sixfourpos;
- while ( (sixfourpos = (int)sixfour.find("%ll")) != -1 )
+ while ( ( sixfourpos = sixfour.find("%ll")) != -1 )
{
//maintain portability - change the 64 bit formater...
std::string temp = sixfour.substr(0,sixfourpos);
Modified: box/chris/win32/type-changes/lib/win32/emu.h
===================================================================
--- box/chris/win32/type-changes/lib/win32/emu.h 2006-01-06 19:06:48 UTC (rev 303)
+++ box/chris/win32/type-changes/lib/win32/emu.h 2006-01-06 19:21:16 UTC (rev 304)
@@ -39,11 +39,6 @@
#define read(fd,buf,count) _read(fd,buf,count)
#define write(fd,buf,count) _write(fd,buf,count)
#define lseek(fd,off,whence) _lseek(fd,off,whence)
-#define unlink(file) _unlink(file)
-#define chmod(file,mode) _chmod(file,mode)
-#define getcwd(buf,length) _getcwd(buf,length)
-#define fileno(struct_file) _fileno(struct_file)
-#define chdir(dir) _chdir(dir)
int setitimer(int type , struct itimerval *timeout, int);
void InitTimer(void);
@@ -121,7 +116,7 @@
return 0;
}
-inline int _chmod(const char * Filename, int uid)
+inline int chmod(const char * Filename, int uid)
{
//indicate sucsess
return 0;
@@ -257,9 +252,9 @@
#define S_ISLNK(x) ( false )
// nasty implementation to get working - TODO get the win32 equiv
-//#ifdef _DEBUG
-//#define getpid() 1
-//#endif
+#ifdef _DEBUG
+#define getpid() 1
+#endif
#define vsnprintf _vsnprintf
More information about the Boxbackup-dev
mailing list