Merge pull request #2273 from allengeorge/allen/clippy_clean

THRIFT-5306: Rust code and generated code no longer has clippy warnings (Rust 1.40)
diff --git a/README.md b/README.md
index 5b5ed16..a5af5ab 100644
--- a/README.md
+++ b/README.md
@@ -107,7 +107,7 @@
 Requirements
 ============
 
-See http://thrift.apache.org/docs/install for a list of build requirements (may be stale).  Alternatively see the docker build environments for a list of prerequisites.
+See http://thrift.apache.org/docs/install for a list of build requirements (may be stale).  Alternatively, see the docker build environments for a list of prerequisites.
 
 Resources
 =========
@@ -186,7 +186,7 @@
 Apache Thrift is available via a number of package managers, a list which is 
 is steadily growing. A more detailed overview can be found 
 [at the Apache Thrift web site under "Libraries"](http://thrift.apache.org/lib/) 
-and/or in the respecitive READMEs for each language under /lib
+and/or in the respective READMEs for each language under /lib
 
 Testing
 =======
diff --git a/compiler/cpp/compiler.vcxproj b/compiler/cpp/compiler.vcxproj
index 53574b2..dc9793f 100644
--- a/compiler/cpp/compiler.vcxproj
+++ b/compiler/cpp/compiler.vcxproj
@@ -171,7 +171,7 @@
       <PreprocessorDefinitions>WIN32;MINGW;YY_NO_UNISTD_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <ForcedIncludeFiles>thrift\windows\config.h</ForcedIncludeFiles>
       <CompileAs>CompileAsCpp</CompileAs>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
diff --git a/compiler/cpp/src/thrift/parse/t_program.h b/compiler/cpp/src/thrift/parse/t_program.h
index 140dc35..b6b1332 100644
--- a/compiler/cpp/src/thrift/parse/t_program.h
+++ b/compiler/cpp/src/thrift/parse/t_program.h
@@ -112,7 +112,10 @@
     objects_.push_back(tx);
     xceptions_.push_back(tx);
   }
-  void add_service(t_service* ts) { services_.push_back(ts); }
+  void add_service(t_service* ts) {
+    ts->validate_unique_members();
+    services_.push_back(ts);
+  }
 
   // Programs to include
   std::vector<t_program*>& get_includes() { return includes_; }
diff --git a/compiler/cpp/src/thrift/parse/t_service.h b/compiler/cpp/src/thrift/parse/t_service.h
index a43a515..f405c15 100644
--- a/compiler/cpp/src/thrift/parse/t_service.h
+++ b/compiler/cpp/src/thrift/parse/t_service.h
@@ -38,15 +38,58 @@
   void set_extends(t_service* extends) { extends_ = extends; }
 
   void add_function(t_function* func) {
-    std::vector<t_function*>::const_iterator iter;
-    for (iter = functions_.begin(); iter != functions_.end(); ++iter) {
-      if (func->get_name() == (*iter)->get_name()) {
-        throw "Function " + func->get_name() + " is already defined";
-      }
+    if (get_function_by_name(func->get_name()) != NULL) {
+      throw "Function " + func->get_name() + " is already defined";
     }
     functions_.push_back(func);
   }
 
+  void validate_unique_members() {
+    std::vector<t_function*>::const_iterator iter;
+    for (iter = functions_.begin(); iter != functions_.end(); ++iter) {
+      // throw exception when there is a conflict of names with super class
+      if (extends_ != NULL) {
+        if (extends_->get_function_by_name((*iter)->get_name()) != NULL) {
+          throw "Function " + (*iter)->get_name() + " is already defined in service " + name_;
+        }
+      }
+    }
+  }
+
+  t_function* get_function_by_name(std::string func_name) {
+    if (extends_ != NULL) {
+      t_function* func = NULL;
+      if ((func = extends_->get_function_by_name(func_name)) != NULL) {
+        return func;
+      }
+    }
+
+    std::vector<t_function*>::const_iterator iter;
+    for (iter = functions_.begin(); iter != functions_.end(); ++iter) {
+      if ((*iter)->get_name() == func_name) {
+        return *iter;
+      }
+    }
+    return NULL;
+  }
+
+  const t_function* get_function_by_name(std::string func_name) const {
+    if (extends_ != NULL) {
+      t_function* func = NULL;
+      if ((func = extends_->get_function_by_name(func_name)) != NULL) {
+        return func;
+      }
+    }
+
+    std::vector<t_function*>::const_iterator iter;
+    for (iter = functions_.begin(); iter != functions_.end(); ++iter) {
+      if ((*iter)->get_name() == func_name) {
+        return *iter;
+      }
+    }
+    return NULL;
+  }
+
   const std::vector<t_function*>& get_functions() const { return functions_; }
 
   t_service* get_extends() { return extends_; }
diff --git a/doc/ReleaseManagement.md b/doc/ReleaseManagement.md
index ee744ae..d2b6f34 100644
--- a/doc/ReleaseManagement.md
+++ b/doc/ReleaseManagement.md
@@ -14,13 +14,13 @@
 - *minor* is increased for each release cycle;
 - *patch* is increased for patch builds between release cycles to address critical defect, security, or packaging issues
 
-Further, if there are only packaging changes for a single third-party distribution point to correct an issue, the major.minor.patch may remain the same while adding a suffix compatible with that distribution point, for example "0.12.0.1" for nuget, or "0.12.0-1" for maven.
+Further, if there are only packaging changes for a single third-party distribution point to correct an issue, the major.minor.patch may remain the same while adding a suffix compatible with that distribution point, for example, "0.12.0.1" for nuget, or "0.12.0-1" for maven.
 
 #### External Package Patches
 
 It is common to have language-specific critical defects or packaging errors that need to be resolved between releases of Apache Thrift.  The project handles these on a case-by-case basis for languages that have their own [package management systems](http://apache.thrift.org/libraries).  When a language-specific patch is made, the patch level of the distribution pushed to the external package manager is bumped.
 
- As such, there may be cases between Apache Thrift releases where there are (for example) a `0.12.1` and `0.12.2` version of a Haskell Hackage package, and perhaps also a `0.12.3` version of a dlang dub package.  You will not find a tag or an official project release in these cases, however the code changes will be reflected in the release branch and in master.  In these cases we would not release a version of Apache Thrift nor would we refresh all the external language packages.
+ As such, there may be cases between Apache Thrift releases where there are (for example) a `0.12.1` and `0.12.2` version of a Haskell Hackage package, and perhaps also a `0.12.3` version of a dlang dub package.  You will not find a tag or an official project release in these cases, however, the code changes will be reflected in the release branch and in master.  In these cases we would not release a version of Apache Thrift nor would we refresh all the external language packages.
 
 #### Version in the master branch
 
@@ -76,7 +76,7 @@
 
     It is healthy to scrub these periodically, whether or not you are making a new release.
 
-1. Check that the version number in the `master` branch matches the version number of the upcomning release.  To check the `master` branch version, run:
+1. Check that the version number in the `master` branch matches the version number of the upcoming release.  To check the `master` branch version, run:
 
     ```bash
     thrift$ grep AC_INIT configure.ac | cut -d'[' -f3 | cut -d']' -f1
@@ -315,11 +315,11 @@
         --username <apache-username> --password <apache-password>
     ```
 
-    **NOTE** One you check in, you need to wait about a day for all the mirrors to update.  You cannot send the announcement email or update the web site until the mirrors are updated.
+    **NOTE** Once you check-in, you need to wait about a day for all the mirrors to update.  You cannot send the announcement email or update the web site until the mirrors are updated.
 
 1. Create and push a tag for the release, for example "v1.0.0".
 
-    **NOTE:** All new releases must have the "v" prefix to satisfy third  party package managers (dlang dub, golang, etc..)
+    **NOTE:** All new releases must have the "v" prefix to satisfy third-party package managers (dlang dub, golang, etc..)
 
     **NOTE:** You **should** [sign the release tag](https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work).  Since you already have a GPG signing key for publishing the Apache Release, you want to [upload that key to your GitHub account](https://help.github.com/en/articles/adding-a-new-gpg-key-to-your-github-account).  Once the key is known by GitHub you can sign the tag.
 
@@ -389,7 +389,7 @@
 
 #### Third Party Package Managers
 
-See https://thrift.apache.org/lib/ for the current status of each external package manager's distribution.  Information below is from the 0.12.0 release:
+See https://thrift.apache.org/lib/ for the current status of each external package manager's distribution.  The information below is from the 0.12.0 release:
 
   > This section needs to be updated with detailed instructions for each language, or pointers to the README.md files in each language directory with detailed release instructions for the given package management system.
 
@@ -398,7 +398,7 @@
   * Go into lib/dart and run "pub publish --dry-run" and resolve any warnings.
   * Run "pub publish" and go through the google account authorization to allow it.
 * [dlang] Within a day, the dlang dub site https://code.dlang.org/packages/apache-thrift?tab=info
-  should pick up the release based on the tag.  No action needed.
+  should pick up the release based on the tag.  No action is needed.
 * [haskell] https://hackage.haskell.org/package/thrift
     https://jira.apache.org/jira/browse/THRIFT-4698
 * [npmjs] @jfarrell is the only one who can do this right now.
diff --git a/doc/coding_standards.md b/doc/coding_standards.md
index 308100a..a8c7b60 100644
--- a/doc/coding_standards.md
+++ b/doc/coding_standards.md
@@ -6,18 +6,18 @@
 
 The purpose of this document is to make everyone's life easier.
 
-It's easier when you read good, well formatted, with clearly defined purpose, code.
+It's easier when you read good, well-formatted, with a clearly defined purpose, code.
 But the only way to read clean code is to write such.
 
 This document can help achieve that, but keep in mind that
 those are not silver-bullet, fix-all-at-once rules. Just think about readability while writing code.
-Write code like you would have to read it in ten years from now.
+Write code like you would have to read it ten years from now.
 
 ## General Coding Standards
 
 Thrift has some history. Not all existing code follows those rules.
 But we want to improve over time.
-When making small change / bugfix - like single line fix - do *not* refactor whole function.
+When making a small change / bugfix - like a single line fix - do *not* refactor the whole function.
 That disturbs code repository history.
 Whenever adding something new and / or making bigger refactoring
  - follow those rules as strictly as you can.
@@ -26,23 +26,23 @@
 Code review is the best way to improve readability.
 
 ### Basics
- * Use spaces not tabs
+ * Use spaces, not tabs
  * Use only ASCII characters in file and directory names
- * Commit to repository using Unix-style line endings (LF)
+ * Commit to the repository using Unix-style line endings (LF)
      On Windows:
        git config core.autocrlf true
  * Maximum line width - 100 characters
  * If not specified otherwise in language specific standard - use 2 spaces as indent/tab
 
 ### Comments
- * Each file has to start with comment containing [Apache License](http://www.apache.org/licenses/LICENSE-2.0)
- * Public API of library should be documented, preferably using format native for language specific documentation generation tools (Javadoc, Doxygen etc.)
+ * Each file has to start with a comment containing [Apache License](http://www.apache.org/licenses/LICENSE-2.0)
+ * Public API of a library should be documented, preferably using format native for language-specific documentation generation tools (Javadoc, Doxygen etc.)
  * Other comments are discouraged - comments are lies. When one has to make comment it means one failed to write readable code. Instead of "I should write a comment here" think "I should clean it up"
  * Do not leave "TODO/FIXME" comments - file [Jira](http://issues.apache.org/jira/browse/THRIFT) issue instead
 
 ### Naming
  Finding proper names is the most important and most difficult task in software development.
 
-## Language Specific Coding Standards
+## Language-Specific Coding Standards
 
 For detailed information see `lib/LANG/coding_standards.md`
diff --git a/doc/committers.md b/doc/committers.md
index 2326711..0dad94f 100644
--- a/doc/committers.md
+++ b/doc/committers.md
@@ -17,7 +17,7 @@
 
 1. Inspect the applied patch to ensure that all [Legal aspects on Submission of Contributions (Patches)](http://www.apache.org/licenses/LICENSE-2.0.html#contributions) are met
 
-1. Run the necessary unit tests and cross language test cases to verify the patch
+1. Run the necessary unit tests and cross-language test cases to verify the patch
 
 1. Commit the patch
 
@@ -34,7 +34,7 @@
 
        Description of what was fixed or addressed.
 
-       If this is a github pull request then add below comment to automaticaly close GitHub request, 
+       If this is a github pull request then add the below comment to automatically close the GitHub request, 
 	   where #NNNN is the PR number:
        
         This closes #NNNN
@@ -47,7 +47,7 @@
        git push origin master
 
 
-1. Resolve the jira issue and set the following for the changelog
+1. Resolve the Jira issue and set the following for the changelog
 
   * Component the patch is for
   * fixVersion to the current version on master
diff --git a/doc/install/windows.md b/doc/install/windows.md
index 8618934..065b574 100644
--- a/doc/install/windows.md
+++ b/doc/install/windows.md
@@ -1,6 +1,6 @@
 ## Windows Setup
 
-The Thrift environment consists of two main parts: The Thrift compiler EXE and the language-dependent libraries. Most of these libraries will require some kind of build and/or installation. But regarding the Thrift compiler utility there are a number of different alternatives. 
+The Thrift environment consists of two main parts: The Thrift compiler EXE and the language-dependent libraries. Most of these libraries will require some kind of build and/or installation. But regarding the Thrift compiler utility, there are a number of different alternatives. 
 
 The first one of these alternatives is to download the **pre-built Thrift Compiler EXE** and only build the libraries needed from source, following one of the "Setup from source" methods outlined below.
 
@@ -112,7 +112,7 @@
 
 Then linking using $(LTHRIFT) instead of -lthrift.
 
-	TODO - diagnose issue further
+	TODO - diagnose the issue further
 
 #### C++ runtime segfault with cygwin 1.7.5-1, g++-4.3.4, fork() and throw
 
@@ -131,7 +131,7 @@
  * MinGW 
  * [Apache Thrift Requirements](/docs/install)
 
-In addition you need to add the following entry to your windows PATH variable.
+In addition, you need to add the following entry to your windows PATH variable.
 
 	C:\MINGW\BIN
 	
diff --git a/doc/specs/HeaderFormat.md b/doc/specs/HeaderFormat.md
index 0456f1e..9b74159 100644
--- a/doc/specs/HeaderFormat.md
+++ b/doc/specs/HeaderFormat.md
@@ -46,7 +46,7 @@
 don't know how to transform the data.
 
 Conversely, data in the info headers is ignorable.  This should only
-be things like timestamps, debuging tracing, etc.  Using the header
+be things like timestamps, debugging tracing, etc.  Using the header
 size you should be able to skip this data and read the payload safely
 if you don't know the info ID.
 
@@ -61,7 +61,7 @@
 Header will be padded out to next 4-byte boundary with `0x00`.
 
 Max frame size is `0x3FFFFFFF`, which is slightly less than `HTTP_MAGIC`.
-This allows us to distingush between different (older) transports.
+This allows us to distinguish between different (older) transports.
 
 ### Transform IDs:
 
diff --git a/doc/specs/idl.md b/doc/specs/idl.md
index 7563310..39b2ddd 100644
--- a/doc/specs/idl.md
+++ b/doc/specs/idl.md
@@ -104,7 +104,7 @@
 
 ### Field Requiredness
 
-There are two explicit requiredness values, and a third one that is applied implicity if neither  *required* nor *optional* are given: *default* requiredness.
+There are two explicit requiredness values, and a third one that is applied implicitly if neither  *required* nor *optional* are given: *default* requiredness.
 
     [18] FieldReq        ::=  'required' | 'optional' 
 
@@ -144,7 +144,7 @@
 
 ### XSD Options
 
-N.B.: These have  some internal purpose at Facebook but serve no current purpose in Thrift. Use of these options is strongly discouraged.
+N.B.: These have some internal purpose at Facebook but serve no current purpose in Thrift. The use of these options is strongly discouraged.
 
     [19] XsdFieldOptions ::=  'xsd_optional'? 'xsd_nillable'? XsdAttrs?
 
@@ -236,7 +236,7 @@
 Why does position of `CppType` vary between `SetType` and `ListType`?
 
  * std::set does sort the elements automatically, that's the design. see [Thrift Types](/docs/types) or the [C++ std:set reference][] for further details
- * The question is, how other languages are doing that? What about custom objects, do they have a Compare function the set the order correctly?
+ * The question is, how other languages are doing that? What about custom objects, do they have a Compare function to set the order correctly?
 
  [C++ std:set reference]: http://www.cplusplus.com/reference/stl/set/
 
diff --git a/doc/specs/thrift-binary-protocol.md b/doc/specs/thrift-binary-protocol.md
index a852685..fc3338f 100644
--- a/doc/specs/thrift-binary-protocol.md
+++ b/doc/specs/thrift-binary-protocol.md
@@ -24,10 +24,10 @@
 --------------------------------------------------------------------
 -->
 
-This documents describes the wire encoding for RPC using the older Thrift *binary protocol*.
+This document describes the wire encoding for RPC using the older Thrift *binary protocol*.
 
 The information here is _mostly_ based on the Java implementation in the Apache thrift library (version 0.9.1 and
-0.9.3). Other implementation however, should behave the same.
+0.9.3). Other implementation, however, should behave the same.
 
 For background on Thrift see the [Thrift whitepaper (pdf)](https://thrift.apache.org/static/files/thrift-20070401.pdf).
 
@@ -150,7 +150,7 @@
 Note that the field name is not encoded so field renames in the IDL do not affect forward and backward compatibility.
 
 The default Java implementation (Apache Thrift 0.9.1) has undefined behavior when it tries to decode a field that has
-another field-type then what is expected. Theoretically this could be detected at the cost of some additional checking.
+another field-type than what is expected. Theoretically, this could be detected at the cost of some additional checking.
 Other implementation may perform this check and then either ignore the field, or return a protocol exception.
 
 A *Union* is encoded exactly the same as a struct with the additional restriction that at most 1 field may be encoded.
@@ -213,7 +213,7 @@
 
 The element-type values are the same as field-types. The full list is included in the struct section above.
 
-The maximum list/set size is configurable. By default there is no limit (meaning the limit is the maximum int32 value:
+The maximum list/set size is configurable. By default, there is no limit (meaning the limit is the maximum int32 value:
 2147483647).
 
 ## Map
diff --git a/doc/specs/thrift-protocol-spec.md b/doc/specs/thrift-protocol-spec.md
index 0c1a61c..080487e 100644
--- a/doc/specs/thrift-protocol-spec.md
+++ b/doc/specs/thrift-protocol-spec.md
@@ -33,7 +33,7 @@
 structure. There are some "dumb" terminals like STRING and INT
 that take the place of an actual encoding specification.
 
-They key point to notice is that ALL messages are just one wrapped
+The key point to notice is that ALL messages are just one wrapped
 `<struct>`. Depending upon the message type, the `<struct>` can be
 interpreted as the argument list to a function, the return value
 of a function, or an exception.
diff --git a/doc/specs/thrift-rpc.md b/doc/specs/thrift-rpc.md
index d45c06f..fbff3b6 100644
--- a/doc/specs/thrift-rpc.md
+++ b/doc/specs/thrift-rpc.md
@@ -24,15 +24,15 @@
 --------------------------------------------------------------------
 -->
 
-This document describes the high level message exchange between the Thrift RPC client and server.
+This document describes the high-level message exchange between the Thrift RPC client and server.
 See [thrift-binary-protocol.md] and [thrift-compact-protocol.md] for a description of how the exchanges are encoded on
 the wire.
 
-In addition, this document compares the binary protocol with the compact protocol. Finally it describes the framed vs.
+In addition, this document compares the binary protocol with the compact protocol. Finally, it describes the framed vs.
 unframed transport.
 
 The information here is _mostly_ based on the Java implementation in the Apache thrift library (version 0.9.1 and
-0.9.3). Other implementation however, should behave the same.
+0.9.3). Other implementation, however, should behave the same.
 
 For background on Thrift see the [Thrift whitepaper (pdf)](https://thrift.apache.org/static/files/thrift-20070401.pdf).
 
@@ -93,14 +93,14 @@
 not encode or decode a message or struct.
 
 In the Java implementation (0.9.3) there is different behavior for the synchronous and asynchronous server. In the async
-server all exceptions are send as a `TApplicationException` (see 'Response struct' below). In the synchronous Java
+server all exceptions are sent as a `TApplicationException` (see 'Response struct' below). In the synchronous Java
 implementation only (undeclared) exceptions that extend `TException` are send as a `TApplicationException`. Unchecked
 exceptions lead to an immediate close of the connection.
 
 Type `Oneway` is only used starting from Apache Thrift 0.9.3. Earlier versions do _not_ send TMessages of type `Oneway`,
 even for service methods defined with the `oneway` modifier.
 
-When client sends a request with type `Oneway`, the server must _not_ send a response (steps 3 and 4 are skipped). Note
+When the client sends a request with type `Oneway`, the server must _not_ send a response (steps 3 and 4 are skipped). Note
 that the Thrift IDL enforces a return type of `void` and does not allow exceptions for oneway services.
 
 ## Request struct
@@ -151,7 +151,7 @@
 ## Compatibility
 
 A server could automatically determine whether a client talks the binary protocol or the compact protocol by
-investigating the first byte. If the value is `1000 0001` or `0000 0000` (assuming a name shorter then ±16 MB) it is the
+investigating the first byte. If the value is `1000 0001` or `0000 0000` (assuming a name shorter than ±16 MB) it is the
 binary protocol. When the value is `1000 0010` it is talking the compact protocol.
 
 ## Framed vs. unframed transport
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.c
index 6873011..8354f80 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.c
@@ -36,7 +36,7 @@
 thrift_server_transport_updateKnownMessageSize(ThriftServerTransport *transport, glong size, GError **error)
 {
   gboolean boolean = TRUE;
-  ThriftServerTransport *tst = THRIFT_TRANSPORT (transport);
+  ThriftServerTransport *tst = THRIFT_SERVER_TRANSPORT (transport);
   ThriftServerTransportClass *tstc = THRIFT_SERVER_TRANSPORT_GET_CLASS (transport);
   glong consumed = tst->knowMessageSize_ - tst->remainingMessageSize_;
   if(!tstc->resetConsumedMessageSize (transport, size, error))
@@ -176,6 +176,7 @@
 thrift_server_transport_class_init (ThriftServerTransportClass *c)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (c);
+  ThriftServerTransportClass *tstc = THRIFT_SERVER_TRANSPORT_CLASS (c);
   GParamSpec *param_spec = NULL;
   
   /* setup accessors and mutators */
@@ -216,10 +217,10 @@
   c->listen = thrift_server_transport_listen;
   c->accept = thrift_server_transport_accept;
   c->close = thrift_server_transport_close;
-  c->updateKnownMessageSize = thrift_server_transport_updateKnownMessageSize;
-  c->checkReadBytesAvailable = thrift_server_transport_checkReadBytesAvailable;
-  c->resetConsumedMessageSize = thrift_server_transport_resetConsumedMessageSize;
-  c->countConsumedMessageBytes = thrift_server_transport_countConsumedMessageBytes;
+  tstc->updateKnownMessageSize = thrift_server_transport_updateKnownMessageSize;
+  tstc->checkReadBytesAvailable = thrift_server_transport_checkReadBytesAvailable;
+  tstc->resetConsumedMessageSize = thrift_server_transport_resetConsumedMessageSize;
+  tstc->countConsumedMessageBytes = thrift_server_transport_countConsumedMessageBytes;
 }
 
 static void
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.h b/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.h
index 0fb55c0..9bf7901 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.h
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_server_transport.h
@@ -63,10 +63,10 @@
   gboolean (*listen) (ThriftServerTransport *transport, GError **error);
   ThriftTransport *(*accept) (ThriftServerTransport *transport, GError **error);
   gboolean (*close) (ThriftServerTransport *transport, GError **error);
-  gboolean (*updateKnownMessageSize) (ThriftTransport *transport, glong size, GError **error);
-  gboolean (*checkReadBytesAvailable) (ThriftTransport *transport, glong numBytes, GError **error);
-  gboolean (*resetConsumedMessageSize) (ThriftTransport *transport, glong newSize, GError **error);
-  gboolean (*countConsumedMessageBytes) (ThriftTransport *transport, glong numBytes, GError **error);
+  gboolean (*updateKnownMessageSize) (ThriftServerTransport *transport, glong size, GError **error);
+  gboolean (*checkReadBytesAvailable) (ThriftServerTransport *transport, glong numBytes, GError **error);
+  gboolean (*resetConsumedMessageSize) (ThriftServerTransport *transport, glong newSize, GError **error);
+  gboolean (*countConsumedMessageBytes) (ThriftServerTransport *transport, glong numBytes, GError **error);
 };
 
 /* used by THRIFT_TYPE_SERVER_TRANSPORT */
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c
index 3778302..0afcb1b 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c
@@ -69,6 +69,8 @@
 /* This array will store all of the mutexes available to OpenSSL. */
 static MUTEX_TYPE *thrift_ssl_socket_global_mutex_buf=NULL;
 
+gboolean
+thrift_ssl_socket_authorize(ThriftTransport * transport, GError **error);
 
 /**
  * OpenSSL uniq id function.
@@ -245,7 +247,7 @@
       gchar byte;
       rc = SSL_peek(ssl_socket->ssl, &byte, 1);
       if (rc < 0) {
-	  thrift_ssl_socket_get_ssl_error(ssl_socket, "Check socket data",
+	  thrift_ssl_socket_get_ssl_error(ssl_socket, (const guchar*)"Check socket data",
 					  THRIFT_SSL_SOCKET_ERROR_SSL, rc, error);
       }
       if (rc == 0) {
@@ -315,7 +317,7 @@
 	      continue;
 	  }
       }else{
-	  thrift_ssl_socket_get_ssl_error(ssl_socket, "Receive error",
+	  thrift_ssl_socket_get_ssl_error(ssl_socket, (const guchar*)"Receive error",
 					  THRIFT_SSL_SOCKET_ERROR_SSL, bytes, error);
 
       }
@@ -351,7 +353,7 @@
       ret = SSL_write (ssl_socket->ssl, (guint8 *)buf + sent, len - sent);
       if (ret < 0)
 	{
-	  thrift_ssl_socket_get_ssl_error(ssl_socket, "Send error",
+	  thrift_ssl_socket_get_ssl_error(ssl_socket, (const guchar*)"Send error",
 					  THRIFT_SSL_SOCKET_ERROR_SSL, ret, error);
 	  return FALSE;
 	}
@@ -423,7 +425,7 @@
 	  rc = SSL_connect(ssl_socket->ssl);
       }
       if (rc <= 0) {
-	  thrift_ssl_socket_get_ssl_error(ssl_socket, "Error while connect/bind", THRIFT_SSL_SOCKET_ERROR_CONNECT_BIND, rc, error);
+	  thrift_ssl_socket_get_ssl_error(ssl_socket, (const guchar*)"Error while connect/bind", THRIFT_SSL_SOCKET_ERROR_CONNECT_BIND, rc, error);
 	  return FALSE;
       }
   }else
@@ -851,7 +853,7 @@
   }
 
   if (context == NULL) {
-      thrift_ssl_socket_get_error("No cipher overlay", THRIFT_SSL_SOCKET_ERROR_CIPHER_NOT_AVAILABLE, error);
+      thrift_ssl_socket_get_error((const guchar*)"No cipher overlay", THRIFT_SSL_SOCKET_ERROR_CIPHER_NOT_AVAILABLE, error);
       return NULL;
   }
   SSL_CTX_set_mode(context, SSL_MODE_AUTO_RETRY);
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_transport.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_transport.c
index b876b07..9d3f25e 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_transport.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_transport.c
@@ -309,6 +309,7 @@
   /* setup accessors and mutators */
   gobject_class->get_property = thrift_transport_get_property;
   gobject_class->set_property = thrift_transport_set_property;
+  gobject_class->dispose = thrift_transport_dispose;
   
   param_spec = g_param_spec_object ("configuration",
                                     "configuration (construct)",
diff --git a/lib/c_glib/test/testmemorybuffer.c b/lib/c_glib/test/testmemorybuffer.c
index 9fb68b9..cc9c56c 100755
--- a/lib/c_glib/test/testmemorybuffer.c
+++ b/lib/c_glib/test/testmemorybuffer.c
@@ -186,7 +186,6 @@
 test_read_and_write_external (void)
 {
   ThriftMemoryBuffer *tbuffer = NULL;
-  gchar *b;
   GError *error = NULL;
   GByteArray *buf = g_byte_array_new ();
   g_assert (buf != NULL);
diff --git a/lib/c_glib/test/testthriftbinaryreadcheck.c b/lib/c_glib/test/testthriftbinaryreadcheck.c
index 36454ca..f1caba8 100644
--- a/lib/c_glib/test/testthriftbinaryreadcheck.c
+++ b/lib/c_glib/test/testthriftbinaryreadcheck.c
@@ -173,7 +173,7 @@
                             "port", port, "path", NULL, 
                             "configuration", tconfiguration, NULL);
     transport = THRIFT_TRANSPORT (tsocket);
-    THRIFT_TRANSPORT_GET_CLASS (tsocket)->resetConsumedMessageSize(tsocket, -1, NULL);
+    THRIFT_TRANSPORT_GET_CLASS (tsocket)->resetConsumedMessageSize(THRIFT_TRANSPORT (tsocket), -1, NULL);
     thrift_transport_open (transport, NULL);
     g_assert (thrift_transport_is_open (transport));
 
@@ -221,9 +221,7 @@
     ThriftType element_type = T_VOID, 
                key_type = T_VOID, 
                value_type = T_VOID; 
-    gint32 ret = 0;
     guint32 size = 0;
-    glong tempsize = 0;
 
     ThriftConfiguration *tconfiguration = g_object_new (THRIFT_TYPE_CONFIGURATION,
                                                         "max_message_size", MAX_MESSAGE_SIZE,
diff --git a/lib/c_glib/test/testthriftbufferedreadcheck.c b/lib/c_glib/test/testthriftbufferedreadcheck.c
index 1472072..4870ae8 100755
--- a/lib/c_glib/test/testthriftbufferedreadcheck.c
+++ b/lib/c_glib/test/testthriftbufferedreadcheck.c
@@ -38,7 +38,6 @@
 static void
 test_open_and_close(void)
 {
-  ThriftConfiguration *tconfiguration = NULL;
   ThriftSocket *tsocket = NULL;
   ThriftTransport *transport = NULL;
   GError *err = NULL;
diff --git a/lib/c_glib/test/testthriftcompactreadcheck.c b/lib/c_glib/test/testthriftcompactreadcheck.c
index 03466ae..e2547d4 100644
--- a/lib/c_glib/test/testthriftcompactreadcheck.c
+++ b/lib/c_glib/test/testthriftcompactreadcheck.c
@@ -217,7 +217,7 @@
   ThriftTransport *client = NULL;
   ThriftCompactProtocol *tc = NULL;
   ThriftProtocol *protocol = NULL;
-  ThriftType element_type, key_type, value_type, field_type;
+  ThriftType element_type, key_type, value_type;
   guint32 size = 0;
 
   ThriftConfiguration *tconfiguration = g_object_new (THRIFT_TYPE_CONFIGURATION, "max_message_size", MAX_MESSAGE_SIZE,
diff --git a/lib/c_glib/test/testtransportsslsocket.c b/lib/c_glib/test/testtransportsslsocket.c
index 3c2644d..ba9ffdc 100644
--- a/lib/c_glib/test/testtransportsslsocket.c
+++ b/lib/c_glib/test/testtransportsslsocket.c
@@ -103,7 +103,7 @@
   GError *error=NULL;
 
   GObject *object = NULL;
-  object = thrift_ssl_socket_new(SSLTLS, &error);
+  object = (GObject *)thrift_ssl_socket_new(SSLTLS, &error);
   g_object_get (G_OBJECT(object), "hostname", &hostname, "port", &port, "ssl_context", &ssl_ctx, NULL);
   g_assert (ssl_ctx!=NULL);
 
@@ -180,7 +180,6 @@
   ThriftSSLSocket *tSSLSocket = NULL;
   ThriftTransport *transport = NULL;
   GError *error=NULL;
-  char buffer[] = "this must not break";
 
   /* open a connection and close it */
   tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", 51188+1, &error);
@@ -267,13 +266,13 @@
   /* loop through all the results and connect to the first we can */
   char dnshost[INET6_ADDRSTRLEN]; /* bigger addr supported IPV6 */
   char socket_ip[INET6_ADDRSTRLEN];
-  if(inet_ntop(addr->ss_family, get_in_addr(addr), socket_ip, INET6_ADDRSTRLEN)==socket_ip){
+  if(inet_ntop(addr->ss_family, get_in_addr((struct sockaddr*)addr), socket_ip, INET6_ADDRSTRLEN)==socket_ip){
       g_debug("We are connected to host %s checking against certificate...", socket_ip);
       int sizeip = socket_ip!=NULL ? strlen(socket_ip) : 0;
       for(p = addr_info; p != NULL; p = p->ai_next) {
 	  if(inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), dnshost, INET6_ADDRSTRLEN)==dnshost){
 	      if(dnshost!=NULL){
-		  g_info("DNS address [%i -> %s]", p->ai_addr, dnshost);
+		  g_info("DNS address [%i -> %s]", ((guint32)(p->ai_addrlen)), dnshost);
 		  if(!strncmp(dnshost, socket_ip, sizeip)){
 		      retval=1;
 		      break; /* if we get here, we must have connected successfully */
@@ -289,7 +288,7 @@
   return retval;
 }
 
-static void
+static void 
 read_from_file(char *buffer, long size, const char *file_name)
 {
   char ch;
@@ -330,7 +329,7 @@
   }
   char *tmp = BN_bn2dec(bn);
   if (!tmp) {
-      g_warning(stderr, "unable to convert BN to decimal string.\n");
+      g_warning((const char*)stderr, "unable to convert BN to decimal string.\n");
       BN_free(bn);
       return EXIT_FAILURE;
   }
@@ -342,7 +341,7 @@
       return EXIT_FAILURE;
     }
   */
-  if(!strncmp(serial_number, tmp, strlen(serial_number))){
+  if(!strncmp((const char*)serial_number, tmp, strlen((const char*)serial_number))){
       retval=TRUE;
   }else{
       g_warning("Serial number is not valid");
@@ -356,6 +355,8 @@
 gboolean my_access_manager(ThriftTransport * transport, X509 *cert, struct sockaddr_storage *addr, GError **error)
 {
   ThriftSSLSocket *sslSocket = THRIFT_SSL_SOCKET (transport);
+  THRIFT_UNUSED_VAR (error);
+  THRIFT_UNUSED_VAR (sslSocket);
 
   g_info("Processing access to the server");
   X509_NAME* iname = cert ? X509_get_issuer_name(cert) : NULL;
@@ -368,11 +369,11 @@
       g_info("Issuer (cn) %s", issuer);
 
       /* Issuer pinning */
-      if(strncmp(ISSUER_CN_PINNING, issuer, strlen(ISSUER_CN_PINNING))){
+      if(strncmp(ISSUER_CN_PINNING, (const char*)issuer, strlen(ISSUER_CN_PINNING))){
 	  g_warning("The Issuer of the certificate is not valid");
 	  valid=FALSE;
       }
-      OPENSSL_free(issuer);
+      OPENSSL_free((void*)issuer);
       if(!valid)
 	return valid;
   }
@@ -385,7 +386,7 @@
       gboolean valid = TRUE;
 
       /* Subject pinning */
-      if(strncmp(SUBJECT_CN_PINNING, subject, strlen(SUBJECT_CN_PINNING))){
+      if(strncmp(SUBJECT_CN_PINNING, (const char*)subject, strlen(SUBJECT_CN_PINNING))){
 	  g_warning("The subject of the certificate is not valid");
 	  valid=FALSE;
       }
@@ -394,19 +395,19 @@
 	return valid;
 
       /* Host pinning       */
-      if(verify_ip(subject, addr)){
+      if(verify_ip((char*)subject, addr)){
 	  g_info("Verified subject");
       }else{
 	  g_info("Cannot verify subject");
 	  valid=FALSE;
       }
-      OPENSSL_free(subject);
+      OPENSSL_free((void*)subject);
 
       if(!valid)
 	return valid;
   }
 
-  if(!verify_certificate_sn(cert, CERT_SERIAL_NUMBER)){
+  if(!verify_certificate_sn(cert, (const unsigned char*)CERT_SERIAL_NUMBER)){
       return FALSE;
   }else{
       g_info("Verified serial number");
@@ -487,7 +488,7 @@
   ThriftServerTransport *transport = NULL;
   ThriftTransport *client = NULL;
   guchar buf[10]; /* a buffer */
-  guchar match[10] = TEST_DATA;
+  guchar match[] = TEST_DATA;
 
   ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
 					      "port", port, NULL);
diff --git a/lib/delphi/src/Thrift.Transport.WinHTTP.pas b/lib/delphi/src/Thrift.Transport.WinHTTP.pas
index 5794b1c..b0f32ef 100644
--- a/lib/delphi/src/Thrift.Transport.WinHTTP.pas
+++ b/lib/delphi/src/Thrift.Transport.WinHTTP.pas
@@ -333,6 +333,8 @@
     else raise TTransportExceptionInterrupted.Create( sMsg);
   end;
 
+  // we're about to receive a new message, so reset everyting
+  ResetConsumedMessageSize(-1);
   FInputStream := THTTPResponseStream.Create( http);
   if http.QueryTotalResponseSize( dwSize)  // FALSE indicates "no info available"
   then UpdateKnownMessageSize( dwSize);
diff --git a/lib/delphi/src/Thrift.Transport.pas b/lib/delphi/src/Thrift.Transport.pas
index 1b8300c..6a69d93 100644
--- a/lib/delphi/src/Thrift.Transport.pas
+++ b/lib/delphi/src/Thrift.Transport.pas
@@ -110,7 +110,7 @@
     function  MaxMessageSize : Integer;
     property  RemainingMessageSize : Int64 read FRemainingMessageSize;
     property  KnownMessageSize : Int64 read FKnownMessageSize;
-    procedure ResetConsumedMessageSize( const newSize : Int64 = -1); inline;
+    procedure ResetConsumedMessageSize( const newSize : Int64 = -1);
     procedure UpdateKnownMessageSize(const size : Int64); override;
     procedure CheckReadBytesAvailable(const numBytes : Int64); inline;
     procedure CountConsumedMessageBytes(const numBytes : Int64); inline;
diff --git a/lib/py/src/ext/protocol.tcc b/lib/py/src/ext/protocol.tcc
index 03cfc9b..aad5a3c 100644
--- a/lib/py/src/ext/protocol.tcc
+++ b/lib/py/src/ext/protocol.tcc
@@ -705,7 +705,7 @@
       return nullptr;
     }
     if (isUtf8(typeargs)) {
-      return PyUnicode_DecodeUTF8(buf, len, 0);
+      return PyUnicode_DecodeUTF8(buf, len, "replace");
     } else {
       return PyBytes_FromStringAndSize(buf, len);
     }