changeset 31802:ca94413ccd0e

Named initializers and most other C99isms don't work in Visual C++ .NET 2005 in C mode. This is troublesome for Instantbird. This remedies the problem for the cipher code, which allows Instantbird's libpurple build to work again. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author Florian Quèze <florian@instantbird.org>
date Sun, 13 Mar 2011 16:47:36 +0000
parents 0888025a3a5d
children ae391615dc52
files libpurple/ciphers/des.c libpurple/ciphers/gchecksum.c libpurple/ciphers/hmac.c libpurple/ciphers/md4.c libpurple/ciphers/md5.c libpurple/ciphers/rc4.c libpurple/ciphers/sha1.c libpurple/ciphers/sha256.c
diffstat 8 files changed, 162 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/ciphers/des.c	Sun Mar 13 16:43:09 2011 +0000
+++ b/libpurple/ciphers/des.c	Sun Mar 13 16:47:36 2011 +0000
@@ -460,11 +460,24 @@
 }
 
 static PurpleCipherOps DESOps = {
-	.init = des_init,
-	.uninit = des_uninit,
-	.encrypt = des_encrypt,
-	.decrypt = des_decrypt,
-	.set_key = des_set_key,
+	NULL,              /* Set option */
+	NULL,              /* Get option */
+	des_init,          /* init */
+ 	NULL,              /* reset */
+	des_uninit,        /* uninit */
+	NULL,              /* set iv */
+	NULL,              /* append */
+	NULL,              /* digest */
+	des_encrypt,       /* encrypt */
+	des_decrypt,       /* decrypt */
+	NULL,              /* set salt */
+	NULL,              /* get salt size */
+	des_set_key,       /* set key */
+	NULL,              /* get key size */
+	NULL,              /* set batch mode */
+	NULL,              /* get batch mode */
+	NULL,              /* get block size */
+	NULL               /* set key with len */
 };
 
 /******************************************************************************
@@ -798,14 +811,24 @@
 }
 
 static PurpleCipherOps DES3Ops = {
-	.init = des3_init,
-	.uninit = des3_uninit,
-	.set_iv = des3_set_iv,
-	.encrypt = des3_encrypt,
-	.decrypt = des3_decrypt,
-	.set_key = des3_set_key,
-	.set_batch_mode = des3_set_batch,
-	.get_batch_mode = des3_get_batch,
+	NULL,              /* Set option */
+	NULL,              /* Get option */
+	des3_init,         /* init */
+	NULL,              /* reset */
+	des3_uninit,       /* uninit */
+	des3_set_iv,       /* set iv */
+	NULL,              /* append */
+	NULL,              /* digest */
+	des3_encrypt,      /* encrypt */
+	des3_decrypt,      /* decrypt */
+	NULL,              /* set salt */
+	NULL,              /* get salt size */
+	des3_set_key,      /* set key */
+	NULL,              /* get key size */
+	des3_set_batch,    /* set batch mode */
+	des3_get_batch,    /* get batch mode */
+	NULL,              /* get block size */
+	NULL               /* set key with len */
 };
 
 /******************************************************************************
--- a/libpurple/ciphers/gchecksum.c	Sun Mar 13 16:43:09 2011 +0000
+++ b/libpurple/ciphers/gchecksum.c	Sun Mar 13 16:47:36 2011 +0000
@@ -108,12 +108,24 @@
 	} \
 	\
 	static PurpleCipherOps camel##Ops = { \
-		.init = lower##_init, \
-		.reset = lower##_reset, \
-		.uninit = purple_g_checksum_uninit, \
-		.append = purple_g_checksum_append, \
-		.digest = lower##_digest, \
-		.get_block_size = lower##_get_block_size, \
+		NULL,                     /* Set option */       \
+		NULL,                     /* Get option */       \
+		lower##_init,             /* init */             \
+		lower##_reset,            /* reset */            \
+		purple_g_checksum_uninit, /* uninit */           \
+		NULL,                     /* set iv */           \
+		purple_g_checksum_append, /* append */           \
+		lower##_digest,           /* digest */           \
+		NULL,                     /* encrypt */          \
+		NULL,                     /* decrypt */          \
+		NULL,                     /* set salt */         \
+		NULL,                     /* get salt size */    \
+		NULL,                     /* set key */          \
+		NULL,                     /* get key size */     \
+		NULL,                     /* set batch mode */   \
+		NULL,                     /* get batch mode */   \
+		lower##_get_block_size,   /* get block size */   \
+		NULL                      /* set key with len */ \
 	}; \
 	\
 	PurpleCipherOps * \
