1
0
Fork 0

Merge branch 'devel' of https://github.com/arangodb/arangodb into devel

This commit is contained in:
Jan Steemann 2015-03-20 13:35:28 +01:00
commit 573bc7c486
3 changed files with 8 additions and 10 deletions

View File

@ -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);

View File

@ -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
////////////////////////////////////////////////////////////////////////////////

View File

@ -46,17 +46,17 @@ static void EnvGetter(v8::Local<v8::String> property,
}
#else // _WIN32
WCHAR buffer[32767]; // The maximum size allowed for environment variables.
DWORD result = GetEnvironmentVariableW(reinterpret_cast<WCHAR*>(*key),
DWORD result = GetEnvironmentVariableW(reinterpret_cast<const WCHAR*>(*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<const uint16_t*>(buffer);
v8::Local<v8::String> 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<v8::Array>& args) {
}
const uint16_t* two_byte_buffer = reinterpret_cast<const uint16_t*>(p);
const size_t two_byte_buffer_len = s - p;
v8::Local<v8::String> 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;
}