summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/backupstore/BackupAccountControl.h5
-rw-r--r--lib/backupstore/BackupClientFileAttributes.cpp6
-rw-r--r--lib/backupstore/BackupProtocol.txt (renamed from lib/backupstore/backupprotocol.txt)0
-rw-r--r--lib/backupstore/BackupStoreFileDiff.cpp2
-rw-r--r--lib/backupstore/HousekeepStoreAccount.cpp2
-rw-r--r--lib/backupstore/Makefile.extra4
-rw-r--r--lib/bbackupquery/Documentation.txt (renamed from lib/bbackupquery/documentation.txt)0
-rw-r--r--lib/bbackupquery/Makefile.extra2
-rwxr-xr-xlib/bbackupquery/makedocumentation.pl.in2
-rw-r--r--lib/common/BoxConfig-MSVC.h9
-rw-r--r--lib/common/BoxPlatform.h33
-rw-r--r--lib/common/DebugMemLeakFinder.cpp12
-rw-r--r--lib/common/ExcludeList.cpp8
-rw-r--r--lib/common/Logging.cpp14
-rw-r--r--lib/common/RateLimitingStream.h2
-rw-r--r--lib/common/Test.h16
-rw-r--r--lib/common/Utils.cpp27
-rw-r--r--lib/server/Daemon.cpp13
-rw-r--r--lib/server/TcpNice.cpp4
-rw-r--r--lib/win32/emu.cpp9
-rw-r--r--lib/win32/emu.h10
21 files changed, 79 insertions, 101 deletions
diff --git a/lib/backupstore/BackupAccountControl.h b/lib/backupstore/BackupAccountControl.h
index bc041794..00118ec2 100644
--- a/lib/backupstore/BackupAccountControl.h
+++ b/lib/backupstore/BackupAccountControl.h
@@ -14,7 +14,6 @@
#include "BackupStoreAccountDatabase.h"
#include "HTTPResponse.h"
-#include "NamedLock.h"
#include "S3Client.h"
class BackupStoreDirectory;
@@ -42,14 +41,12 @@ public:
class S3BackupFileSystem
{
private:
- const Configuration& mConfig;
std::string mBasePath;
S3Client& mrClient;
public:
S3BackupFileSystem(const Configuration& config, const std::string& BasePath,
S3Client& rClient)
- : mConfig(config),
- mBasePath(BasePath),
+ : mBasePath(BasePath),
mrClient(rClient)
{ }
std::string GetDirectoryURI(int64_t ObjectID);
diff --git a/lib/backupstore/BackupClientFileAttributes.cpp b/lib/backupstore/BackupClientFileAttributes.cpp
index 7ec6f478..37140301 100644
--- a/lib/backupstore/BackupClientFileAttributes.cpp
+++ b/lib/backupstore/BackupClientFileAttributes.cpp
@@ -545,7 +545,7 @@ void BackupClientFileAttributes::FillAttributesLink(
void BackupClientFileAttributes::FillExtendedAttr(StreamableMemBlock &outputBlock,
const std::string& Filename)
{
-#ifdef HAVE_SYS_XATTR_H
+#if defined HAVE_LLISTXATTR && defined HAVE_LGETXATTR
int listBufferSize = 10000;
char* list = new char[listBufferSize];
@@ -693,7 +693,7 @@ void BackupClientFileAttributes::FillExtendedAttr(StreamableMemBlock &outputBloc
throw;
}
delete[] list;
-#endif
+#endif // defined HAVE_LLISTXATTR && defined HAVE_LGETXATTR
}
// --------------------------------------------------------------------------
@@ -992,7 +992,7 @@ void BackupClientFileAttributes::EnsureClearAvailable() const
// --------------------------------------------------------------------------
void BackupClientFileAttributes::WriteExtendedAttr(const std::string& Filename, int xattrOffset) const
{
-#ifdef HAVE_SYS_XATTR_H
+#if defined HAVE_LSETXATTR
const char* buffer = static_cast<char*>(mpClearAttributes->GetBuffer());
uint32_t xattrBlockLength = 0;
diff --git a/lib/backupstore/backupprotocol.txt b/lib/backupstore/BackupProtocol.txt
index 5921d009..5921d009 100644
--- a/lib/backupstore/backupprotocol.txt
+++ b/lib/backupstore/BackupProtocol.txt
diff --git a/lib/backupstore/BackupStoreFileDiff.cpp b/lib/backupstore/BackupStoreFileDiff.cpp
index 1d83d854..e6df11a6 100644
--- a/lib/backupstore/BackupStoreFileDiff.cpp
+++ b/lib/backupstore/BackupStoreFileDiff.cpp
@@ -16,7 +16,7 @@
#ifdef HAVE_TIME_H
#include <time.h>
-#elif HAVE_SYS_TIME_H
+#elif defined HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
diff --git a/lib/backupstore/HousekeepStoreAccount.cpp b/lib/backupstore/HousekeepStoreAccount.cpp
index f24d7227..d5acf62c 100644
--- a/lib/backupstore/HousekeepStoreAccount.cpp
+++ b/lib/backupstore/HousekeepStoreAccount.cpp
@@ -932,7 +932,7 @@ void HousekeepStoreAccount::UpdateDirectorySize(
BackupStoreDirectory& rDirectory,
IOStream::pos_type new_size_in_blocks)
{
-#ifndef NDEBUG
+#ifndef BOX_RELEASE_BUILD
{
std::string dirFilename;
MakeObjectFilename(rDirectory.GetObjectID(), dirFilename);
diff --git a/lib/backupstore/Makefile.extra b/lib/backupstore/Makefile.extra
index c55fd549..6f181abd 100644
--- a/lib/backupstore/Makefile.extra
+++ b/lib/backupstore/Makefile.extra
@@ -1,9 +1,9 @@
MAKEPROTOCOL = ../../lib/server/makeprotocol.pl
-GEN_CMD = $(MAKEPROTOCOL) backupprotocol.txt
+GEN_CMD = $(MAKEPROTOCOL) BackupProtocol.txt
# AUTOGEN SEEDING
-autogen_BackupProtocol.cpp autogen_BackupProtocol.h: $(MAKEPROTOCOL) backupprotocol.txt
+autogen_BackupProtocol.cpp autogen_BackupProtocol.h: $(MAKEPROTOCOL) BackupProtocol.txt
$(_PERL) $(GEN_CMD)
diff --git a/lib/bbackupquery/documentation.txt b/lib/bbackupquery/Documentation.txt
index b16a6f7c..b16a6f7c 100644
--- a/lib/bbackupquery/documentation.txt
+++ b/lib/bbackupquery/Documentation.txt
diff --git a/lib/bbackupquery/Makefile.extra b/lib/bbackupquery/Makefile.extra
index e1049b6d..5d37c09f 100644
--- a/lib/bbackupquery/Makefile.extra
+++ b/lib/bbackupquery/Makefile.extra
@@ -1,6 +1,6 @@
# AUTOGEN SEEDING
-autogen_Documentation.cpp: makedocumentation.pl documentation.txt
+autogen_Documentation.cpp: makedocumentation.pl Documentation.txt
$(_PERL) makedocumentation.pl
diff --git a/lib/bbackupquery/makedocumentation.pl.in b/lib/bbackupquery/makedocumentation.pl.in
index 530c4ff6..503ac9c8 100755
--- a/lib/bbackupquery/makedocumentation.pl.in
+++ b/lib/bbackupquery/makedocumentation.pl.in
@@ -3,7 +3,7 @@ use strict;
print "Creating built-in documentation for bbackupquery...\n";
-open DOC,"documentation.txt" or die "Can't open documentation.txt file";
+open DOC, "Documentation.txt" or die "Can't open Documentation.txt file: $!";
my $section;
my %help;
my @in_order;
diff --git a/lib/common/BoxConfig-MSVC.h b/lib/common/BoxConfig-MSVC.h
index 82ab4997..2ec2edd7 100644
--- a/lib/common/BoxConfig-MSVC.h
+++ b/lib/common/BoxConfig-MSVC.h
@@ -2,9 +2,6 @@
/* lib/common/BoxConfig.h.in. Generated from configure.ac by autoheader. */
/* Hacked by hand to work for MSVC by Chris Wilson */
-// using std::min/max
-#define NOMINMAX
-
/* Define to major version for BDB_VERSION */
/* #undef BDB_VERSION_MAJOR */
@@ -389,9 +386,6 @@
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
-/* Define to `int' if <sys/types.h> doesn't define. */
-#define gid_t int
-
/* Define to `int' if <sys/types.h> does not define. */
/* #undef mode_t */
@@ -403,6 +397,3 @@
/* Define to `unsigned' if <sys/types.h> does not define. */
/* #undef size_t */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#define uid_t int
diff --git a/lib/common/BoxPlatform.h b/lib/common/BoxPlatform.h
index 35ad7a2c..f7c74bfc 100644
--- a/lib/common/BoxPlatform.h
+++ b/lib/common/BoxPlatform.h
@@ -21,11 +21,13 @@
#define PLATFORM_DEV_NULL "/dev/null"
-#ifdef _MSC_VER
-#include "BoxConfig-MSVC.h"
-#define NEED_BOX_VERSION_H
+#if defined BOX_CMAKE
+# include "BoxConfig.cmake.h"
+#elif defined _MSC_VER
+# include "BoxConfig-MSVC.h"
+# define NEED_BOX_VERSION_H
#else
-#include "BoxConfig.h"
+# include "BoxConfig.h"
#endif
#ifdef WIN32
@@ -96,16 +98,19 @@
#endif
// Handle differing xattr APIs
-#ifdef HAVE_SYS_XATTR_H
- #if !defined(HAVE_LLISTXATTR) && defined(HAVE_LISTXATTR) && HAVE_DECL_XATTR_NOFOLLOW
- #define llistxattr(a,b,c) listxattr(a,b,c,XATTR_NOFOLLOW)
- #endif
- #if !defined(HAVE_LGETXATTR) && defined(HAVE_GETXATTR) && HAVE_DECL_XATTR_NOFOLLOW
- #define lgetxattr(a,b,c,d) getxattr(a,b,c,d,0,XATTR_NOFOLLOW)
- #endif
- #if !defined(HAVE_LSETXATTR) && defined(HAVE_SETXATTR) && HAVE_DECL_XATTR_NOFOLLOW
- #define lsetxattr(a,b,c,d,e) setxattr(a,b,c,d,0,(e)|XATTR_NOFOLLOW)
- #endif
+#if !defined(HAVE_LLISTXATTR) && defined(HAVE_LISTXATTR) && HAVE_DECL_XATTR_NOFOLLOW
+ #define llistxattr(a,b,c) listxattr(a,b,c,XATTR_NOFOLLOW)
+ #define HAVE_LLISTXATTR
+#endif
+
+#if !defined(HAVE_LGETXATTR) && defined(HAVE_GETXATTR) && HAVE_DECL_XATTR_NOFOLLOW
+ #define lgetxattr(a,b,c,d) getxattr(a,b,c,d,0,XATTR_NOFOLLOW)
+ #define HAVE_LGETXATTR
+#endif
+
+#if !defined(HAVE_LSETXATTR) && defined(HAVE_SETXATTR) && HAVE_DECL_XATTR_NOFOLLOW
+ #define lsetxattr(a,b,c,d,e) setxattr(a,b,c,d,0,(e)|XATTR_NOFOLLOW)
+ #define HAVE_LSETXATTR
#endif
#if !HAVE_DECL_INFTIM
diff --git a/lib/common/DebugMemLeakFinder.cpp b/lib/common/DebugMemLeakFinder.cpp
index 81e999c4..58a82c0e 100644
--- a/lib/common/DebugMemLeakFinder.cpp
+++ b/lib/common/DebugMemLeakFinder.cpp
@@ -15,15 +15,19 @@
#undef realloc
#undef free
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
+#ifdef HAVE_PROCESS_H
+# include <process.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#include <cstdlib> // for std::atexit
#include <map>
#include <set>
diff --git a/lib/common/ExcludeList.cpp b/lib/common/ExcludeList.cpp
index f101782a..3f9f69ee 100644
--- a/lib/common/ExcludeList.cpp
+++ b/lib/common/ExcludeList.cpp
@@ -10,9 +10,9 @@
#include "Box.h"
#ifdef HAVE_REGEX_SUPPORT
- #ifdef HAVE_PCREPOSIX_H
+ #if defined HAVE_PCREPOSIX_H
#include <pcreposix.h>
- #else
+ #elif defined HAVE_REGEX_H
#include <regex.h>
#endif
#define EXCLUDELIST_IMPLEMENTATION_REGEX_T_DEFINED
@@ -199,11 +199,9 @@ void ExcludeList::AddRegexEntries(const std::string &rEntries)
{
char buf[1024];
regerror(errcode, pregex, buf, sizeof(buf));
- BOX_LOG_CATEGORY(Log::ERROR,
- ConfigurationVerify::VERIFY_ERROR,
+ THROW_EXCEPTION_MESSAGE(CommonException, BadRegularExpression,
"Invalid regular expression: " <<
entry << ": " << buf);
- THROW_EXCEPTION(CommonException, BadRegularExpression)
}
// Store in list of regular expressions
diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp
index a0d1ec8c..0928a4d4 100644
--- a/lib/common/Logging.cpp
+++ b/lib/common/Logging.cpp
@@ -13,19 +13,19 @@
#include <time.h>
#include <string.h> // for stderror
-// c.f. http://bugs.debian.org/512510
-#include <cstdio>
+#ifdef HAVE_PROCESS_H
+# include <process.h>
+#endif
#ifdef HAVE_SYSLOG_H
- #include <syslog.h>
+# include <syslog.h>
#endif
+
#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-#ifdef WIN32
- #include <process.h>
+# include <unistd.h>
#endif
+#include <cstdio>
#include <cstring>
#include <iomanip>
diff --git a/lib/common/RateLimitingStream.h b/lib/common/RateLimitingStream.h
index cd9d8271..818c90af 100644
--- a/lib/common/RateLimitingStream.h
+++ b/lib/common/RateLimitingStream.h
@@ -33,7 +33,7 @@ public:
virtual void Write(const void *pBuffer, int NBytes,
int Timeout = IOStream::TimeOutInfinite)
{
- Write(pBuffer, NBytes, Timeout);
+ mrSink.Write(pBuffer, NBytes, Timeout);
}
virtual pos_type BytesLeftToRead()
{
diff --git a/lib/common/Test.h b/lib/common/Test.h
index 36cd6a59..4b5cef61 100644
--- a/lib/common/Test.h
+++ b/lib/common/Test.h
@@ -243,12 +243,14 @@ void safe_sleep(int seconds);
std::auto_ptr<Configuration> load_config_file(const std::string& config_file,
const ConfigurationVerify& verify);
-#ifdef _MSC_VER
- // Our CMakeFiles compile tests to different executable filenames,
- // e.g. test_common.exe instead of _test.exe.
- #define TEST_EXECUTABLE BOX_MODULE ".exe"
-#else
- #define TEST_EXECUTABLE "./_test"
-#endif
+#ifndef TEST_EXECUTABLE
+# ifdef _MSC_VER
+ // Our CMakeFiles compile tests to different executable filenames,
+ // e.g. test_common.exe instead of _test.exe.
+ #define TEST_EXECUTABLE BOX_MODULE ".exe"
+# else
+ #define TEST_EXECUTABLE "./_test"
+# endif
+#endif // TEST_EXECUTABLE
#endif // TEST__H
diff --git a/lib/common/Utils.cpp b/lib/common/Utils.cpp
index 4325dd88..0915f29a 100644
--- a/lib/common/Utils.cpp
+++ b/lib/common/Utils.cpp
@@ -381,30 +381,3 @@ std::string FormatUsageLineStart(const std::string& rName,
return result.str();
}
-std::string BoxGetTemporaryDirectoryName()
-{
-#ifdef WIN32
- // http://msdn.microsoft.com/library/default.asp?
- // url=/library/en-us/fileio/fs/creating_and_using_a_temporary_file.asp
-
- DWORD dwRetVal;
- char lpPathBuffer[1024];
- DWORD dwBufSize = sizeof(lpPathBuffer);
-
- // Get the temp path.
- dwRetVal = GetTempPath(dwBufSize, // length of the buffer
- lpPathBuffer); // buffer for path
- if (dwRetVal > dwBufSize)
- {
- THROW_EXCEPTION(CommonException, TempDirPathTooLong)
- }
-
- return std::string(lpPathBuffer);
-#elif defined TEMP_DIRECTORY_NAME
- return std::string(TEMP_DIRECTORY_NAME);
-#else
- #error non-static temporary directory names not supported yet
-#endif
-}
-
-
diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp
index 836948bf..d3c8441f 100644
--- a/lib/server/Daemon.cpp
+++ b/lib/server/Daemon.cpp
@@ -9,16 +9,20 @@
#include "Box.h"
-#ifdef HAVE_UNISTD_H
- #include <unistd.h>
-#endif
-
#include <errno.h>
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <stdarg.h>
+#ifdef HAVE_PROCESS_H
+# include <process.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#ifdef HAVE_BSD_UNISTD_H
#include <bsd/unistd.h>
#endif
@@ -26,7 +30,6 @@
#ifdef WIN32
#include <Strsafe.h>
#include <ws2tcpip.h>
- #include <process.h>
#endif
#include "depot.h"
diff --git a/lib/server/TcpNice.cpp b/lib/server/TcpNice.cpp
index 40e7a6b5..79e91eeb 100644
--- a/lib/server/TcpNice.cpp
+++ b/lib/server/TcpNice.cpp
@@ -146,7 +146,7 @@ void NiceSocketStream::Write(const void *pBuffer, int NBytes)
int socket = mapSocket->GetSocketHandle();
int rtt = 50; // WAG
-# if HAVE_DECL_SOL_TCP && HAVE_DECL_TCP_INFO && HAVE_STRUCT_TCP_INFO_TCPI_RTT
+# if HAVE_DECL_SOL_TCP && defined HAVE_STRUCT_TCP_INFO_TCPI_RTT
struct tcp_info info;
socklen_t optlen = sizeof(info);
if(getsockopt(socket, SOL_TCP, TCP_INFO, &info, &optlen) == -1)
@@ -164,7 +164,7 @@ void NiceSocketStream::Write(const void *pBuffer, int NBytes)
{
rtt = info.tcpi_rtt;
}
-# endif
+# endif // HAVE_DECL_SOL_TCP && defined HAVE_STRUCT_TCP_INFO_TCPI_RTT
int newWindow = mTcpNice.GetNextWindowSize(mBytesWrittenThisPeriod,
elapsed, rtt);
diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp
index c78fe6b2..1f6392d5 100644
--- a/lib/win32/emu.cpp
+++ b/lib/win32/emu.cpp
@@ -1313,7 +1313,7 @@ int poll (struct pollfd *ufds, unsigned long nfds, int timeout)
BOOL AddEventSource
(
- LPTSTR pszSrcName, // event source name
+ const std::string& name, // event source name
DWORD dwNum // number of categories
)
{
@@ -1335,7 +1335,7 @@ BOOL AddEventSource
std::string regkey("SYSTEM\\CurrentControlSet\\Services\\EventLog\\"
"Application\\");
- regkey += pszSrcName;
+ regkey += name;
HKEY hk;
DWORD dwDisp;
@@ -1448,10 +1448,7 @@ void openlog(const char * daemonName, int, int)
gSyslogH = INVALID_HANDLE_VALUE;
}
- char* name = strdup(nameStr.c_str());
- BOOL success = AddEventSource(name, 0);
- free(name);
-
+ BOOL success = AddEventSource(nameStr, 0);
if (!success)
{
::syslog(LOG_ERR, "Failed to add our own event source");
diff --git a/lib/win32/emu.h b/lib/win32/emu.h
index b8539bb6..91793004 100644
--- a/lib/win32/emu.h
+++ b/lib/win32/emu.h
@@ -18,7 +18,9 @@
#define EMU_INCLUDE
// Need feature detection macros below
-#ifdef _MSC_VER
+#if defined BOX_CMAKE
+# include "../common/BoxConfig.cmake.h"
+#elif defined _MSC_VER
# include "../common/BoxConfig-MSVC.h"
# define NEED_BOX_VERSION_H
#else
@@ -39,8 +41,14 @@
#ifndef __MINGW32__
typedef unsigned int mode_t;
typedef unsigned int pid_t;
+ typedef unsigned int uid_t;
+ typedef unsigned int gid_t;
#endif
+// Disable Windows' non-standard implementation of min() and max():
+// http://stackoverflow.com/a/5004874/648162
+#define NOMINMAX
+
// Windows headers
#include <winsock2.h>