trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [30/50] git commit: TS-1739: Fix TODO within varFloatFromName()
Date Sat, 09 Mar 2013 00:48:36 GMT
TS-1739: Fix TODO within varFloatFromName()

Return value from RecGetRecordDataType() should be checked, and
fix harmless but weird conversion type.

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Zhao Yongming <ming.zym@gmail.com>


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

Branch: refs/heads/3.3.x
Commit: b2bacd7ad09bbea466779677df0e5f4f36c83221
Parents: 2ecb997
Author: Yunkai Zhang <qiushu.zyk@taobao.com>
Authored: Wed Feb 27 23:33:37 2013 +0800
Committer: Zhao Yongming <ming.zym@gmail.com>
Committed: Sat Mar 2 21:00:36 2013 -0800

----------------------------------------------------------------------
 CHANGES                    |    3 +++
 mgmt/utils/WebMgmtUtils.cc |   11 ++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b2bacd7a/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 15c0fed..9b29ff7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.3.1
 
+  *) [TS-1739] Fix TODO within varFloatFromName()
+   Author: Yunkai Zhang <qiushu.zyk@taobao.com>
+
   *) [TS-1559] Server side termination not handled properly when a PluginVC 
    Protocol Plugin is used. Author: Yossi Gottlieb.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b2bacd7a/mgmt/utils/WebMgmtUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/utils/WebMgmtUtils.cc b/mgmt/utils/WebMgmtUtils.cc
index e2ed374..8118fca 100644
--- a/mgmt/utils/WebMgmtUtils.cc
+++ b/mgmt/utils/WebMgmtUtils.cc
@@ -311,8 +311,13 @@ varFloatFromName(const char *varName, RecFloat * value)
   RecDataT varDataType = RECD_NULL;
   bool found = true;
 
-  // TODO: should we check for return code / error here?
-  RecGetRecordDataType((char *) varName, &varDataType);
+  int err = REC_ERR_FAIL;
+
+  err = RecGetRecordDataType((char *) varName, &varDataType);
+
+  if (err == REC_ERR_FAIL) {
+    return false;
+  }
 
   switch (varDataType) {
   case RECD_INT:{
@@ -324,7 +329,7 @@ varFloatFromName(const char *varName, RecFloat * value)
   case RECD_COUNTER:{
       RecCounter tempCounter = 0;
       RecGetRecordCounter((char *) varName, &tempCounter);
-      *value = (RecCounter) tempCounter;
+      *value = (RecFloat) tempCounter;
       break;
     }
   case RECD_FLOAT:{


Mime
View raw message