diff options
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/framing/Uuid.h | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/LockFile.h | 9 | ||||
| -rwxr-xr-x | cpp/src/qpid/sys/windows/LockFile.cpp | 6 |
3 files changed, 10 insertions, 8 deletions
diff --git a/cpp/src/qpid/framing/Uuid.h b/cpp/src/qpid/framing/Uuid.h index fe0c32dc0b..b595a2ff42 100644 --- a/cpp/src/qpid/framing/Uuid.h +++ b/cpp/src/qpid/framing/Uuid.h @@ -58,8 +58,9 @@ struct Uuid : public boost::array<uint8_t, 16> { void clear() { uuid_clear(c_array()); } /** Test for null (all zeros). */ + // Force int 0/!0 to false/true; avoids compile warnings. bool isNull() { - return uuid_is_null(data()); + return !!uuid_is_null(data()); } // Default op= and copy ctor are fine. diff --git a/cpp/src/qpid/sys/LockFile.h b/cpp/src/qpid/sys/LockFile.h index 2ff8c2f6d4..71cb5e2f10 100644 --- a/cpp/src/qpid/sys/LockFile.h +++ b/cpp/src/qpid/sys/LockFile.h @@ -23,6 +23,7 @@ #include <boost/shared_ptr.hpp> #include <string> +#include "qpid/CommonImportExport.h" #include "IntegerTypes.h" namespace qpid { @@ -48,8 +49,8 @@ class LockFile : private boost::noncopyable bool created; public: - LockFile(const std::string& path_, bool create); - ~LockFile(); + QPID_COMMON_EXTERN LockFile(const std::string& path_, bool create); + QPID_COMMON_EXTERN ~LockFile(); /** * Read the process ID from the lock file. This method assumes that @@ -60,7 +61,7 @@ public: * * @returns The stored process ID. No validity check is done on it. */ - pid_t readPid(void) const; + QPID_COMMON_EXTERN pid_t readPid(void) const; /** * Write the current process's ID to the lock file. It's written at @@ -69,7 +70,7 @@ public: * * Throws an exception if the write fails. */ - void writePid(void); + QPID_COMMON_EXTERN void writePid(void); }; }} /* namespace qpid::sys */ diff --git a/cpp/src/qpid/sys/windows/LockFile.cpp b/cpp/src/qpid/sys/windows/LockFile.cpp index 9804020167..766fa6466a 100755 --- a/cpp/src/qpid/sys/windows/LockFile.cpp +++ b/cpp/src/qpid/sys/windows/LockFile.cpp @@ -37,10 +37,10 @@ LockFile::LockFile(const std::string& path_, bool create) : path(path_), created(create) { HANDLE h = CreateFile(path.c_str(), - GENERIC_READ|GENERIC_WRITE, - 0, /* Disable opens by any other attempter */ + create ? (GENERIC_READ|GENERIC_WRITE) : GENERIC_READ, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 0, /* Default security */ - OPEN_ALWAYS, /* Create if needed */ + create ? OPEN_ALWAYS : OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, /* Delete file when closed */ NULL); QPID_WINDOWS_CHECK_NOT(h, INVALID_HANDLE_VALUE); |
