Skip to content

Commit

Permalink
More refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
yvoinov committed Jun 26, 2021
1 parent 0bb245c commit 3601c1d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ Version 1.6.0.5 (2020-05-19)

Version 1.6.5.7 (2021-06-25)
* IMPROVEMENT: Refactoring - moved log functions to class, replaced most C-casts, minor improvements. By Yuri Voinov.

Version 1.6.5.8 (2021-06-26)
* IMPROVEMENT: More refactoring. By Yuri Voinov.
23 changes: 12 additions & 11 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for eCAP GZIP DEFLATE Adapter 1.6.0.7.
# Generated by GNU Autoconf 2.69 for eCAP GZIP DEFLATE Adapter 1.6.0.8.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='eCAP GZIP DEFLATE Adapter'
PACKAGE_TARNAME='squid-ecap-gzip'
PACKAGE_VERSION='1.6.0.7'
PACKAGE_STRING='eCAP GZIP DEFLATE Adapter 1.6.0.7'
PACKAGE_VERSION='1.6.0.8'
PACKAGE_STRING='eCAP GZIP DEFLATE Adapter 1.6.0.8'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1330,7 +1330,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures eCAP GZIP DEFLATE Adapter 1.6.0.7 to adapt to many kinds of systems.
\`configure' configures eCAP GZIP DEFLATE Adapter 1.6.0.8 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1400,7 +1400,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of eCAP GZIP DEFLATE Adapter 1.6.0.7:";;
short | recursive ) echo "Configuration of eCAP GZIP DEFLATE Adapter 1.6.0.8:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1516,7 +1516,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
eCAP GZIP DEFLATE Adapter configure 1.6.0.7
eCAP GZIP DEFLATE Adapter configure 1.6.0.8
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2002,7 +2002,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by eCAP GZIP DEFLATE Adapter $as_me 1.6.0.7, which was
It was created by eCAP GZIP DEFLATE Adapter $as_me 1.6.0.8, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -2352,13 +2352,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu


LIBADAPTER_CURRENT=6
LIBADAPTER_REVISION=2
LIBADAPTER_REVISION=3
LIBADAPTER_AGE=1

# 1.6.0.3 had 6:0:1
# 1.6.0.4 had 6:0:1
# 1.6.0.5 had 6:1:1
# 1.6.0.7 had 6:2:1
# 1.6.0.8 had 6:3:1

# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
Expand Down Expand Up @@ -2898,7 +2899,7 @@ fi

# Define the identity of the package.
PACKAGE='squid-ecap-gzip'
VERSION='1.6.0.7'
VERSION='1.6.0.8'


cat >>confdefs.h <<_ACEOF
Expand Down Expand Up @@ -17408,7 +17409,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by eCAP GZIP DEFLATE Adapter $as_me 1.6.0.7, which was
This file was extended by eCAP GZIP DEFLATE Adapter $as_me 1.6.0.8, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -17474,7 +17475,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
eCAP GZIP DEFLATE Adapter config.status 1.6.0.7
eCAP GZIP DEFLATE Adapter config.status 1.6.0.8
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down
5 changes: 3 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
m4_define([VERSION_MAJOR],[1])
m4_define([VERSION_MINOR],[6])
m4_define([VERSION_MICRO],[0])
m4_define([VERSION_PATCH],[7])
m4_define([VERSION_PATCH],[8])
AC_INIT(eCAP GZIP DEFLATE Adapter, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]).m4_defn([VERSION_PATCH]), [], squid-ecap-gzip)

LIBADAPTER_CURRENT=6
LIBADAPTER_REVISION=2
LIBADAPTER_REVISION=3
LIBADAPTER_AGE=1

# 1.6.0.3 had 6:0:1
# 1.6.0.4 had 6:0:1
# 1.6.0.5 had 6:1:1
# 1.6.0.7 had 6:2:1
# 1.6.0.8 had 6:3:1

# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
Expand Down
18 changes: 7 additions & 11 deletions src/adapter_gzip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ class Xaction: public libecap::adapter::Xaction {
zstream.zfree = Z_NULL;
zstream.opaque = Z_NULL;
}
};

CompressContext compresscontext;
} compresscontext;

struct Controls {
bool responseReject;
Expand All @@ -254,9 +252,7 @@ class Xaction: public libecap::adapter::Xaction {
bool requestContentXecapOk;
bool requestAcceptEncodingGzip;
bool requestAcceptEncodingDeflate;
};

Controls controlFlags;
} controlFlags;

bool requirementsAreMet();
bool gzipInitialize();
Expand Down Expand Up @@ -376,16 +372,16 @@ bool Adapter::Xaction::gzipInitialize() {
case Z_OK:
return true;
case Z_STREAM_ERROR:
Adapter::Xaction::ErrorLog(C_ERR_INVALID_PARAM, service->v_ErrLog);
ErrorLog(C_ERR_INVALID_PARAM, service->v_ErrLog);
return false;
case Z_MEM_ERROR:
Adapter::Xaction::ErrorLog(C_ERR_INSUFF_MEMORY, service->v_ErrLog);
ErrorLog(C_ERR_INSUFF_MEMORY, service->v_ErrLog);
return false;
case Z_VERSION_ERROR:
Adapter::Xaction::ErrorLog(C_ERR_VERSION_ZLIB, service->v_ErrLog);
ErrorLog(C_ERR_VERSION_ZLIB, service->v_ErrLog);
return false;
default:
Adapter::Xaction::ErrorLog(C_ERR_UNKNOWN + std::to_string(rc), service->v_ErrLog);
ErrorLog(C_ERR_UNKNOWN + std::to_string(rc), service->v_ErrLog);
return false;
}
}
Expand Down Expand Up @@ -572,7 +568,7 @@ libecap::Area Adapter::Xaction::abContent(size_type offset, size_type size) {
offset = compresscontext.sendingOffset + offset;
size = compresscontext.compressedSize - offset;
/* Compressed data need to be send */
return libecap::Area::FromTempBuffer((const char*)&compresscontext.Buffer[offset], size);
return libecap::Area::FromTempBuffer(reinterpret_cast<const char*>(&compresscontext.Buffer[offset]), size);
}

void Adapter::Xaction::abContentShift(size_type size) {
Expand Down
2 changes: 1 addition & 1 deletion src/adapter_gzip.h.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* (C) 2008 The Measurement Factory */
/* (C) 2008-2016 Constantin Rack */
/* (C) 2016-2020 Joe Lavand, Yuri Voinov */
/* (C) 2016-2021 Joe Lavand, Yuri Voinov */

#ifndef ECAP_ADAPTER_DEFINES_H
#define ECAP_ADAPTER_DEFINES_H
Expand Down

0 comments on commit 3601c1d

Please sign in to comment.