--- a/libpurple/ciphers/hmac.c	Sun Mar 13 16:43:09 2011 +0000
+++ b/libpurple/ciphers/hmac.c	Sun Mar 13 16:47:36 2011 +0000
@@ -191,16 +191,24 @@
 }
 
 static PurpleCipherOps HMACOps = {
-	.set_option = hmac_set_opt,
-	.get_option = hmac_get_opt,
-	.init = hmac_init,
-	.reset = hmac_reset,
-	.uninit = hmac_uninit,
-	.append = hmac_append,
-	.digest = hmac_digest,
-	.set_key = hmac_set_key,
-	.get_block_size = hmac_get_block_size,
-	.set_key_with_len = hmac_set_key_with_len,
+	hmac_set_opt,           /* Set option */
+	hmac_get_opt,           /* Get option */
+	hmac_init,               /* init */
+	hmac_reset,              /* reset */
+	hmac_uninit,             /* uninit */
+	NULL,                   /* set iv */
+	hmac_append,             /* append */
+	hmac_digest,             /* digest */
+	NULL,                   /* encrypt */
+	NULL,                   /* decrypt */
+	NULL,                   /* set salt */
+	NULL,                   /* get salt size */
+	hmac_set_key,           /* set key */
+	NULL,                   /* get key size */
+	NULL,                   /* set batch mode */
+	NULL,                   /* get batch mode */
+	hmac_get_block_size,    /* get block size */
+	hmac_set_key_with_len   /* set key with len */
 };
 
 PurpleCipherOps *
--- a/libpurple/ciphers/md4.c	Sun Mar 13 16:43:09 2011 +0000
+++ b/libpurple/ciphers/md4.c	Sun Mar 13 16:47:36 2011 +0000
@@ -270,12 +270,24 @@
 }
 
 static PurpleCipherOps MD4Ops = {
-	.init = md4_init,
-	.reset = md4_reset,
-	.uninit = md4_uninit,
-	.append = md4_append,
-	.digest = md4_digest,
-	.get_block_size = md4_get_block_size,
+	NULL,                   /* Set option */
+	NULL,                   /* Get option */
+	md4_init,               /* init */
+	md4_reset,              /* reset */
+	md4_uninit,             /* uninit */
+	NULL,                   /* set iv */
+	md4_append,             /* append */
+	md4_digest,             /* digest */
+	NULL,                   /* encrypt */
+	NULL,                   /* decrypt */
+	NULL,                   /* set salt */
+	NULL,                   /* get salt size */
+	NULL,                   /* set key */
+	NULL,                   /* get key size */
+	NULL,                   /* set batch mode */
+	NULL,                   /* get batch mode */
+	md4_get_block_size,     /* get block size */
+	NULL                    /* set key with len */
 };
 
 PurpleCipherOps *
--- a/libpurple/ciphers/md5.c	Sun Mar 13 16:43:09 2011 +0000
+++ b/libpurple/ciphers/md5.c	Sun Mar 13 16:47:36 2011 +0000
@@ -297,12 +297,24 @@
 }
 
 static PurpleCipherOps MD5Ops = {
-	.init = md5_init,
-	.reset = md5_reset,
-	.uninit = md5_uninit,
-	.append = md5_append,
-	.digest = md5_digest,
-	.get_block_size = md5_get_block_size,
+	NULL,			/* Set Option		*/
+	NULL,			/* Get Option		*/
+	md5_init,		/* init				*/
+	md5_reset,		/* reset			*/
+	md5_uninit,	/* uninit			*/
+	NULL,			/* set iv			*/
+	md5_append,	/* append			*/
+	md5_digest,		/* digest			*/
+	NULL,			/* encrypt			*/
+	NULL,			/* decrypt			*/
+	NULL,			/* set salt			*/
+	NULL,			/* get salt size	*/
+	NULL,			/* set key			*/
+	NULL,			/* get key size		*/
+	NULL,			/* set batch mode */
+	NULL,			/* get batch mode */
+	md5_get_block_size,	/* get block size */
+	NULL			/* set key with len */
 };
 
 PurpleCipherOps *
