THRIFT-3253 Using latest version of D gives deprecation notices
Client: D
Patch: Phongphan Phuttha <phongphan@acm.org>
diff --git a/lib/d/src/thrift/async/libevent.d b/lib/d/src/thrift/async/libevent.d
index 967c41f..2cf0d3c 100644
--- a/lib/d/src/thrift/async/libevent.d
+++ b/lib/d/src/thrift/async/libevent.d
@@ -392,7 +392,7 @@
TAsyncEventReason.NORMAL;
(*(cast(TSocketEventListener*)arg))(reason);
GC.removeRange(arg);
- clear(arg);
+ destroy(arg);
free(arg);
}
@@ -402,7 +402,7 @@
assert(flags & EV_TIMEOUT);
(*(cast(void delegate()*)arg))();
GC.removeRange(arg);
- clear(arg);
+ destroy(arg);
free(arg);
}
@@ -443,7 +443,7 @@
private {
timeval toTimeval(const(Duration) dur) {
timeval tv = {tv_sec: cast(int)dur.total!"seconds"(),
- tv_usec: dur.fracSec.usecs};
+ tv_usec: dur.total!"usecs"};
return tv;
}
diff --git a/lib/d/src/thrift/codegen/base.d b/lib/d/src/thrift/codegen/base.d
index 9061d0b..0e94335 100644
--- a/lib/d/src/thrift/codegen/base.d
+++ b/lib/d/src/thrift/codegen/base.d
@@ -48,6 +48,7 @@
import thrift.base;
import thrift.internal.codegen;
import thrift.protocol.base;
+import thrift.util.hashset;
/*
* Thrift struct/service meta data, which is used to store information from
@@ -420,7 +421,7 @@
return (cast()super).opEquals(other);
}
- size_t toHash() const {
+ override size_t toHash() const {
return thriftToHashImpl();
}
} else {
@@ -469,8 +470,8 @@
private size_t thriftToHashImpl() const @trusted nothrow {
size_t hash = 0;
- foreach (name; FieldNames!This) {
- auto val = mixin("this." ~ name);
+ foreach (i, _; this.tupleof) {
+ auto val = this.tupleof[i];
hash += typeid(val).getHash(&val);
}
return hash;
diff --git a/lib/d/src/thrift/internal/ssl.d b/lib/d/src/thrift/internal/ssl.d
index 63a0a2b..3af54b5 100644
--- a/lib/d/src/thrift/internal/ssl.d
+++ b/lib/d/src/thrift/internal/ssl.d
@@ -179,7 +179,7 @@
Exception exception;
void initMessage() {
- message.clear();
+ message.destroy();
hadMessage = false;
if (!location.empty) {
message ~= location;
diff --git a/lib/d/src/thrift/protocol/json.d b/lib/d/src/thrift/protocol/json.d
index e89aee1..ed8f9c0 100644
--- a/lib/d/src/thrift/protocol/json.d
+++ b/lib/d/src/thrift/protocol/json.d
@@ -61,7 +61,7 @@
}
void reset() {
- contextStack_.clear();
+ destroy(contextStack_);
context_ = new Context();
reader_ = new LookaheadReader(trans_);
}
diff --git a/lib/d/src/thrift/transport/file.d b/lib/d/src/thrift/transport/file.d
index cb8bcd7..04d34ac 100644
--- a/lib/d/src/thrift/transport/file.d
+++ b/lib/d/src/thrift/transport/file.d
@@ -847,7 +847,7 @@
(immutable(ubyte)[] data) {
while (errorOpening) {
logError("Writer thread going to sleep for %s µs due to IO errors",
- ioErrorSleepDuration.fracSec.usecs);
+ ioErrorSleepDuration.total!"usecs");
// Sleep for ioErrorSleepDuration, being ready to be interrupted
// by shutdown requests.
diff --git a/lib/d/src/thrift/transport/ssl.d b/lib/d/src/thrift/transport/ssl.d
index c1eab25..a78a2ed 100644
--- a/lib/d/src/thrift/transport/ssl.d
+++ b/lib/d/src/thrift/transport/ssl.d
@@ -518,7 +518,7 @@
const(char)* file, int line)
{
GC.removeRange(l);
- clear(cast(Mutex)l);
+ destroy(cast(Mutex)l);
free(l);
}
diff --git a/lib/d/test/async_test.d b/lib/d/test/async_test.d
index f1a0cf3..fb765ad 100644
--- a/lib/d/test/async_test.d
+++ b/lib/d/test/async_test.d
@@ -130,7 +130,7 @@
}
auto managers = new TLibeventAsyncManager[managerCount];
- scope (exit) foreach (ref m; managers) clear(m);
+ scope (exit) foreach (ref m; managers) destroy(m);
auto clientsThreads = new ThreadGroup;
foreach (managerIndex, ref manager; managers) {
diff --git a/lib/d/test/thrift_test_server.d b/lib/d/test/thrift_test_server.d
index 1608a57..b55b7fc 100644
--- a/lib/d/test/thrift_test_server.d
+++ b/lib/d/test/thrift_test_server.d
@@ -86,6 +86,11 @@
return thing;
}
+ override bool testBool(bool thing) {
+ if (trace_) writefln("testBool(\"%s\")", thing);
+ return thing;
+ }
+
override Xtruct testStruct(ref const(Xtruct) thing) {
if (trace_) writefln("testStruct({\"%s\", %s, %s, %s})",
thing.string_thing, thing.byte_thing, thing.i32_thing, thing.i64_thing);
diff --git a/lib/d/test/transport_test.d b/lib/d/test/transport_test.d
index 09bf6fd..623e03f 100644
--- a/lib/d/test/transport_test.d
+++ b/lib/d/test/transport_test.d
@@ -144,7 +144,7 @@
}
~this() {
- clear(inner_);
+ destroy(inner_);
}
private: