Repository: thrift Updated Branches: refs/heads/master 61b8a29b0 -> 855cf7f08
THRIFT-3253 Using latest version of D gives deprecation notices Client: D Patch: Phongphan Phuttha <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/855cf7f0 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/855cf7f0 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/855cf7f0 Branch: refs/heads/master Commit: 855cf7f089730a7df657f45e25afa0b6043a72c8 Parents: 61b8a29 Author: Jens Geyer <[email protected]> Authored: Thu Oct 8 21:12:57 2015 +0200 Committer: Jens Geyer <[email protected]> Committed: Thu Oct 8 21:12:57 2015 +0200 ---------------------------------------------------------------------- lib/d/src/thrift/async/libevent.d | 6 +++--- lib/d/src/thrift/codegen/base.d | 7 ++++--- lib/d/src/thrift/internal/ssl.d | 2 +- lib/d/src/thrift/protocol/json.d | 2 +- lib/d/src/thrift/transport/file.d | 2 +- lib/d/src/thrift/transport/ssl.d | 2 +- lib/d/test/async_test.d | 2 +- lib/d/test/thrift_test_server.d | 5 +++++ lib/d/test/transport_test.d | 2 +- 9 files changed, 18 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/855cf7f0/lib/d/src/thrift/async/libevent.d ---------------------------------------------------------------------- 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 @@ private: TAsyncEventReason.NORMAL; (*(cast(TSocketEventListener*)arg))(reason); GC.removeRange(arg); - clear(arg); + destroy(arg); free(arg); } @@ -402,7 +402,7 @@ private: assert(flags & EV_TIMEOUT); (*(cast(void delegate()*)arg))(); GC.removeRange(arg); - clear(arg); + destroy(arg); free(arg); } @@ -443,7 +443,7 @@ private: 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; } http://git-wip-us.apache.org/repos/asf/thrift/blob/855cf7f0/lib/d/src/thrift/codegen/base.d ---------------------------------------------------------------------- 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 std.traits : BaseTypeTuple, isPointer, isSomeFunction, PointerTarget, 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 @@ mixin template TStructHelpers(alias fieldMetaData = cast(TFieldMeta[])null) if ( return (cast()super).opEquals(other); } - size_t toHash() const { + override size_t toHash() const { return thriftToHashImpl(); } } else { @@ -469,8 +470,8 @@ mixin template TStructHelpers(alias fieldMetaData = cast(TFieldMeta[])null) if ( 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; http://git-wip-us.apache.org/repos/asf/thrift/blob/855cf7f0/lib/d/src/thrift/internal/ssl.d ---------------------------------------------------------------------- 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 getSSLException(string location = null, string clientFile = __FILE__, Exception exception; void initMessage() { - message.clear(); + message.destroy(); hadMessage = false; if (!location.empty) { message ~= location; http://git-wip-us.apache.org/repos/asf/thrift/blob/855cf7f0/lib/d/src/thrift/protocol/json.d ---------------------------------------------------------------------- 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 @@ final class TJsonProtocol(Transport = TTransport) if ( } void reset() { - contextStack_.clear(); + destroy(contextStack_); context_ = new Context(); reader_ = new LookaheadReader(trans_); } http://git-wip-us.apache.org/repos/asf/thrift/blob/855cf7f0/lib/d/src/thrift/transport/file.d ---------------------------------------------------------------------- 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 @@ private { (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. http://git-wip-us.apache.org/repos/asf/thrift/blob/855cf7f0/lib/d/src/thrift/transport/ssl.d ---------------------------------------------------------------------- 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 @@ private: const(char)* file, int line) { GC.removeRange(l); - clear(cast(Mutex)l); + destroy(cast(Mutex)l); free(l); } http://git-wip-us.apache.org/repos/asf/thrift/blob/855cf7f0/lib/d/test/async_test.d ---------------------------------------------------------------------- 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 @@ void main(string[] args) { } 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) { http://git-wip-us.apache.org/repos/asf/thrift/blob/855cf7f0/lib/d/test/thrift_test_server.d ---------------------------------------------------------------------- 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 @@ class TestHandler : ThriftTest { 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); http://git-wip-us.apache.org/repos/asf/thrift/blob/855cf7f0/lib/d/test/transport_test.d ---------------------------------------------------------------------- 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 @@ class CoupledWrapperTransports(WrapperTransport, InnerCoupledTransports) if ( } ~this() { - clear(inner_); + destroy(inner_); } private:
