trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject [33/50] git commit: TS-1732 Do an ugly const_cast to work around an anomaly on Solaris. On linux, this cast is a "no-op", since the struct option is sane and the compile with convert it back to a const char*. Always doing the const_cast avoids #ifdef's t
Date Sat, 04 May 2013 15:30:54 GMT
TS-1732 Do an ugly const_cast to work around an anomaly on Solaris.
On linux, this cast is a "no-op", since the struct option is sane
and the compile with convert it back to a const char*. Always doing
the const_cast avoids #ifdef's to maintain.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/854c6c18
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/854c6c18
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/854c6c18

Branch: refs/heads/sphinx-docs
Commit: 854c6c18b524c749b437d18009e2b13c78cbc5ce
Parents: 8ba444a
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Sun Apr 28 13:49:31 2013 -0600
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Sun Apr 28 13:49:31 2013 -0600

----------------------------------------------------------------------
 plugins/experimental/authproxy/authproxy.cc |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/854c6c18/plugins/experimental/authproxy/authproxy.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/authproxy/authproxy.cc b/plugins/experimental/authproxy/authproxy.cc
index 4254879..b46d3d6 100644
--- a/plugins/experimental/authproxy/authproxy.cc
+++ b/plugins/experimental/authproxy/authproxy.cc
@@ -706,12 +706,15 @@ AuthProxyGlobalHook(TSCont /* cont ATS_UNUSED */, TSEvent event, void
* edata)
 static AuthOptions *
 AuthParseOptions(int argc, const char ** argv)
 {
+  // The const_cast<> here is magic to work around a flaw in the definition of struct
option
+  // on some platforms (e.g. Solaris / Illumos). On sane platforms (e.g. linux), it'll get
+  // automatically casted back to the const char*, as the struct is defined in <getopt.h>.
     static const struct option longopt[] =
     {
-        { "auth-host", required_argument, 0, 'h' },
-        { "auth-port", required_argument, 0, 'p' },
-        { "auth-transform", required_argument, 0, 't' },
-        { "force-cacheability", no_argument, 0, 'c' },
+        { const_cast<char *>("auth-host"), required_argument, 0, 'h' },
+        { const_cast<char *>("auth-port"), required_argument, 0, 'p' },
+        { const_cast<char *>("auth-transform"), required_argument, 0, 't' },
+        { const_cast<char *>("force-cacheability"), no_argument, 0, 'c' },
         {0, 0, 0, 0 }
     };
 
@@ -760,6 +763,7 @@ AuthParseOptions(int argc, const char ** argv)
 
     return options;
 }
+#undef LONGOPT_OPTION_CAST
 
 void
 TSPluginInit(int argc, const char *argv[])


Mime
View raw message