[Box Backup-dev] COMMIT r261 - in box/chris/win32/vc2005-compile-fixes: . 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
Wed Dec 21 03:12:46 GMT 2005


Author: chris
Date: 2005-12-21 03:11:48 +0000 (Wed, 21 Dec 2005)
New Revision: 261

Modified:
   box/chris/win32/vc2005-compile-fixes/bin/bbackupctl/bbackupctl.cpp
   box/chris/win32/vc2005-compile-fixes/bin/bbackupd/BackupClientDirectoryRecord.cpp
   box/chris/win32/vc2005-compile-fixes/bin/bbackupd/BackupDaemon.cpp
   box/chris/win32/vc2005-compile-fixes/bin/bbackupd/Win32ServiceFunctions.cpp
   box/chris/win32/vc2005-compile-fixes/bin/bbackupd/bbackupd.cpp
   box/chris/win32/vc2005-compile-fixes/bin/bbackupquery/BackupQueries.cpp
   box/chris/win32/vc2005-compile-fixes/bin/bbackupquery/bbackupquery.cpp
   box/chris/win32/vc2005-compile-fixes/configure.ac
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientFileAttributes.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientRestore.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreDirectory.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreDirectory.h
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFile.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFile.h
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCmbDiff.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCmbIdx.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCombine.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileDiff.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileEncodeStream.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileRevDiff.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFilename.cpp
   box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFilenameClear.cpp
   box/chris/win32/vc2005-compile-fixes/lib/common/BoxTimeToUnix.h
   box/chris/win32/vc2005-compile-fixes/lib/common/DebugMemLeakFinder.cpp
   box/chris/win32/vc2005-compile-fixes/lib/server/Daemon.cpp
   box/chris/win32/vc2005-compile-fixes/lib/server/LocalProcessStream.cpp
   box/chris/win32/vc2005-compile-fixes/lib/server/Protocol.cpp
   box/chris/win32/vc2005-compile-fixes/lib/server/Socket.cpp
   box/chris/win32/vc2005-compile-fixes/lib/server/SocketListen.h
   box/chris/win32/vc2005-compile-fixes/lib/server/SocketStream.cpp
   box/chris/win32/vc2005-compile-fixes/lib/server/SocketStreamTLS.cpp
   box/chris/win32/vc2005-compile-fixes/lib/win32/WinNamedPipeStream.cpp
   box/chris/win32/vc2005-compile-fixes/lib/win32/config.h.win32
   box/chris/win32/vc2005-compile-fixes/lib/win32/emu.cpp
   box/chris/win32/vc2005-compile-fixes/lib/win32/emu.h
Log:
Remaining Visual C++ 2005 compile fixes


Modified: box/chris/win32/vc2005-compile-fixes/bin/bbackupctl/bbackupctl.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/bin/bbackupctl/bbackupctl.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/bin/bbackupctl/bbackupctl.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -10,8 +10,11 @@
 #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"
@@ -212,7 +215,7 @@
 		// No? Just send the command given plus a quit command.
 		std::string cmd(argv[0]);
 		cmd += "\nquit\n";
-		connection.Write(cmd.c_str(), cmd.size());		
+		connection.Write(cmd.c_str(), (int)cmd.size());
 	}
 	
 	// Read the response

Modified: box/chris/win32/vc2005-compile-fixes/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/bin/bbackupd/BackupClientDirectoryRecord.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/bin/bbackupd/BackupClientDirectoryRecord.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -9,7 +9,10 @@
 
 #include "Box.h"
 
-#include <dirent.h>
+#ifdef HAVE_DIRENT_H
+	#include <dirent.h>
+#endif
+
 #include <errno.h>
 #include <string.h>
 
@@ -257,7 +260,7 @@
 				checksum_info.mAttributeModificationTime = FileAttrModificationTime(st);
 				checksum_info.mSize = st.st_size;
 				currentStateChecksum.Add(&checksum_info, sizeof(checksum_info));
