1
0
Fork 0

split headers different, simple cast fixes (#8928)

This commit is contained in:
Wilfried Goesgens 2019-05-08 14:08:35 +02:00 committed by Jan
parent d50eeb0410
commit 1ae5f8daec
11 changed files with 37 additions and 23 deletions

View File

@ -61,6 +61,20 @@
#define STDIN_FILENO 0 #define STDIN_FILENO 0
#define STDOUT_FILENO 1 #define STDOUT_FILENO 1
#define STDERR_FILENO 2 #define STDERR_FILENO 2
#ifdef S_IRGRP
#undef S_IRGRP
#endif
#ifdef S_IRUSR
#undef S_IRUSR
#endif
#ifdef S_IWGRP
#undef S_IWGRP
#endif
#ifdef S_IWUSR
#undef S_IWUSR
#endif
#define S_IRUSR 00400 #define S_IRUSR 00400
#define S_IWUSR 00200 #define S_IWUSR 00200
#define S_IXUSR 00100 #define S_IXUSR 00100

View File

@ -421,7 +421,7 @@ ManagedDirectory::File::File(ManagedDirectory const& directory,
// gzip is going to perform a redundant close, // gzip is going to perform a redundant close,
// simpler code to give it redundant handle // simpler code to give it redundant handle
_gzfd = dup(_fd); _gzfd = TRI_DUP(_fd);
if (O_WRONLY & flags) { if (O_WRONLY & flags) {
gzFlags = "wb"; gzFlags = "wb";

View File

@ -146,20 +146,6 @@
#endif #endif
#include <sys/stat.h> #include <sys/stat.h>
// .............................................................................
// The problem we have for visual studio is that if we include WinSock2.h here
// it may conflict later in some other source file. The conflict arises when
// windows.h is included BEFORE WinSock2.h -- this is a visual studio issue. For
// now be VERY careful to ensure that if you need windows.h, then you include
// this file AFTER common.h.
// .............................................................................
#ifdef TRI_HAVE_WINSOCK2_H
#include <WinSock2.h>
typedef long suseconds_t;
#endif
#include <algorithm> #include <algorithm>
#include <atomic> #include <atomic>
#include <cmath> #include <cmath>

View File

@ -45,7 +45,7 @@ using namespace icu;
#ifdef _WIN32 #ifdef _WIN32
std::wstring arangodb::basics::toWString(std::string const& validUTF8String) { std::wstring arangodb::basics::toWString(std::string const& validUTF8String) {
icu::UnicodeString utf16(validUTF8String.c_str(), validUTF8String.size()); icu::UnicodeString utf16(validUTF8String.c_str(), static_cast<int32_t>(validUTF8String.size()));
// // probably required for newer c++ versions // // probably required for newer c++ versions
// using bufferType = std::remove_pointer_t<decltype(utf16.getTerminatedBuffer())>; // using bufferType = std::remove_pointer_t<decltype(utf16.getTerminatedBuffer())>;
// static_assert(sizeof(std::wchar_t) == sizeof(bufferType), "sizes do not match"); // static_assert(sizeof(std::wchar_t) == sizeof(bufferType), "sizes do not match");
@ -55,7 +55,7 @@ std::wstring arangodb::basics::toWString(std::string const& validUTF8String) {
std::string arangodb::basics::fromWString(wchar_t const* validUTF16String, std::size_t size) { std::string arangodb::basics::fromWString(wchar_t const* validUTF16String, std::size_t size) {
std::string out; std::string out;
icu::UnicodeString ICUString(validUTF16String, size); icu::UnicodeString ICUString(validUTF16String, static_cast<int32_t>(size));
ICUString.toUTF8String<std::string>(out); ICUString.toUTF8String<std::string>(out);
return out; return out;
} }

View File

@ -28,8 +28,6 @@
#ifdef TRI_HAVE_WIN32_MMAP #ifdef TRI_HAVE_WIN32_MMAP
#include <Windows.h>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief undefine this so anonymous memory mapping is disabled /// @brief undefine this so anonymous memory mapping is disabled
/// ///

View File

@ -170,6 +170,7 @@
#define TRI_MKDIR(a, b) ::mkdir((a), (b)) #define TRI_MKDIR(a, b) ::mkdir((a), (b))
#define TRI_OPEN(a, b) ::open((a), (b)) #define TRI_OPEN(a, b) ::open((a), (b))
#define TRI_FOPEN(a, b) ::fopen((a), (b)) #define TRI_FOPEN(a, b) ::fopen((a), (b))
#define TRI_DUP ::dup
#define TRI_READ ::read #define TRI_READ ::read
#define TRI_RMDIR ::rmdir #define TRI_RMDIR ::rmdir
#define TRI_STAT ::stat #define TRI_STAT ::stat
@ -326,6 +327,7 @@
#define TRI_OPEN(a, b) ::open((a), (b)) #define TRI_OPEN(a, b) ::open((a), (b))
#define TRI_FOPEN(a, b) ::fopen((a), (b)) #define TRI_FOPEN(a, b) ::fopen((a), (b))
#define TRI_READ ::read #define TRI_READ ::read
#define TRI_DUP ::dup
#define TRI_RMDIR ::rmdir #define TRI_RMDIR ::rmdir
#define TRI_STAT ::stat #define TRI_STAT ::stat
#define TRI_STAT_ATIME_SEC(statbuf) statbuf.st_atimespec.tv_sec #define TRI_STAT_ATIME_SEC(statbuf) statbuf.st_atimespec.tv_sec
@ -472,6 +474,7 @@
#define TRI_OPEN(a, b) ::open((a), (b)) #define TRI_OPEN(a, b) ::open((a), (b))
#define TRI_FOPEN(a, b) ::fopen((a), (b)) #define TRI_FOPEN(a, b) ::fopen((a), (b))
#define TRI_READ ::read #define TRI_READ ::read
#define TRI_DUP ::dup
#define TRI_RMDIR ::rmdir #define TRI_RMDIR ::rmdir
#define TRI_STAT ::stat #define TRI_STAT ::stat
#define TRI_STAT_ATIME_SEC(statbuf) statbuf.st_atimespec.tv_sec #define TRI_STAT_ATIME_SEC(statbuf) statbuf.st_atimespec.tv_sec
@ -631,6 +634,7 @@
#define TRI_OPEN(a, b) ::open((a), (b)) #define TRI_OPEN(a, b) ::open((a), (b))
#define TRI_FOPEN(a, b) ::fopen((a), (b)) #define TRI_FOPEN(a, b) ::fopen((a), (b))
#define TRI_READ ::read #define TRI_READ ::read
#define TRI_DUP ::dup
#define TRI_RMDIR ::rmdir #define TRI_RMDIR ::rmdir
#define TRI_STAT ::stat #define TRI_STAT ::stat
#define TRI_STAT_ATIME_SEC(statbuf) statbuf.st_atim.tv_sec #define TRI_STAT_ATIME_SEC(statbuf) statbuf.st_atim.tv_sec
@ -833,6 +837,7 @@ typedef unsigned char bool;
#define TRI_MKDIR(a, b) TRI_MKDIR_WIN32(a) #define TRI_MKDIR(a, b) TRI_MKDIR_WIN32(a)
#define TRI_OPEN(a, b) TRI_OPEN_WIN32((a), (b)) #define TRI_OPEN(a, b) TRI_OPEN_WIN32((a), (b))
#define TRI_READ ::_read #define TRI_READ ::_read
#define TRI_DUP ::_dup
#define TRI_WRITE ::_write #define TRI_WRITE ::_write
#define TRI_FDOPEN(a, b) ::_fdopen((a), (b)) #define TRI_FDOPEN(a, b) ::_fdopen((a), (b))

View File

@ -42,6 +42,7 @@
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#include "Basics/socket-utils.h"
#include <Psapi.h> #include <Psapi.h>
#include <TlHelp32.h> #include <TlHelp32.h>
#include <unicode/unistr.h> #include <unicode/unistr.h>

View File

@ -27,10 +27,13 @@
#include "Basics/Common.h" #include "Basics/Common.h"
#ifdef TRI_HAVE_WINSOCK2_H #ifdef TRI_HAVE_WINSOCK2_H
#include <WS2tcpip.h>
#include <WinSock2.h> #include <WinSock2.h>
#include <WS2tcpip.h>
typedef long suseconds_t;
#endif #endif
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief socket types /// @brief socket types
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -21,6 +21,7 @@
/// @author Dr. Oreste Costa-Panaia /// @author Dr. Oreste Costa-Panaia
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <WinSock2.h>
#include <errno.h> #include <errno.h>
#include <io.h> #include <io.h>

View File

@ -24,8 +24,8 @@
#ifndef ARANGODB_BASICS_WIN__UTILS_H #ifndef ARANGODB_BASICS_WIN__UTILS_H
#define ARANGODB_BASICS_WIN__UTILS_H 1 #define ARANGODB_BASICS_WIN__UTILS_H 1
#include <WinSock2.h>
#include <string> #include <string>
#include <IntSafe.h>
#include "Basics/Result.h" #include "Basics/Result.h"
@ -127,7 +127,11 @@ bool terminalKnowsANSIColors();
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// returns returns the filename in conjunction with a handle // returns returns the filename in conjunction with a handle
// only visible, if winndef.h was previously included for HANDLE.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifdef _WINDEF_
std::string getFileNameFromHandle(HANDLE fileHandle); std::string getFileNameFromHandle(HANDLE fileHandle);
#endif
#endif #endif

View File

@ -24,7 +24,9 @@
#include "v8-utils.h" #include "v8-utils.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windef.h>
#include <conio.h> #include <conio.h>
#include <WinSock2.h>
#include "Basics/win-utils.h" #include "Basics/win-utils.h"
#endif #endif
@ -4130,7 +4132,7 @@ static void convertProcessInfoToV8(v8::FunctionCallbackInfo<v8::Value> const& ar
v8::Handle<v8::Array> arguments = v8::Handle<v8::Array> arguments =
v8::Array::New(isolate, static_cast<int>(external_process._numberArguments)); v8::Array::New(isolate, static_cast<int>(external_process._numberArguments));
for (size_t i = 0; i < external_process._numberArguments; i++) { for (uint32_t i = 0; i < external_process._numberArguments; i++) {
arguments->Set(i, TRI_V8_ASCII_STRING(isolate, external_process._arguments[i])); arguments->Set(i, TRI_V8_ASCII_STRING(isolate, external_process._arguments[i]));
} }
result->Set(TRI_V8_ASCII_STRING(isolate, "arguments"), arguments); result->Set(TRI_V8_ASCII_STRING(isolate, "arguments"), arguments);
@ -5308,7 +5310,7 @@ static void JS_ErrorNumberToHttpCode(v8::FunctionCallbackInfo<v8::Value> const&
} }
auto num = TRI_ObjectToInt64(isolate, args[0]); auto num = TRI_ObjectToInt64(isolate, args[0]);
auto code = arangodb::GeneralResponse::responseCode(num); auto code = arangodb::GeneralResponse::responseCode(static_cast<int>(num));
using Type = typename std::underlying_type<arangodb::rest::ResponseCode>::type; using Type = typename std::underlying_type<arangodb::rest::ResponseCode>::type;
TRI_V8_RETURN_INTEGER(static_cast<Type>(code)); TRI_V8_RETURN_INTEGER(static_cast<Type>(code));