diff options
author | Ankit Vani <a@nevitus.org> | 2013-11-17 04:06:49 +0530 |
---|---|---|
committer | Ankit Vani <a@nevitus.org> | 2013-11-17 04:06:49 +0530 |
commit | ae008371cfd4f73e40678d95a6dc2ee4a0a7984c (patch) | |
tree | 0c4af07d249ebab5d8b9f7240824db7a78c1edd5 | |
parent | d8bff59596f899db055d1594571ab38da5af960a (diff) | |
download | pidgin-ae008371cfd4f73e40678d95a6dc2ee4a0a7984c.tar.gz |
ciphers: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
-rw-r--r-- | libpurple/ciphers/aescipher.c | 17 | ||||
-rw-r--r-- | libpurple/ciphers/des3cipher.c | 10 | ||||
-rw-r--r-- | libpurple/ciphers/descipher.c | 2 | ||||
-rw-r--r-- | libpurple/ciphers/hmaccipher.c | 3 | ||||
-rw-r--r-- | libpurple/ciphers/pbkdf2cipher.c | 13 | ||||
-rw-r--r-- | libpurple/ciphers/rc4cipher.c | 8 |
6 files changed, 31 insertions, 22 deletions
diff --git a/libpurple/ciphers/aescipher.c b/libpurple/ciphers/aescipher.c index da0a4c395d..a07bf7437a 100644 --- a/libpurple/ciphers/aescipher.c +++ b/libpurple/ciphers/aescipher.c @@ -505,11 +505,12 @@ purple_aes_cipher_set_batch_mode(PurpleCipher *cipher, { PurpleAESCipherPrivate *priv = PURPLE_AES_CIPHER_GET_PRIVATE(cipher); - if (mode == PURPLE_CIPHER_BATCH_MODE_CBC) - return; + if (mode != PURPLE_CIPHER_BATCH_MODE_CBC) { + purple_debug_error("cipher-aes", "unsupported batch mode\n"); + priv->failure = TRUE; + } - purple_debug_error("cipher-aes", "unsupported batch mode\n"); - priv->failure = TRUE; + g_object_notify(G_OBJECT(cipher), "batch-mode"); } static PurpleCipherBatchMode @@ -590,17 +591,17 @@ purple_aes_cipher_class_init(PurpleAESCipherClass *klass) { cipher_class->get_batch_mode = purple_aes_cipher_get_batch_mode; cipher_class->get_block_size = purple_aes_cipher_get_block_size; - pspec = g_param_spec_enum("batch_mode", "batch_mode", "batch_mode", + pspec = g_param_spec_enum("batch-mode", "batch-mode", "batch-mode", PURPLE_TYPE_CIPHER_BATCH_MODE, 0, - G_PARAM_READWRITE); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_BATCH_MODE, pspec); pspec = g_param_spec_string("iv", "iv", "iv", NULL, - G_PARAM_WRITABLE); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_IV, pspec); pspec = g_param_spec_string("key", "key", "key", NULL, - G_PARAM_WRITABLE); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_KEY, pspec); g_type_class_add_private(klass, sizeof(PurpleAESCipherPrivate)); diff --git a/libpurple/ciphers/des3cipher.c b/libpurple/ciphers/des3cipher.c index 9c685e62e1..7edce23605 100644 --- a/libpurple/ciphers/des3cipher.c +++ b/libpurple/ciphers/des3cipher.c @@ -352,6 +352,8 @@ purple_des3_cipher_set_batch_mode(PurpleCipher *cipher, PurpleCipherBatchMode mo PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher); priv->mode = mode; + + g_object_notify(G_OBJECT(cipher), "batch-mode"); } static PurpleCipherBatchMode @@ -456,17 +458,17 @@ purple_des3_cipher_class_init(PurpleDES3CipherClass *klass) { cipher_class->get_batch_mode = purple_des3_cipher_get_batch_mode; cipher_class->get_key_size = purple_des3_cipher_get_key_size; - pspec = g_param_spec_enum("batch_mode", "batch_mode", "batch_mode", + pspec = g_param_spec_enum("batch-mode", "batch-mode", "batch-mode", PURPLE_TYPE_CIPHER_BATCH_MODE, 0, - G_PARAM_READWRITE); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_BATCH_MODE, pspec); pspec = g_param_spec_string("iv", "iv", "iv", NULL, - G_PARAM_WRITABLE); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_IV, pspec); pspec = g_param_spec_string("key", "key", "key", NULL, - G_PARAM_WRITABLE); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_KEY, pspec); g_type_class_add_private(klass, sizeof(PurpleDES3CipherPrivate)); diff --git a/libpurple/ciphers/descipher.c b/libpurple/ciphers/descipher.c index a83a302b6e..4bc8e40a00 100644 --- a/libpurple/ciphers/descipher.c +++ b/libpurple/ciphers/descipher.c @@ -534,7 +534,7 @@ purple_des_cipher_class_init(PurpleDESCipherClass *klass) cipher_class->get_key_size = purple_des_cipher_get_key_size; pspec = g_param_spec_string("key", "key", "key", NULL, - G_PARAM_WRITABLE); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_KEY, pspec); g_type_class_add_private(klass, sizeof(PurpleDESCipherPrivate)); diff --git a/libpurple/ciphers/hmaccipher.c b/libpurple/ciphers/hmaccipher.c index 2dbf969257..9332497cb2 100644 --- a/libpurple/ciphers/hmaccipher.c +++ b/libpurple/ciphers/hmaccipher.c @@ -280,7 +280,8 @@ purple_hmac_cipher_class_init(PurpleHMACCipherClass *klass) { cipher_class->get_block_size = purple_hmac_cipher_get_block_size; pspec = g_param_spec_object("hash", "hash", "hash", PURPLE_TYPE_HASH, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_HASH, pspec); } diff --git a/libpurple/ciphers/pbkdf2cipher.c b/libpurple/ciphers/pbkdf2cipher.c index 595e132ec4..15632243f6 100644 --- a/libpurple/ciphers/pbkdf2cipher.c +++ b/libpurple/ciphers/pbkdf2cipher.c @@ -337,15 +337,18 @@ purple_pbkdf2_cipher_class_init(PurplePBKDF2CipherClass *klass) { cipher_class->set_key = purple_pbkdf2_cipher_set_key; pspec = g_param_spec_object("hash", "hash", "hash", PURPLE_TYPE_HASH, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_HASH, pspec); - pspec = g_param_spec_uint("iter_count", "iter_count", "iter_count", 0, - G_MAXUINT, 0, G_PARAM_READWRITE); + pspec = g_param_spec_uint("iter-count", "iter-count", "iter-count", 0, + G_MAXUINT, 0, G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_ITER_COUNT, pspec); - pspec = g_param_spec_uint("out_len", "out_len", "out_len", 0, - G_MAXUINT, 0, G_PARAM_READWRITE); + pspec = g_param_spec_uint("out-len", "out-len", "out-len", 0, + G_MAXUINT, 0, G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_OUT_LEN, pspec); g_type_class_add_private(klass, sizeof(PurplePBKDF2CipherPrivate)); diff --git a/libpurple/ciphers/rc4cipher.c b/libpurple/ciphers/rc4cipher.c index d42fff81d5..49d8ef312e 100644 --- a/libpurple/ciphers/rc4cipher.c +++ b/libpurple/ciphers/rc4cipher.c @@ -180,13 +180,13 @@ purple_rc4_cipher_class_init(PurpleRC4CipherClass *klass) { cipher_class->encrypt = purple_rc4_cipher_encrypt; cipher_class->set_key = purple_rc4_cipher_set_key; - pspec = g_param_spec_int("key_len", "key_len", "key_len", + pspec = g_param_spec_int("key-len", "key-len", "key-len", G_MININT, G_MAXINT, 0, - G_PARAM_READWRITE); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_KEY_LEN, pspec); pspec = g_param_spec_string("key", "key", "key", NULL, - G_PARAM_WRITABLE); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property(obj_class, PROP_KEY, pspec); g_type_class_add_private(klass, sizeof(PurpleRC4CipherPrivate)); @@ -241,6 +241,8 @@ purple_rc4_cipher_set_key_len(PurpleRC4Cipher *rc4_cipher, priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher); priv->key_len = key_len; + + g_object_notify(G_OBJECT(rc4_cipher), "key-len"); } gint |