Kaynağa Gözat

fixed warnings

ncannasse 6 yıl önce
ebeveyn
işleme
331bc40293
2 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  1. 2 2
      libs/mysql/my_api.c
  2. 2 2
      libs/mysql/my_proto.c

+ 2 - 2
libs/mysql/my_api.c

@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <memory.h>
 #include <stdio.h>
+#include <string.h>
 #include "my_proto.h"
 
 #ifdef OS_WINDOWS
@@ -138,7 +139,6 @@ MYSQL *mysql_real_connect( MYSQL *m, const char *host, const char *user, const c
 	// process handshake packet
 	{
 		char filler[13];
-		unsigned int len;
 		m->infos.proto_version = myp_read_byte(p);
 		// this seems like an error packet
 		if( m->infos.proto_version == 0xFF ) {
@@ -154,7 +154,7 @@ MYSQL *mysql_real_connect( MYSQL *m, const char *host, const char *user, const c
 		m->infos.server_charset = myp_read_byte(p);
 		m->infos.server_status = myp_read_ui16(p);
 		m->infos.server_flags |= myp_read_ui16(p) << 16;
-		len = myp_read_byte(p);
+		myp_read_byte(p); // len
 		myp_read(p,filler,10);
 		// try to disable 41
 		m->is41 = (m->infos.server_flags & FL_PROTOCOL_41) != 0;

+ 2 - 2
libs/mysql/my_proto.c

@@ -256,7 +256,7 @@ void myp_encrypt_password( const char *pass, const char *seed, SHA1_DIGEST out )
 	SHA1_DIGEST hash_stage1, hash_stage2;
 	// stage 1: hash password
 	sha1_init(&ctx);
-	sha1_update(&ctx,pass,strlen(pass));;
+	sha1_update(&ctx,(unsigned char*)pass,strlen(pass));;
 	sha1_final(&ctx,hash_stage1);
 	// stage 2: hash stage 1; note that hash_stage2 is stored in the database
 	sha1_init(&ctx);
@@ -264,7 +264,7 @@ void myp_encrypt_password( const char *pass, const char *seed, SHA1_DIGEST out )
 	sha1_final(&ctx, hash_stage2);
 	// create crypt string as sha1(message, hash_stage2)
 	sha1_init(&ctx);
-	sha1_update(&ctx, seed, SHA1_SIZE);
+	sha1_update(&ctx, (unsigned char*)seed, SHA1_SIZE);
 	sha1_update(&ctx, hash_stage2, SHA1_SIZE);
 	sha1_final( &ctx, out );
 	// xor the result