summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-07-23 13:04:48 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-07-23 13:04:48 +0000
commit380e3f018712d3a65ddc834dbf83e036b436be09 (patch)
treebe34c3320914cb6cd1927e49ee6f463a6562398e /src/common.h
parent6574e44f886740273676b6d73ef754385a36197f (diff)
2007-07-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Merged Ross's win32 patch(manually) In the course of merging, following files are added. * src/strptime.{h,c} * src/libgen.{h,c} * src/inet_aton.{h,c} * src/Platform.{h,cc} * src/localtime_r.{h,c} * src/getaddrinfo.{h,c} I've gethered network related things, and put them to following file: * src/a2netcompat.h Also io related things are put to following file: * src/a2io.h Changed %lld to %s because mingw32 doesn't recognize %lld. * src/message.h (MSG_ALLOCATION_COMPLETED) (EX_TOO_LARGE_FILE) (EX_SIZE_MISMATCH) (EX_FILE_OFFSET_OUT_OF_RANGE) (EX_INVALID_CHUNK_CHECKSUM) (EX_INVALID_RANGE_HEADER) * src/FileAllocationCommand.cc * src/HttpResponse.cc * src/RequestGroup.cc * src/MultiDiskAdaptor.cc * src/OptionHandlerImpl.h * src/HttpResponseCommand.cc * src/FtpNegotiateCommand.cc * src/IteratableChecksumValidator.cc * src/SegmentMan.cc * src/ChunkChecksumValidator.cc Added Randomizer::getRandomNumber(long int) * src/Randomizer.h (getRandomNumber) * src/SimpleRandomizer.h (getRandomNumber) * src/BitfieldMan.cc (getMissingIndexRandomly): Use this new function. * src/Util.cc (randomAlpha): Use this new function.
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index 2c61b472..8679224f 100644
--- a/src/common.h
+++ b/src/common.h
@@ -45,6 +45,7 @@
#include <assert.h>
#include <limits.h>
#include <unistd.h>
+#include <stdlib.h>
#include <string>
#include <deque>
#include <algorithm>
@@ -81,4 +82,22 @@ typedef deque<int32_t> Integers;
#define OPEN_MODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH
#define DIR_OPEN_MODE S_IRWXU|S_IRWXG|S_IRWXO
+#ifdef __MINGW32__
+# ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x501
+# endif // _WIN32_WINNT
+#endif // __MINGW32__
+
+#ifdef __MINGW32__
+# define LONGLONG_PRINTF "%I64d"
+# define ULONGLONG_PRINTF "%I64u"
+# define LONGLONG_SCANF "%I64d"
+# define ULONGLONG_SCANF "%I64u"
+#else
+# define LONGLONG_PRINTF "%lld"
+# define ULONGLONG_PRINTF "%llu"
+# define LONGLONG_SCANF "%Ld"
+# define ULONGLONG_SCANF "%Lu"
+#endif // __MINGW32__
+
#endif // _D_COMMON_H_