summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-19 02:46:37 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-19 02:49:41 +0300
commitc2c1322b230dc0f564397ac68615640f1083ee56 (patch)
tree9cbdf777c0636e16963f368cb9d9fc48f094ff13 /src/common
parent5b74faa8afd04771af7acb918072ea71a3db475f (diff)
downloadhercules-c2c1322b230dc0f564397ac68615640f1083ee56.tar.gz
hercules-c2c1322b230dc0f564397ac68615640f1083ee56.tar.bz2
hercules-c2c1322b230dc0f564397ac68615640f1083ee56.tar.xz
hercules-c2c1322b230dc0f564397ac68615640f1083ee56.zip
Fix some cast discards 'const' qualifier from pointer target type warnings.
Add -Wcast-qual into configure comment.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/md5calc.c6
-rw-r--r--src/common/socket.h10
2 files changed, 8 insertions, 8 deletions
diff --git a/src/common/md5calc.c b/src/common/md5calc.c
index 44f912992..bc70d9006 100644
--- a/src/common/md5calc.c
+++ b/src/common/md5calc.c
@@ -169,7 +169,7 @@ static void MD5_String2binary(const char * string, unsigned char * output)
//var
/*8bit*/
unsigned char padding_message[64]; //Extended message 512bit 64byte
- unsigned char *pstring; //The position of string in the present scanning notes is held.
+ const unsigned char *pstring; //The position of string in the present scanning notes is held.
/*32bit*/
unsigned int string_byte_len, //The byte chief of string is held.
@@ -192,7 +192,7 @@ static void MD5_String2binary(const char * string, unsigned char * output)
//Step 1.Append Padding Bits (extension of a mark bit)
//1-1
string_byte_len = (unsigned int)strlen(string); //The byte chief of a character sequence is acquired.
- pstring = (unsigned char *)string; //The position of the present character sequence is set.
+ pstring = (const unsigned char *)string; //The position of the present character sequence is set.
//1-2 Repeat calculation until length becomes less than 64 bytes.
for (i=string_byte_len; 64<=i; i-=64,pstring+=64)
@@ -200,7 +200,7 @@ static void MD5_String2binary(const char * string, unsigned char * output)
//1-3
copy_len = string_byte_len % 64; //The number of bytes which remained is computed.
- strncpy((char *)padding_message, (char *)pstring, copy_len); //A message is copied to an extended bit sequence.
+ strncpy((char *)padding_message, (const char *)pstring, copy_len); //A message is copied to an extended bit sequence.
memset(padding_message+copy_len, 0, 64 - copy_len); //It buries by 0 until it becomes extended bit length.
padding_message[copy_len] |= 0x80; //The next of a message is 1.
diff --git a/src/common/socket.h b/src/common/socket.h
index 70fbc3492..e1ea94f5a 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -85,11 +85,11 @@ struct config_setting_t;
#define WP2PTR(fd) WFIFO2PTR(fd)
// buffer I/O macros
-#define RBUFP(p,pos) (((uint8*)(p)) + (pos))
-#define RBUFB(p,pos) (*(uint8*)RBUFP((p),(pos)))
-#define RBUFW(p,pos) (*(uint16*)RBUFP((p),(pos)))
-#define RBUFL(p,pos) (*(uint32*)RBUFP((p),(pos)))
-#define RBUFQ(p,pos) (*(uint64*)RBUFP((p),(pos)))
+#define RBUFP(p,pos) (((const uint8*)(p)) + (pos))
+#define RBUFB(p,pos) (*(const uint8*)RBUFP((p),(pos)))
+#define RBUFW(p,pos) (*(const uint16*)RBUFP((p),(pos)))
+#define RBUFL(p,pos) (*(const uint32*)RBUFP((p),(pos)))
+#define RBUFQ(p,pos) (*(const uint64*)RBUFP((p),(pos)))
#define WBUFP(p,pos) (((uint8*)(p)) + (pos))
#define WBUFB(p,pos) (*(uint8*)WBUFP((p),(pos)))