-				currentStateChecksum.Add(en->d_name, strlen(en->d_name));
+				currentStateChecksum.Add(en->d_name, (int)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/vc2005-compile-fixes/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/bin/bbackupd/BackupDaemon.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/bin/bbackupd/BackupDaemon.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -10,8 +10,11 @@
 #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>
@@ -28,6 +31,9 @@
 	#include <cstdio>
 	#include <sys/mnttab.h>
 #endif
+#ifdef HAVE_PROCESS_H
+	#include <process.h>
+#endif
 
 #include "Configuration.h"
 #include "IOStream.h"
@@ -259,7 +265,7 @@
 				conf.GetKeyValueInt("MaxUploadWait"),
 				mState);
 
-			mpCommandSocketInfo->mListeningSocket.Write(summary, summarySize);
+			mpCommandSocketInfo->mListeningSocket.Write(summary, (int)summarySize);
 			mpCommandSocketInfo->mListeningSocket.Write("ping\n", 5);
 
 			IOStreamGetLine readLine(mpCommandSocketInfo->mListeningSocket);
@@ -314,7 +320,7 @@
 				{
 					const char* response = sendOK ? "ok\n" : "error\n";
 					mpCommandSocketInfo->mListeningSocket.Write(
-						response, strlen(response));
+						response, (int)strlen(response));
 				}
 
 				if (disconnect) 
@@ -508,7 +514,7 @@
 					{
 						// No command socket or connection, just do a normal sleep
 						time_t sleepSeconds = BoxTimeToSeconds(requiredDelay);
-						::sleep((sleepSeconds <= 0)?1:sleepSeconds);
+						::sleep((unsigned int)((sleepSeconds <= 0)?1:sleepSeconds));
 					}
 				}
 				
@@ -663,7 +669,8 @@
 				}
 				
 				// Calculate when the next sync run should be
-				nextSyncTime = currentSyncStartTime + updateStoreInterval + Random::RandomInt(updateStoreInterval >> SYNC_PERIOD_RANDOM_EXTRA_TIME_SHIFT_BY);
+				nextSyncTime = currentSyncStartTime + updateStoreInterval + 
+					Random::RandomInt((uint32_t)updateStoreInterval >> SYNC_PERIOD_RANDOM_EXTRA_TIME_SHIFT_BY);
 			
 				// Commit the ID Maps
 				CommitIDMapsAfterSync();
@@ -836,7 +843,7 @@
 #ifdef WIN32
 	// Really could use some interprocess protection, mutex etc
 	// any side effect should be too bad???? :)
-	DWORD timeout = BoxTimeToMilliSeconds(RequiredDelay);
+	DWORD timeout = (DWORD)BoxTimeToMilliSeconds(RequiredDelay);
 
 	while ( this->mReceivedCommandConn == false )
 	{
@@ -1087,7 +1094,7 @@
 		{
 #ifdef WIN32
 			mpCommandSocketInfo->mListeningSocket.Write(message, 
-				strlen(message));
+				(int)strlen(message));
 #else
 			mpCommandSocketInfo->mpConnectedSocket->Write(message,
 				strlen(message));
@@ -1684,7 +1691,9 @@
 	char newStateSize = sprintf(newState, "state %d\n", State);
 
 #ifdef WIN32
-	#warning FIX ME: race condition
+#ifndef _MSC_VER
+#warning FIX ME: race condition
+#endif
 	// 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/vc2005-compile-fixes/bin/bbackupd/Win32ServiceFunctions.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/bin/bbackupd/Win32ServiceFunctions.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/bin/bbackupd/Win32ServiceFunctions.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -14,10 +14,12 @@
 
 #include "Box.h"
 
-//#include <stdio.h>
-//#include <stdlib.h>
-#include <unistd.h>
-//#include <windows.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+#ifdef HAVE_PROCESS_H
+	#include <process.h>
+#endif
 
 extern void TerminateService(void);
 extern unsigned int WINAPI RunService(LPVOID lpParameter);
@@ -31,18 +33,23 @@
 
 #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 )
@@ -118,6 +125,8 @@
 			return;
 		}
 
