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
diff --git a/lib/d/src/thrift/internal/socket.d b/lib/d/src/thrift/internal/socket.d
index 43e1ca8..6ca0a97 100644
--- a/lib/d/src/thrift/internal/socket.d
+++ b/lib/d/src/thrift/internal/socket.d
@@ -44,7 +44,7 @@
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 @@
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 47a7cde..63a0a2b 100644
--- a/lib/d/src/thrift/internal/ssl.d
+++ b/lib/d/src/thrift/internal/ssl.d
@@ -20,7 +20,7 @@
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 @@
}
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 809c847..97cbb4d 100644
--- a/lib/d/src/thrift/protocol/base.d
+++ b/lib/d/src/thrift/protocol/base.d
@@ -253,7 +253,7 @@
/**
* 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 @@
}
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 5122f61..e970fd1 100644
--- a/lib/d/src/thrift/protocol/compact.d
+++ b/lib/d/src/thrift/protocol/compact.d
@@ -475,6 +475,8 @@
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 7d35ba2..e89aee1 100644
--- a/lib/d/src/thrift/protocol/json.d
+++ b/lib/d/src/thrift/protocol/json.d
@@ -847,6 +847,9 @@
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 0cbca41..e66d80e 100644
--- a/lib/d/src/thrift/server/transport/socket.d
+++ b/lib/d/src/thrift/server/transport/socket.d
@@ -284,7 +284,7 @@
// 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 2b252c2..38b567a 100644
--- a/lib/d/src/thrift/transport/socket.d
+++ b/lib/d/src/thrift/transport/socket.d
@@ -158,7 +158,7 @@
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 @@
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 da0eb27..c1eab25 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 @@
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 127374b..5ef97f9 100644
--- a/lib/d/src/thrift/util/hashset.d
+++ b/lib/d/src/thrift/util/hashset.d
@@ -141,5 +141,5 @@
void delegate() dg;
auto b = hashSet(dg);
- enforce(b.toString() == "thrift.util.hashset.HashSet!(void delegate()).HashSet");
+ static assert(__traits(compiles, b.toString()));
}