This is an automated email from the ASF dual-hosted git repository.
amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 9cc7b3a Issue #4637: Clean up / unify hex conversions. Remove hex
conversion in logging that is not used.
9cc7b3a is described below
commit 9cc7b3a7b3a5c908afd2c4938b868b938c124aa4
Author: Alan M. Carroll <[email protected]>
AuthorDate: Sun Nov 25 14:49:56 2018 -0600
Issue #4637: Clean up / unify hex conversions.
Remove hex conversion in logging that is not used.
---
CMakeLists.txt | 1 +
proxy/logging/LogFieldAliasMap.h | 30 ------------------------------
proxy/logging/LogUtils.cc | 36 ------------------------------------
3 files changed, 1 insertion(+), 66 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8abf0e..5fa91bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,6 +89,7 @@ CPP_ADD_SOURCES(proxy proxy/http)
CPP_ADD_SOURCES(proxy proxy/http2)
CPP_ADD_SOURCES(proxy proxy/http/remap)
CPP_ADD_SOURCES(proxy proxy/hdrs)
+CPP_ADD_SOURCES(proxy proxy/logging)
CPP_LIB(iocore iocore iocore)
CPP_ADD_SOURCES(iocore iocore/eventsystem)
diff --git a/proxy/logging/LogFieldAliasMap.h b/proxy/logging/LogFieldAliasMap.h
index 1d60577..9f69cc3 100644
--- a/proxy/logging/LogFieldAliasMap.h
+++ b/proxy/logging/LogFieldAliasMap.h
@@ -183,34 +183,4 @@ public:
}
};
-/*****************************************************************************
-
-The LogFieldAliasTimehex class implements a LogFieldAliasMap that converts time
-from their integer value to the "hex" notation and back.
-
- *****************************************************************************/
-
-class LogFieldAliasTimeHex : public LogFieldAliasMap
-{
-public:
- int
- asInt(char *str, IntType *time, bool /* case_sensitive ATS_UNUSED */) const
override
- {
- unsigned long a;
- // coverity[secure_coding]
- if (sscanf(str, "%lx", (unsigned long *)&a) == 1) {
- *time = (IntType)a;
- return ALL_OK;
- } else {
- return INVALID_STRING;
- }
- }
-
- int
- asString(IntType time, char *buf, size_t bufLen, size_t *numCharsPtr =
nullptr) const override
- {
- return (LogUtils::timestamp_to_hex_str(time, buf, bufLen, numCharsPtr) ?
BUFFER_TOO_SMALL : ALL_OK);
- }
-};
-
// LOG_FIELD_ALIAS_MAP_H
diff --git a/proxy/logging/LogUtils.cc b/proxy/logging/LogUtils.cc
index 94becf2..7b41463 100644
--- a/proxy/logging/LogUtils.cc
+++ b/proxy/logging/LogUtils.cc
@@ -434,42 +434,6 @@ LogUtils::remove_content_type_attributes(char *type_str,
int *type_len)
}
}
-/*-------------------------------------------------------------------------
- LogUtils::timestamp_to_hex_str
-
- This routine simply writes the given timestamp integer [time_t] in the
equivalent
- hexadecimal string format "xxxxxxxxxx" into the provided buffer [buf] of
- size [bufLen].
-
- It returns 1 if the provided buffer is not big enough to hold the
- equivalent ip string (and its null terminator), and 0 otherwise.
- If the buffer is not big enough, only the ip "segments" that completely
- fit into it are written, and the buffer is null terminated.
- -------------------------------------------------------------------------*/
-
-int
-LogUtils::timestamp_to_hex_str(unsigned ip, char *buf, size_t bufLen, size_t
*numCharsPtr)
-{
- static const char *table = "0123456789abcdef@";
- int retVal = 1;
- int shift = 28;
- if (buf && bufLen > 0) {
- if (bufLen > 8) {
- bufLen = 8;
- }
- for (retVal = 0; retVal < (int)bufLen;) {
- buf[retVal++] = (char)table[((ip >> shift) & 0xf)];
- shift -= 4;
- }
-
- if (numCharsPtr) {
- *numCharsPtr = (size_t)retVal;
- }
- retVal = (retVal == 8) ? 0 : 1;
- }
- return retVal;
-}
-
/*
int
LogUtils::ip_to_str (unsigned ip, char *str, unsigned len)