--- a/libpurple/ciphers/rc4.c	Sun Mar 13 16:43:09 2011 +0000
+++ b/libpurple/ciphers/rc4.c	Sun Mar 13 16:47:36 2011 +0000
@@ -165,14 +165,24 @@
 }
 
 static PurpleCipherOps RC4Ops = {
-	.set_option = rc4_set_opt,
-	.get_option = rc4_get_opt,
-	.init = rc4_init,
-	.reset = rc4_reset,
-	.uninit = rc4_uninit,
-	.encrypt = rc4_encrypt,
-	.set_key = rc4_set_key,
-	.get_key_size = rc4_get_key_size,
+	rc4_set_opt,   /* Set Option    */
+	rc4_get_opt,   /* Get Option    */
+	rc4_init,      /* init          */
+	rc4_reset,     /* reset         */
+	rc4_uninit,    /* uninit        */
+	NULL,          /* set iv        */
+	NULL,          /* append        */
+	NULL,          /* digest        */
+	rc4_encrypt,   /* encrypt       */
+	NULL,          /* decrypt       */
+	NULL,          /* set salt      */
+	NULL,          /* get salt size */
+	rc4_set_key,   /* set key       */
+	rc4_get_key_size, /* get key size  */
+	NULL,          /* set batch mode */
+	NULL,          /* get batch mode */
+	NULL,          /* get block size */
+	NULL           /* set key with len */
 };
 
 PurpleCipherOps *
--- a/libpurple/ciphers/sha1.c	Sun Mar 13 16:43:09 2011 +0000
+++ b/libpurple/ciphers/sha1.c	Sun Mar 13 16:47:36 2011 +0000
@@ -252,14 +252,24 @@
 }
 
 static PurpleCipherOps SHA1Ops = {
-	.set_option = sha1_set_opt,
-	.get_option = sha1_get_opt,
-	.init = sha1_init,
-	.reset = sha1_reset,
-	.uninit = sha1_uninit,
-	.append = sha1_append,
-	.digest = sha1_digest,
-	.get_block_size = sha1_get_block_size,
+	sha1_set_opt,		/* Set Option		*/
+	sha1_get_opt,		/* Get Option		*/
+	sha1_init,		/* init				*/
+	sha1_reset,		/* reset			*/
+	sha1_uninit,		/* uninit			*/
+	NULL,			/* set iv			*/
+	sha1_append,		/* append			*/
+	sha1_digest,	/* digest			*/
+	NULL,			/* encrypt			*/
+	NULL,			/* decrypt			*/
+	NULL,			/* set salt			*/
+	NULL,			/* get salt size	*/
+	NULL,			/* set key			*/
+	NULL,			/* get key size		*/
+	NULL,			/* set batch mode */
+	NULL,			/* get batch mode */
+	sha1_get_block_size,	/* get block size */
+	NULL			/* set key with len */
 };
 
 PurpleCipherOps *
--- a/libpurple/ciphers/sha256.c	Sun Mar 13 16:43:09 2011 +0000
+++ b/libpurple/ciphers/sha256.c	Sun Mar 13 16:47:36 2011 +0000
@@ -254,14 +254,24 @@
 }
 
 static PurpleCipherOps SHA256Ops = {
-	.set_option = sha256_set_opt,
-	.get_option = sha256_get_opt,
-	.init = sha256_init,
-	.reset = sha256_reset,
-	.uninit = sha256_uninit,
-	.append = sha256_append,
-	.digest = sha256_digest,
-	.get_block_size = sha256_get_block_size,
+	sha256_set_opt,			/* Set Option		*/
+	sha256_get_opt,			/* Get Option		*/
+	sha256_init,	/* init				*/
+	sha256_reset,	/* reset			*/
+	sha256_uninit,	/* uninit			*/
+	NULL,			/* set iv			*/
+	sha256_append,	/* append			*/
+	sha256_digest,	/* digest			*/
+	NULL,			/* encrypt			*/
+	NULL,			/* decrypt			*/
+	NULL,			/* set salt			*/
+	NULL,			/* get salt size	*/
+	NULL,			/* set key			*/
+	NULL,			/* get key size		*/
+	NULL,			/* set batch mode */
+	NULL,			/* get batch mode */
+	sha256_get_block_size,	/* get block size */
+	NULL			/* set key with len */
 };
 
 PurpleCipherOps *