diff --git a/arangod/VocBase/datafile.cpp b/arangod/VocBase/datafile.cpp index c0d84d3e3d..e07e453955 100644 --- a/arangod/VocBase/datafile.cpp +++ b/arangod/VocBase/datafile.cpp @@ -210,6 +210,7 @@ static int CreateSparseFile (char const* filename, res = TRI_WRITE(fd, &zero, 1); if (res < 0) { + TRI_SYSTEM_ERROR(); TRI_set_errno(TRI_ERROR_SYS_ERROR); TRI_CLOSE(fd); diff --git a/lib/Basics/operating-system.h b/lib/Basics/operating-system.h index a0723d8549..9e4974e1de 100644 --- a/lib/Basics/operating-system.h +++ b/lib/Basics/operating-system.h @@ -730,7 +730,7 @@ typedef unsigned char bool; #define TRI_LAST_ERROR_STR strerror(errno) -#define TRI_ERRORBUF char windowsErrorBuf[256] +#define TRI_ERRORBUF char windowsErrorBuf[256] = ""; #define TRI_GET_ERRORBUF windowsErrorBuf //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/V8/v8-environment.cpp b/lib/V8/v8-environment.cpp index 8eb4ce80b7..b6a5959001 100644 --- a/lib/V8/v8-environment.cpp +++ b/lib/V8/v8-environment.cpp @@ -46,17 +46,17 @@ static void EnvGetter(v8::Local property, } #else // _WIN32 WCHAR buffer[32767]; // The maximum size allowed for environment variables. - DWORD result = GetEnvironmentVariableW(reinterpret_cast(*key), + DWORD result = GetEnvironmentVariableW(reinterpret_cast(*key), buffer, - ARRAY_SIZE(buffer)); + sizeof(buffer)); // If result >= sizeof buffer the buffer was too small. That should never // happen. If result == 0 and result != ERROR_SUCCESS the variable was not // not found. if ((result > 0 || GetLastError() == ERROR_SUCCESS) && - result < ARRAY_SIZE(buffer)) { + result < sizeof(buffer)) { const uint16_t* two_byte_buffer = reinterpret_cast(buffer); - v8::Local rc = v8::String::NewFromTwoByte(env->isolate(), two_byte_buffer); - TRI_V8_RETURN_STD_STRING(rc); + auto rc = TRI_V8_STRING_UTF16(two_byte_buffer, result); + TRI_V8_RETURN(rc); } #endif // Not found. Fetch from prototype. @@ -181,10 +181,7 @@ static void EnvEnumerator(const v8::PropertyCallbackInfo& args) { } const uint16_t* two_byte_buffer = reinterpret_cast(p); const size_t two_byte_buffer_len = s - p; - v8::Local value = v8::String::NewFromTwoByte(env->isolate(), - two_byte_buffer, - String::kNormalString, - two_byte_buffer_len); + auto value = TRI_V8_STRING_UTF16(two_byte_buffer, (int)two_byte_buffer_len); envarr->Set(i++, value); p = s + wcslen(s) + 1; }