+		ShowMessage("Starting...");
+
 		HANDLE ourThread = (HANDLE)_beginthreadex(
 			NULL,
 			0,
@@ -185,7 +194,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/vc2005-compile-fixes/bin/bbackupd/bbackupd.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/bin/bbackupd/bbackupd.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/bin/bbackupd/bbackupd.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -54,7 +54,7 @@
 		
 	WSADATA info;
 
-	if (WSAStartup(MAKELONG(1, 1), &info) == SOCKET_ERROR) 
+	if (WSAStartup(0x0101, &info) == SOCKET_ERROR) 
 	{
 		// box backup will not run without sockets
 		::syslog(LOG_ERR, "Failed to initialise Windows Sockets");

Modified: box/chris/win32/vc2005-compile-fixes/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/bin/bbackupquery/BackupQueries.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/bin/bbackupquery/BackupQueries.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -9,16 +9,22 @@
 
 #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"
@@ -1247,7 +1253,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>::const_iterator local(localFiles.find(i->first));
+			std::set<std::string>::iterator local(localFiles.find(i->first));
 			if(local == localFiles.end())
 			{
 				// Not found -- report
@@ -1415,7 +1421,7 @@
 		}
 		
 		// Report any files which exist on the locally, but not on the store
-		for(std::set<std::string>::const_iterator i = localFiles.begin(); i != localFiles.end(); ++i)
+		for(std::set<std::string>::iterator i = localFiles.begin(); i != localFiles.end(); ++i)
 		{
 			std::string localName(rLocalDir + DIRECTORY_SEPARATOR + *i);
 			// Should this be ignored (ie is excluded)?
@@ -1452,7 +1458,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>::const_iterator local(localDirs.find(i->first));
+			std::set<std::string>::iterator local(localDirs.find(i->first));
 			if(local == localDirs.end())
 			{
 				// Not found -- report

Modified: box/chris/win32/vc2005-compile-fixes/bin/bbackupquery/bbackupquery.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/bin/bbackupquery/bbackupquery.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/bin/bbackupquery/bbackupquery.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -9,7 +9,9 @@
 
 #include "Box.h"
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
 #include <stdio.h>
 #include <sys/types.h>
 #ifdef HAVE_LIBREADLINE
@@ -62,7 +64,7 @@
 	// Under Win32 we must initialise the Winsock library
 	// before using it.
 	
-	if (WSAStartup(MAKELONG(1, 1), &info) == SOCKET_ERROR) 
+	if (WSAStartup(0x0101, &info) == SOCKET_ERROR) 
 	{
 		// throw error?    perhaps give it its own id in the furture
 		THROW_EXCEPTION(BackupStoreException, Internal)

Modified: box/chris/win32/vc2005-compile-fixes/configure.ac
===================================================================
--- box/chris/win32/vc2005-compile-fixes/configure.ac	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/configure.ac	2005-12-21 03:11:48 UTC (rev 261)
@@ -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])
+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])
 
 
 ### 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])
+AC_CHECK_FUNCS([getpeereid kqueue lchown setproctitle getpid])
 AX_FUNC_SYSCALL
 AX_CHECK_SYSCALL_LSEEK
 

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientFileAttributes.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientFileAttributes.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientFileAttributes.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -9,10 +9,13 @@
 
 #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>
@@ -620,7 +623,7 @@
 		}
 #endif
 
-		xattrOffset += std::strlen(reinterpret_cast<char*>(pattr+1))+1;
+		xattrOffset += (int)std::strlen(reinterpret_cast<char*>(pattr+1))+1;
 	}
 	
 	// If working as root, set user IDs
@@ -974,7 +977,7 @@
 	MD5Digest digest;
 	digest.Add(&hashData, sizeof(hashData));
 	digest.Add(xattr.GetBuffer(), xattr.GetSize());
-	digest.Add(leafname.c_str(), leafname.size());
+	digest.Add(leafname.c_str(), (int)leafname.size());
 	digest.Add(sAttributeHashSecret, sAttributeHashSecretLength);
 	digest.Finish();
 	

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientRestore.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientRestore.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientRestore.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -9,11 +9,14 @@
 
 #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>
 
@@ -101,9 +104,9 @@
 			// ID
 			rWrite.Write(&mNextLevelID, sizeof(mNextLevelID));
 			// Name string
