TS-2341: Cast TSHttpStatus to int to suppress compiler warning in clang

Because TSHttpStatus is an enum and has a max value less than 599, comparing
<= of a variable of that type with a constant of that magnitude will always
return true. Casting to int removes that guarantee and thus the warning.


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

Branch: refs/heads/4.1.x
Commit: d02484ae5766347fcc8a5068e3d3ff58f527f10f
Parents: d044007
Author: Phil Sorber <[email protected]>
Authored: Tue Nov 12 11:04:08 2013 -0700
Committer: Igor Galić <[email protected]>
Committed: Tue Nov 12 23:56:49 2013 +0100

----------------------------------------------------------------------
 CHANGES                                        | 2 ++
 plugins/experimental/remap_stats/remap_stats.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d02484ae/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 6ddecb7..7b730d9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.1.1
 
+  *) [TS-2341] Cast TSHttpStatus to int to suppress compiler warning in clang
+
   *) [TS-2303] Incorrect docs for negative_caching_enabled.
     Author: Thomas Jackson <[email protected]>
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d02484ae/plugins/experimental/remap_stats/remap_stats.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/remap_stats/remap_stats.c 
b/plugins/experimental/remap_stats/remap_stats.c
index 9922ea8..246796f 100644
--- a/plugins/experimental/remap_stats/remap_stats.c
+++ b/plugins/experimental/remap_stats/remap_stats.c
@@ -227,7 +227,7 @@ handle_txn_close(TSCont cont, TSEvent event ATS_UNUSED, 
void *edata)
                     stat_name = create_stat_name(remap, "status_3xx");
                 else if ((status_code >= 400) && (status_code <= 499))
                     stat_name = create_stat_name(remap, "status_4xx");
-                else if ((status_code >= 500) && (status_code <= 599))
+                else if ((status_code >= 500) && ((int)status_code <= 599))
                     stat_name = create_stat_name(remap, "status_5xx");
                 else
                     stat_name = create_stat_name(remap, "status_other");

Reply via email to