You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2014/07/23 18:14:06 UTC
git commit: TS-1475 clang analyzer: errors on sizeof
Repository: trafficserver
Updated Branches:
refs/heads/master eaef556b1 -> 08c5d2b55
TS-1475 clang analyzer: errors on sizeof
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/08c5d2b5
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/08c5d2b5
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/08c5d2b5
Branch: refs/heads/master
Commit: 08c5d2b553f09f02c27e6f3f176bdfc94cbe4c1b
Parents: eaef556
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Jul 23 10:13:56 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed Jul 23 10:13:56 2014 -0600
----------------------------------------------------------------------
example/remap/remap.cc | 2 +-
plugins/gzip/gzip.cc | 4 ----
plugins/gzip/misc.cc | 35 ++---------------------------------
plugins/gzip/misc.h | 1 -
4 files changed, 3 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08c5d2b5/example/remap/remap.cc
----------------------------------------------------------------------
diff --git a/example/remap/remap.cc b/example/remap/remap.cc
index f6d8bc0..ec51ce8 100644
--- a/example/remap/remap.cc
+++ b/example/remap/remap.cc
@@ -313,7 +313,7 @@ TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
char* tmp = (char*)TSmalloc(256);
static int my_local_counter = 0;
- size_t len = snprintf(tmp, sizeof(tmp) - 1,
+ size_t len = snprintf(tmp, 255,
"This is very small example of TS API usage!\nIteration %d!\nHTTP return code %d\n",
my_local_counter, TS_HTTP_STATUS_CONTINUE + my_local_counter);
TSHttpTxnSetHttpRetStatus((TSHttpTxn) rh, (TSHttpStatus) ((int) TS_HTTP_STATUS_CONTINUE + my_local_counter));
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08c5d2b5/plugins/gzip/gzip.cc
----------------------------------------------------------------------
diff --git a/plugins/gzip/gzip.cc b/plugins/gzip/gzip.cc
index ac654f7..ba42fdb 100644
--- a/plugins/gzip/gzip.cc
+++ b/plugins/gzip/gzip.cc
@@ -774,10 +774,6 @@ TSPluginInit(int argc, const char *argv[])
fatal("The gzip plugin failed to register");
}
- //if (argc == 2) {
- // dictionary = load_dictionary(argv[1]);
- //}
-
if (TSHttpArgIndexReserve("gzip", "for remembering if the hook was set", &arg_idx_hooked) != TS_SUCCESS) {
fatal("failed to reserve an argument index");
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08c5d2b5/plugins/gzip/misc.cc
----------------------------------------------------------------------
diff --git a/plugins/gzip/misc.cc b/plugins/gzip/misc.cc
index 7671656..5e5f107 100644
--- a/plugins/gzip/misc.cc
+++ b/plugins/gzip/misc.cc
@@ -29,6 +29,8 @@
#include <inttypes.h>
#include "debug_macros.h"
+const int DICT_SIZE = 800000;
+
voidpf
gzip_alloc(voidpf /* opaque ATS_UNUSED */, uInt items, uInt size)
{
@@ -154,39 +156,6 @@ register_plugin()
return 1;
}
-const char *
-load_dictionary(const char *preload_file)
-{
- char *dict = (char *) malloc(800000);
- uLong dictId = adler32(0L, Z_NULL, 0);
- uLong *adler = &dictId;
-
- FILE *fp;
- int i = 0;
-
- fp = fopen(preload_file, "r");
- if (!fp) {
- fatal("gzip-transform: ERROR: Unable to open dict file %s", preload_file);
- }
-
- /* dict = (char *) calloc(8000, sizeof(char)); */
-
- i = 0;
- while (!feof(fp)) {
- if (fscanf(fp, "%s\n", dict + i) == 1) {
- i = strlen(dict);
- strcat(dict + i, " ");
- ++i;
- }
- }
- dict[i - 1] = '\0';
- fclose(fp);
-
- /* TODO get the adler compute right */
- *adler = adler32(*adler, (const Byte *) dict, sizeof(dict));
- return dict;
-}
-
void
gzip_log_ratio(int64_t in, int64_t out)
{
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08c5d2b5/plugins/gzip/misc.h
----------------------------------------------------------------------
diff --git a/plugins/gzip/misc.h b/plugins/gzip/misc.h
index aa2ae16..9c86464 100644
--- a/plugins/gzip/misc.h
+++ b/plugins/gzip/misc.h
@@ -75,7 +75,6 @@ void restore_accept_encoding(TSHttpTxn txnp, TSMBuffer reqp, TSMLoc hdr_loc, con
const char * init_hidden_header_name();
int check_ts_version();
int register_plugin();
-const char *load_dictionary(const char *preload_file);
void gzip_log_ratio(int64_t in, int64_t out);
#endif