-			int32_t nsize = mNextLevelLocalName.size();
+			std::string::size_type nsize = mNextLevelLocalName.size();
 			rWrite.Write(&nsize, sizeof(nsize));
-			rWrite.Write(mNextLevelLocalName.c_str(), nsize);
+			rWrite.Write(mNextLevelLocalName.c_str(), (int)nsize);
 			// And then the level itself
 			mpNextLevel->SaveLevel(rWrite);
 		}

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreDirectory.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreDirectory.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreDirectory.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -192,7 +192,7 @@
 void BackupStoreDirectory::WriteToStream(IOStream &rStream, int16_t FlagsMustBeSet, int16_t FlagsNotToBeSet, bool StreamAttributes, bool StreamDependencyInfo) const
 {
 	// Get count of entries
-	int32_t count = mEntries.size();
+	std::vector<Entry*>::size_type count = mEntries.size();
 	if(FlagsMustBeSet != Entry::Flags_INCLUDE_EVERYTHING || FlagsNotToBeSet != Entry::Flags_EXCLUDE_NOTHING)
 	{
 		// Need to count the entries
@@ -230,7 +230,7 @@
 	// Build header
 	dir_StreamFormat hdr;
 	hdr.mMagicValue = htonl(OBJECTMAGIC_DIR_MAGIC_VALUE);
-	hdr.mNumEntries = htonl(count);
+	hdr.mNumEntries = htonl((u_long)count);
 	hdr.mObjectID = box_hton64(mObjectID);
 	hdr.mContainerID = box_hton64(mContainerID);
 	hdr.mAttributesModTime = box_hton64(mAttributesModTime);

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreDirectory.h
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreDirectory.h	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreDirectory.h	2005-12-21 03:11:48 UTC (rev 261)
@@ -146,7 +146,8 @@
 	int64_t GetRevisionID() const {return mRevisionID;}
 	void SetRevisionID(int64_t RevisionID) {mRevisionID = RevisionID;}
 	
-	unsigned int GetNumberOfEntries() const {return mEntries.size();}
+	unsigned int GetNumberOfEntries() const 
+		{return (unsigned int)mEntries.size();}
 
 	// User info -- not serialised into streams
 	int64_t GetUserInfo1_SizeInBlocks() const {return mUserInfo1;}

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFile.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFile.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFile.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -9,7 +9,10 @@
 
 #include "Box.h"
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <sys/stat.h>
 #include <string.h>
 #include <new>
@@ -519,21 +522,22 @@
 	if(mNumBlocks > 0)
 	{
 		// Find the maximum encoded data size
-		int32_t maxEncodedDataSize = 0;
+		uint64_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
-			int32_t encodedSize = box_ntoh64(entry[e].mEncodedSize);
+			uint64_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(maxEncodedDataSize + 32);
+		mpEncodedData = (uint8_t*)BackupStoreFile::CodingChunkAlloc((int)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
@@ -601,14 +605,15 @@
 		int64_t indexSize = sizeof(file_BlockIndexEntry) * mNumBlocks;
 		
 		// Allocate some memory
-		mpBlockIndex = ::malloc(indexSize);
+		mpBlockIndex = ::malloc((size_t)indexSize);
 		if(mpBlockIndex == 0)
 		{
 			throw std::bad_alloc();
 		}
 		
 		// Read it in
-		if(!mrEncodedFile.ReadFullBuffer(mpBlockIndex, indexSize, 0 /* not interested in bytes read if this fails */, mTimeout))
+		if(!mrEncodedFile.ReadFullBuffer(mpBlockIndex, (int)indexSize, 
+			0 /* not interested in bytes read if this fails */, mTimeout))
 		{
 			// Couldn't read header
 			THROW_EXCEPTION(BackupStoreException, WhenDecodingExpectedToReadButCouldnt)
@@ -675,7 +680,7 @@
 		
 			// Get the size from the block index
 			const file_BlockIndexEntry *entry = (file_BlockIndexEntry *)mpBlockIndex;
-			int32_t encodedSize = box_ntoh64(entry[mCurrentBlock].mEncodedSize);
+			uint64_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
@@ -685,14 +690,16 @@
 			}
 			
 			// Load in next block
-			if(!mrEncodedFile.ReadFullBuffer(mpEncodedData, encodedSize, 0 /* not interested in bytes read if this fails */, mTimeout))
+			if(!mrEncodedFile.ReadFullBuffer(mpEncodedData, (int)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, encodedSize, mpClearData, mClearDataSize);
+			mCurrentBlockClearSize = BackupStoreFile::DecodeChunk(mpEncodedData, 
+				(int)encodedSize, mpClearData, mClearDataSize);
 
 			// Calculate IV for this entry
 			uint64_t iv = mEntryIVBase;
@@ -931,7 +938,7 @@
 	}
 	
 	// Check alignment of the block
-	ASSERT((((uint32_t)(long)rOutput.mpBuffer) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+	ASSERT((((long long)rOutput.mpBuffer) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
 
 	// Want to compress it?
 	bool compressChunk = (ChunkSize >= BACKUP_FILE_MIN_COMPRESSED_CHUNK_SIZE);
@@ -1019,7 +1026,7 @@
 int BackupStoreFile::DecodeChunk(const void *Encoded, int EncodedSize, void *Output, int OutputSize)
 {
 	// Check alignment of the encoded block
-	ASSERT((((uint32_t)(long)Encoded) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+	ASSERT((((long long)Encoded) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
 
 	// First check
 	if(EncodedSize < 1)

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFile.h
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFile.h	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFile.h	2005-12-21 03:11:48 UTC (rev 261)
@@ -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)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE);
+							  - (uint8_t)(((unsigned long 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)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+		ASSERT((uint8_t)(((unsigned long long)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
 		uint8_t *a = (uint8_t*)Block;
 		a -= BACKUPSTOREFILE_CODING_OFFSET;
 		// Adjust downwards...

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCmbDiff.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCmbDiff.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCmbDiff.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -79,7 +79,7 @@
 	}
 	int64_t diff1NumBlocks = box_ntoh64(diff1IdxHdr.mNumBlocks);
 	// Allocate some memory
-	int64_t *diff1BlockStartPositions = (int64_t*)::malloc((diff1NumBlocks + 1) * sizeof(int64_t));
+	int64_t *diff1BlockStartPositions = (int64_t*)::malloc(((size_t)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 = blockIndex + 1;
+					int nb = (int)blockIndex + 1;
 					while(diff1BlockStartPositions[nb] <= 0)
 					{
 						// This is safe, because the last entry will terminate it properly!
 						++nb;
 						ASSERT(nb <= diff1NumBlocks);
 					}
-					copySize = diff1BlockStartPositions[nb] - copyFrom;
+					copySize = (int)(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 = blockIndex + 1;
+					int nb = (int)blockIndex + 1;
 					while(diff1BlockStartPositions[nb] <= 0)
 					{
 						// This is safe, because the last entry will terminate it properly!

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCmbIdx.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCmbIdx.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCmbIdx.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -174,7 +174,7 @@
 	
 	// Then... allocate memory for the list of sizes
 	mNumEntriesInFromFile = box_ntoh64(fromHdr.mNumBlocks);
-	mFromBlockSizes = (int64_t*)::malloc(mNumEntriesInFromFile * sizeof(int64_t));
+	mFromBlockSizes = (int64_t*)::malloc((size_t)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 = mNumEntriesToGo;
+		entriesToWrite = (int)mNumEntriesToGo;
 	}
 	
 	// Setup ready to go
@@ -256,7 +256,7 @@
 		}
 		
 		// Does this need adjusting?
-		int s = box_ntoh64(poutput[b].mEncodedSize);
+		int s = (int)box_ntoh64(poutput[b].mEncodedSize);
 		if(s <= 0)
 		{
 			// A reference to a block in the from file

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCombine.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCombine.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileCombine.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -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((fromNumBlocks+1) * sizeof(FromIndexEntry));
+	FromIndexEntry *pFromIndex = (FromIndexEntry*)::malloc(((int)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 = encodedSize;
+				blockSize = (int32_t)encodedSize;
 			}
 			else
 			{
@@ -264,7 +264,9 @@
 					THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
 				}
 				// Calculate size. This operation is safe because of the extra entry at the end
-				blockSize = pFromIndex[blockIdx + 1].mFilePosition - pFromIndex[blockIdx].mFilePosition;
+				blockSize = (int32_t)( 
+					pFromIndex[blockIdx + 1].mFilePosition -
+					pFromIndex[blockIdx].mFilePosition );
 			}
 			ASSERT(blockSize > 0);
 			
@@ -394,7 +396,9 @@
 				THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
 			}
 			// Calculate size. This operation is safe because of the extra entry at the end
-			int32_t blockSize = pFromIndex[blockIdx + 1].mFilePosition - pFromIndex[blockIdx].mFilePosition;
+			int32_t blockSize = (int32_t)( 
+				pFromIndex[blockIdx + 1].mFilePosition - 
+				pFromIndex[blockIdx].mFilePosition );
 			// Then replace entry
 			en.mEncodedSize = box_hton64(((uint64_t)blockSize));
 		}

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileDiff.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileDiff.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileDiff.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -317,7 +317,7 @@
 	//TODO: Verify that these sizes look reasonable
 	
 	// Allocate space for the index
-	BlocksAvailableEntry *pindex = (BlocksAvailableEntry*)::malloc(sizeof(BlocksAvailableEntry) * numBlocks);
+	BlocksAvailableEntry *pindex = (BlocksAvailableEntry*)::malloc(sizeof(BlocksAvailableEntry) * (size_t)numBlocks);
 	if(pindex == 0)
 	{
 		throw std::bad_alloc();

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileEncodeStream.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileEncodeStream.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileEncodeStream.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -270,7 +270,7 @@
 	} while(rBlockSizeOut <= BACKUP_FILE_MAX_BLOCK_SIZE && rNumBlocksOut > BACKUP_FILE_INCREASE_BLOCK_SIZE_AFTER);
 	
 	// Last block size
-	rLastBlockSizeOut = DataSize - ((rNumBlocksOut - 1) * rBlockSizeOut);
+	rLastBlockSizeOut = (int32_t)(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 = mpRecipe->BlockPtrToIndex((*mpRecipe)[mInstructionNumber].mpStartBlock);
+	int firstIndex = (int)mpRecipe->BlockPtrToIndex((*mpRecipe)[mInstructionNumber].mpStartBlock);
 	
 	int64_t sizeToSkip = 0;
 

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileRevDiff.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileRevDiff.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFileRevDiff.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -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(fromNumBlocks * sizeof(int64_t));
+	int64_t *pfromIndexInfo = (int64_t*)::malloc((size_t)fromNumBlocks * sizeof(int64_t));
 	if(pfromIndexInfo == 0)
 	{
 		throw std::bad_alloc();
@@ -176,21 +176,21 @@
 						bufferSize = 0;
 					}
 					// Allocate new block
-					buffer = ::malloc(blockSize);
+					buffer = ::malloc((size_t)blockSize);
 					if(buffer == 0)
 					{
 						throw std::bad_alloc();
 					}
-					bufferSize = blockSize;
+					bufferSize = (int)blockSize;
 				}
 				ASSERT(bufferSize >= blockSize);
 				
 				// Copy the block
-				if(!rFrom.ReadFullBuffer(buffer, blockSize, 0))
+				if(!rFrom.ReadFullBuffer(buffer, (int)blockSize, 0))
 				{
 					THROW_EXCEPTION(BackupStoreException, FailedToReadBlockOnCombine)
 				}
-				rOut.Write(buffer, blockSize);
+				rOut.Write(buffer, (int)blockSize);
 
 				// Store the size
 				pfromIndexInfo[b] = blockSize;

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFilename.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFilename.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFilename.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -141,7 +141,7 @@
 {
 	CheckValid();
 	
-	rProtocol.Write(c_str(), size());
+	rProtocol.Write(c_str(), (int)size());
 }
 
 // --------------------------------------------------------------------------
@@ -216,7 +216,7 @@
 {
 	CheckValid();
 	
-	rStream.Write(c_str(), size());
+	rStream.Write(c_str(), (int)size());
 }
 
 // --------------------------------------------------------------------------

Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFilenameClear.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFilenameClear.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupStoreFilenameClear.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -218,7 +218,7 @@
 void BackupStoreFilenameClear::EncryptClear(const std::string &rToEncode, CipherContext &rCipherContext, int StoreAsEncoding)
 {
 	// Work out max size
-	int maxOutSize = rCipherContext.MaxOutSizeForInBufferSize(rToEncode.size()) + 4;
+	int maxOutSize = rCipherContext.MaxOutSizeForInBufferSize((int)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(), rToEncode.size());
+	int encSize = rCipherContext.TransformBlock(buffer + 2, sEncDecBufferSize - 2, rToEncode.c_str(), (int)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(size()) + 4;
+	int maxOutSize = rCipherContext.MaxOutSizeForInBufferSize((int)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, size() - 2);
+	int sizeOut = rCipherContext.TransformBlock(buffer, sEncDecBufferSize, str, (int)size() - 2);
 	
 	// Assign to this
 	mClearFilename.assign((char*)buffer, sizeOut);

Modified: box/chris/win32/vc2005-compile-fixes/lib/common/BoxTimeToUnix.h
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/common/BoxTimeToUnix.h	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/common/BoxTimeToUnix.h	2005-12-21 03:11:48 UTC (rev 261)
@@ -26,7 +26,7 @@
 
 inline void BoxTimeToTimespec(box_time_t Time, struct timespec &tv)
 {
-	tv.tv_sec = (time_t)(Time / MICRO_SEC_IN_SEC_LL);
+	tv.tv_sec = (long)(Time / MICRO_SEC_IN_SEC_LL);
 	tv.tv_nsec = ((long)(Time % MICRO_SEC_IN_SEC_LL)) * NANO_SEC_IN_USEC;
 }
 

Modified: box/chris/win32/vc2005-compile-fixes/lib/common/DebugMemLeakFinder.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/common/DebugMemLeakFinder.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/common/DebugMemLeakFinder.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -274,7 +274,11 @@
 	{
 		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/vc2005-compile-fixes/lib/server/Daemon.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/server/Daemon.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/server/Daemon.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -9,8 +9,11 @@
 
 #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/vc2005-compile-fixes/lib/server/LocalProcessStream.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/server/LocalProcessStream.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/server/LocalProcessStream.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -9,11 +9,14 @@
 
 #include "Box.h"
 
-#ifndef WIN32
-#include <sys/socket.h>
+#ifdef HAVE_SYS_SOCKET_H
+	#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/vc2005-compile-fixes/lib/server/Protocol.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/server/Protocol.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/server/Protocol.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -638,7 +638,7 @@
 	Write((int32_t)(rValue.size()));
 	
 	WRITE_ENSURE_BYTES_AVAILABLE(rValue.size())
-	Write(rValue.c_str(), rValue.size());
+	Write(rValue.c_str(), (int)rValue.size());
 }
 
 // --------------------------------------------------------------------------
@@ -706,11 +706,11 @@
 	}
 	
 	// Inform sub class
-	InformStreamSending(streamSize);
+	InformStreamSending((u_int32_t)streamSize);
 	
 	// Make header
 	PW_ObjectHeader objHeader;
-	objHeader.mObjSize = htonl(uncertainSize?(ProtocolStream_SizeUncertain):streamSize);
+	objHeader.mObjSize = htonl((u_long)(uncertainSize?(ProtocolStream_SizeUncertain):streamSize));
 	objHeader.mObjType = htonl(SPECIAL_STREAM_OBJECT_TYPE);
 
 	// Write header

Modified: box/chris/win32/vc2005-compile-fixes/lib/server/Socket.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/server/Socket.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/server/Socket.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -9,7 +9,10 @@
 
 #include "Box.h"
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <sys/types.h>
 #ifndef WIN32
 #include <sys/socket.h>

Modified: box/chris/win32/vc2005-compile-fixes/lib/server/SocketListen.h
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/server/SocketListen.h	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/server/SocketListen.h	2005-12-21 03:11:48 UTC (rev 261)
@@ -11,8 +11,11 @@
 #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/vc2005-compile-fixes/lib/server/SocketStream.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/server/SocketStream.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/server/SocketStream.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -9,7 +9,10 @@
 
 #include "Box.h"
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <sys/types.h>
 #include <errno.h>
 
@@ -67,7 +70,7 @@
 //
 // --------------------------------------------------------------------------
 SocketStream::SocketStream(const SocketStream &rToCopy)
-	: mSocketHandle(::dup(rToCopy.mSocketHandle)),
+	: mSocketHandle(::dup((int)rToCopy.mSocketHandle)),
 	  mReadClosed(rToCopy.mReadClosed),
 	  mWriteClosed(rToCopy.mWriteClosed)
 

Modified: box/chris/win32/vc2005-compile-fixes/lib/server/SocketStreamTLS.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/server/SocketStreamTLS.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/server/SocketStreamTLS.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -125,7 +125,7 @@
 	}
 
 	tOSSocketHandle socket = GetSocketHandle();
-	BIO_set_fd(mpBIO, socket, BIO_NOCLOSE);
+	BIO_set_fd(mpBIO, (int)socket, BIO_NOCLOSE);
 	
 	// Then the SSL object
 	mpSSL = ::SSL_new(rContext.GetRawContext());

Modified: box/chris/win32/vc2005-compile-fixes/lib/win32/WinNamedPipeStream.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/win32/WinNamedPipeStream.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/win32/WinNamedPipeStream.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -11,7 +11,10 @@
 
 #ifdef WIN32
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <sys/types.h>
 #include <errno.h>
 #include <windows.h>

Modified: box/chris/win32/vc2005-compile-fixes/lib/win32/config.h.win32
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/win32/config.h.win32	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/win32/config.h.win32	2005-12-21 03:11:48 UTC (rev 261)
@@ -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,6 +120,8 @@
 /* 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/vc2005-compile-fixes/lib/win32/emu.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/win32/emu.cpp	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/win32/emu.cpp	2005-12-21 03:11:48 UTC (rev 261)
@@ -12,11 +12,18 @@
 #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
@@ -343,7 +350,7 @@
 	// This next example is how we get our INODE (equivalent) information
 	conv.HighPart = fi.nFileIndexHigh;
 	conv.LowPart = fi.nFileIndexLow;
-	st->st_ino = conv.QuadPart;
+	st->st_ino = (_ino_t)conv.QuadPart;
 
 	// get the time information
 	st->st_ctime = ConvertFileTimeToTime_t(&fi.ftCreationTime);
@@ -362,7 +369,7 @@
 
 	conv.HighPart = st_size.HighPart;
 	conv.LowPart = st_size.LowPart;
-	st->st_size = conv.QuadPart;
+	st->st_size = (_off_t)conv.QuadPart;
 
 	//the mode of the file
 	st->st_mode = 0;
@@ -878,7 +885,7 @@
 
 void syslog(int loglevel, const char *frmt, ...)
 {
-	DWORD errinfo;
+	WORD errinfo;
 	char* buffer;
 	std::string sixfour(frmt);
 
@@ -905,7 +912,7 @@
 
 
 		int sixfourpos;
-		while ( ( sixfourpos = sixfour.find("%ll")) != -1 )
+		while ( (sixfourpos = (int)sixfour.find("%ll")) != -1 )
 		{
 			//maintain portability - change the 64 bit formater...
 			std::string temp = sixfour.substr(0,sixfourpos);

Modified: box/chris/win32/vc2005-compile-fixes/lib/win32/emu.h
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/win32/emu.h	2005-12-21 00:43:31 UTC (rev 260)
+++ box/chris/win32/vc2005-compile-fixes/lib/win32/emu.h	2005-12-21 03:11:48 UTC (rev 261)
@@ -39,6 +39,11 @@
 #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);
@@ -116,7 +121,7 @@
 	return 0;
 }
 
-inline int chmod(const char * Filename, int uid)
+inline int _chmod(const char * Filename, int uid)
 {
 	//indicate sucsess
 	return 0;
@@ -252,9 +257,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