Squid C code does not need `libmiscencoding` anymore.
These changes are limited to making renamed files compile cleanly using
a C++ compiler. Library code still needs to be updated to follow best
C++ practices.
==============================================================================
include/base64.h:
-lib/base64.c:
+lib/base64.cc:
/*
Copyright (C) 2002 Niels Möller, Dan Egnor
==============================================================================
include/md5.h,
-lib/md5.c:
+lib/md5.cc:
* The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
==============================================================================
include/rfc2617.h,
-lib/rfc2617.c:
+lib/rfc2617.cc:
* The source in this file is derived from the reference implementation
* in RFC 2617.
==============================================================================
-lib/base64.c::base64_encode():
+lib/base64.cc::base64_encode():
Adopted from http://ftp.sunet.se/pub2/gnu/vm/base64-encode.c.
Modified to work with strings instead of files.
not, see http://www.gnu.org/licenses/.
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Base64 encoding */
/* Maximum length of output for base64_encode_update. NOTE: Doesn't
int
base64_decode_final(struct base64_decode_ctx *ctx);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* HAVE_NETTLE_BASE64_H */
/// Calculate the buffer size required to hold the encoded form of
#ifndef SQUID_INCLUDE_RFC1738_H
#define SQUID_INCLUDE_RFC1738_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Encoder rfc1738_do_escape flag values. */
#define RFC1738_ESCAPE_CTRLS 1
#define RFC1738_ESCAPE_UNSAFE 2
*/
extern void rfc1738_unescape(char *url);
-#ifdef __cplusplus
-}
-#endif
#endif /* SQUID_INCLUDE_RFC1738_H */
#ifndef SQUID_INCLUDE_RFC2617_H
#define SQUID_INCLUDE_RFC2617_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#define HASHLEN 16
typedef char HASH[HASHLEN];
#define HASHHEXLEN 32
extern void CvtBin(const HASHHEX Hex, HASH Bin);
-#ifdef __cplusplus
-}
-#endif
#endif /* SQUID_INCLUDE_RFC2617_H */
getopt.c
libmiscencoding_la_SOURCES = \
- base64.c \
- md5.c \
- rfc1738.c \
- rfc2617.c
+ base64.cc \
+ md5.cc \
+ rfc1738.cc \
+ rfc2617.cc
libmisccontainers_la_SOURCES = \
hash.cc
assert(out == dst);
}
-static const char base64_encode_table[64] =
+static const auto base64_encode_table =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
void
SquidMD5Update(struct SquidMD5Context *ctx, const void *_buf, unsigned len)
{
- uint8_t const *buf = _buf;
+ auto buf = static_cast<const uint8_t *>(_buf);
uint32_t t;
/* Update byte count */
void
SquidMD5Transform(uint32_t buf[4], uint32_t const in[16])
{
- register uint32_t a, b, c, d;
+ uint32_t a, b, c, d;
a = buf[0];
b = buf[1];
#include <cppunit/extensions/HelperMacros.h>
/* Being a C library code it is best bodily included and tested with C++ type-safe techniques. */
-#include "lib/rfc1738.c"
+#include "lib/rfc1738.cc"
/**
* Test the URL coder RFC 1738 Engine