Commit 1ba47e7a authored by Dan Fandrich's avatar Dan Fandrich
Browse files

Add 'const' to immutable arrays.

parent 9359498b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ size_t Curl_base64_decode(const char *src, char *dest)
}

/* ---- Base64 Encoding --- */
static char table64[]=
static const char table64[]=
  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

/*
+2 −2
Original line number Diff line number Diff line
@@ -261,7 +261,7 @@ static const char * ContentTypeForFilename (const char *filename,
    const char *extension;
    const char *type;
  };
  static struct ContentType ctts[]={
  static const struct ContentType ctts[]={
    {".gif",  "image/gif"},
    {".jpg",  "image/jpeg"},
    {".jpeg", "image/jpeg"},
@@ -1543,7 +1543,7 @@ char *Curl_FormBoundary(void)
                              the same form won't be identical */
  size_t i;

  static char table16[]="abcdef0123456789";
  static const char table16[]="abcdef0123456789";

  retstring = (char *)malloc(BOUNDARY_LENGTH+1);

+11 −11
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@

#ifndef CURL_DISABLE_CRYPTO_AUTH

#ifndef USE_SSLEAY
#if !defined(USE_SSLEAY) || !defined(USE_OPENSSL)
/* This code segment is only used if OpenSSL is not provided, as if it is
   we use the MD5-function provided there instead. No good duplicating
   code! */
@@ -67,7 +67,7 @@ struct md5_ctx {
typedef struct md5_ctx MD5_CTX;

static void MD5_Init(struct md5_ctx *);
static void MD5_Update(struct md5_ctx *, unsigned char *, unsigned int);
static void MD5_Update(struct md5_ctx *, const unsigned char *, unsigned int);
static void MD5_Final(unsigned char [16], struct md5_ctx *);

/* Constants for MD5Transform routine.
@@ -90,11 +90,11 @@ static void MD5_Final(unsigned char [16], struct md5_ctx *);
#define S43 15
#define S44 21

static void MD5Transform(UINT4 [4], unsigned char [64]);
static void MD5Transform(UINT4 [4], const unsigned char [64]);
static void Encode(unsigned char *, UINT4 *, unsigned int);
static void Decode(UINT4 *, unsigned char *, unsigned int);
static void Decode(UINT4 *, const unsigned char *, unsigned int);

static unsigned char PADDING[64] = {
static const unsigned char PADDING[64] = {
  0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
@@ -152,7 +152,7 @@ static void MD5_Init(struct md5_ctx *context)
  context.
 */
static void MD5_Update (struct md5_ctx *context,    /* context */
                        unsigned char *input, /* input block */
                        const unsigned char *input, /* input block */
                        unsigned int inputLen)      /* length of input block */
{
  unsigned int i, bufindex, partLen;
@@ -214,7 +214,7 @@ static void MD5_Final(unsigned char digest[16], /* message digest */

/* MD5 basic transformation. Transforms state based on block. */
static void MD5Transform(UINT4 state[4],
                         unsigned char block[64])
                         const unsigned char block[64])
{
  UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];

@@ -322,7 +322,7 @@ static void Encode (unsigned char *output,
   a multiple of 4.
*/
static void Decode (UINT4 *output,
                    unsigned char *input,
                    const unsigned char *input,
                    unsigned int len)
{
  unsigned int i, j;
@@ -341,7 +341,7 @@ static void Decode (UINT4 *output,
#include "md5.h"

void Curl_md5it(unsigned char *outbuffer, /* 16 bytes */
                unsigned char *input)
                const unsigned char *input)
{
  MD5_CTX ctx;
  MD5_Init(&ctx);
+1 −1
Original line number Diff line number Diff line
@@ -24,6 +24,6 @@
 ***************************************************************************/

void Curl_md5it(unsigned char *output,
                unsigned char *input);
                const unsigned char *input);

#endif
+5 −5
Original line number Diff line number Diff line
@@ -816,8 +816,8 @@ static int dprintf_formatf(
    case FORMAT_STRING:
            /* String.  */
      {
        static char null[] = "(nil)";
        char *str;
        static const char null[] = "(nil)";
        const char *str;
        size_t len;

        str = (char *) p->data.str;
@@ -830,7 +830,7 @@ static int dprintf_formatf(
            p->flags &= (~FLAGS_ALT);
          }
          else {
            str = (char *)"";
            str = "";
            len = 0;
          }
        }
@@ -875,8 +875,8 @@ static int dprintf_formatf(
        }
        else {
          /* Write "(nil)" for a nil pointer.  */
          static char strnil[] = "(nil)";
          char *point;
          static const char strnil[] = "(nil)";
          const char *point;

          width -= sizeof(strnil) - 1;
          if (p->flags & FLAGS_LEFT)
Loading