diff options
author | Jake Farrell <jfarrell@apache.org> | 2012-08-18 03:31:28 +0000 |
---|---|---|
committer | Jake Farrell <jfarrell@apache.org> | 2012-08-18 03:31:28 +0000 |
commit | c02efe21c11cc8196ccf2429c90ba286c049d852 (patch) | |
tree | 085894bc65e39b1b0cfe3b4becedf5d7ea6c17cf /lib/d/src | |
parent | ffd7685c09007d1057a17309ad9dbb49a9f71d48 (diff) | |
download | thrift-c02efe21c11cc8196ccf2429c90ba286c049d852.tar.gz |
Thrift-1674:Update Thrift D library to be compatible with 2.060
Client: d
Patch: David Nadlinger
Updated D lib for 2.060.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1374507 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'lib/d/src')
-rw-r--r-- | lib/d/src/thrift/internal/socket.d | 4 | ||||
-rw-r--r-- | lib/d/src/thrift/internal/ssl.d | 4 | ||||
-rw-r--r-- | lib/d/src/thrift/protocol/base.d | 5 | ||||
-rw-r--r-- | lib/d/src/thrift/protocol/compact.d | 2 | ||||
-rw-r--r-- | lib/d/src/thrift/protocol/json.d | 3 | ||||
-rw-r--r-- | lib/d/src/thrift/server/transport/socket.d | 2 | ||||
-rw-r--r-- | lib/d/src/thrift/transport/socket.d | 4 | ||||
-rw-r--r-- | lib/d/src/thrift/transport/ssl.d | 4 | ||||
-rw-r--r-- | lib/d/src/thrift/util/hashset.d | 2 |
9 files changed, 19 insertions, 11 deletions
diff --git a/lib/d/src/thrift/internal/socket.d b/lib/d/src/thrift/internal/socket.d index 43e1ca84f..6ca0a970e 100644 --- a/lib/d/src/thrift/internal/socket.d +++ b/lib/d/src/thrift/internal/socket.d @@ -44,7 +44,7 @@ version (Win32) { enum WSAENOTCONN = 10057; enum WSAETIMEDOUT = 10060; } else { - import core.stdc.errno : getErrno, EAGAIN, ECONNRESET, EINPROGRESS, EINTR, + import core.stdc.errno : errno, EAGAIN, ECONNRESET, EINPROGRESS, EINTR, ENOTCONN, EPIPE; import core.stdc.string : strerror; } @@ -71,7 +71,7 @@ version (Win32) { return (errno == WSAECONNRESET || errno == WSAENOTCONN); } } else { - alias getErrno getSocketErrno; + alias errno getSocketErrno; enum CONNECT_INPROGRESS_ERRNO = EINPROGRESS; enum INTERRUPTED_ERRNO = EINTR; enum WOULD_BLOCK_ERRNO = EAGAIN; diff --git a/lib/d/src/thrift/internal/ssl.d b/lib/d/src/thrift/internal/ssl.d index 47a7cde15..63a0a2b3b 100644 --- a/lib/d/src/thrift/internal/ssl.d +++ b/lib/d/src/thrift/internal/ssl.d @@ -20,7 +20,7 @@ module thrift.internal.ssl; import core.memory : GC; import core.stdc.config; -import core.stdc.errno : getErrno; +import core.stdc.errno : errno; import core.stdc.string : strerror; import deimos.openssl.err; import deimos.openssl.ssl; @@ -188,7 +188,7 @@ Exception getSSLException(string location = null, string clientFile = __FILE__, } initMessage(); - auto errn = getErrno(); + auto errn = errno; const(char)* file = void; int line = void; diff --git a/lib/d/src/thrift/protocol/base.d b/lib/d/src/thrift/protocol/base.d index 809c847b6..97cbb4da2 100644 --- a/lib/d/src/thrift/protocol/base.d +++ b/lib/d/src/thrift/protocol/base.d @@ -253,7 +253,7 @@ protected: /** * Skips a field of the given type on the protocol. * - * The main purpose of skip() is to allow treating struct and cotainer types, + * The main purpose of skip() is to allow treating struct and container types, * (where multiple primitive types have to be skipped) the same as scalar types * in generated code. */ @@ -322,6 +322,9 @@ void skip(Protocol)(Protocol prot, TType type) if (is(Protocol : TProtocol)) { } prot.readSetEnd(); break; + case TType.STOP: goto case; + case TType.VOID: + assert(false, "Invalid field type passed."); } } diff --git a/lib/d/src/thrift/protocol/compact.d b/lib/d/src/thrift/protocol/compact.d index 5122f61c2..e970fd1b7 100644 --- a/lib/d/src/thrift/protocol/compact.d +++ b/lib/d/src/thrift/protocol/compact.d @@ -475,6 +475,8 @@ private: return CType.SET; case TType.LIST: return CType.LIST; + case TType.VOID: + assert(false, "Invalid type passed."); } } diff --git a/lib/d/src/thrift/protocol/json.d b/lib/d/src/thrift/protocol/json.d index 7d35ba258..e89aee14e 100644 --- a/lib/d/src/thrift/protocol/json.d +++ b/lib/d/src/thrift/protocol/json.d @@ -847,6 +847,9 @@ private { return "lst"; case TType.SET: return "set"; + case TType.STOP: goto case; + case TType.VOID: + assert(false, "Invalid type passed."); } } diff --git a/lib/d/src/thrift/server/transport/socket.d b/lib/d/src/thrift/server/transport/socket.d index 0cbca41a5..e66d80e32 100644 --- a/lib/d/src/thrift/server/transport/socket.d +++ b/lib/d/src/thrift/server/transport/socket.d @@ -284,7 +284,7 @@ Socket makeSocketAndListen(ushort port, int backlog, ushort retryLimit, // Turn linger off to avoid blocking on socket close. try { - linger l; + Linger l; l.on = 0; l.time = 0; socket.setOption(lvlSock, SocketOption.LINGER, l); diff --git a/lib/d/src/thrift/transport/socket.d b/lib/d/src/thrift/transport/socket.d index 2b252c26b..38b567a07 100644 --- a/lib/d/src/thrift/transport/socket.d +++ b/lib/d/src/thrift/transport/socket.d @@ -158,7 +158,7 @@ protected: void setSocketOpts() { try { alias SocketOptionLevel.SOCKET lvlSock; - linger l; + Linger l; l.on = 0; l.time = 0; socket_.setOption(lvlSock, SocketOption.LINGER, l); @@ -438,7 +438,7 @@ protected: socket_.setOption(SocketOptionLevel.SOCKET, type, value); } catch (SocketException e) { throw new TTransportException( - "Could not set send timeout: " ~ socketErrnoString(e.errorCode), + "Could not set timeout.", TTransportException.Type.UNKNOWN, __FILE__, __LINE__, diff --git a/lib/d/src/thrift/transport/ssl.d b/lib/d/src/thrift/transport/ssl.d index da0eb274a..c1eab25dc 100644 --- a/lib/d/src/thrift/transport/ssl.d +++ b/lib/d/src/thrift/transport/ssl.d @@ -23,7 +23,7 @@ module thrift.transport.ssl; import core.exception : onOutOfMemoryError; -import core.stdc.errno : getErrno, EINTR; +import core.stdc.errno : errno, EINTR; import core.sync.mutex : Mutex; import core.memory : GC; import core.stdc.config; @@ -149,7 +149,7 @@ final class TSSLSocket : TSocket { bytes = SSL_read(ssl_, buf.ptr, cast(int)buf.length); if (bytes >= 0) break; - auto errnoCopy = getErrno(); + auto errnoCopy = errno; if (SSL_get_error(ssl_, bytes) == SSL_ERROR_SYSCALL) { if (ERR_get_error() == 0 && errnoCopy == EINTR) { // FIXME: Windows. diff --git a/lib/d/src/thrift/util/hashset.d b/lib/d/src/thrift/util/hashset.d index 127374bee..5ef97f988 100644 --- a/lib/d/src/thrift/util/hashset.d +++ b/lib/d/src/thrift/util/hashset.d @@ -141,5 +141,5 @@ unittest { void delegate() dg; auto b = hashSet(dg); - enforce(b.toString() == "thrift.util.hashset.HashSet!(void delegate()).HashSet"); + static assert(__traits(compiles, b.toString())); } |