diff options
author | Niels De Graef <nielsdegraef@gmail.com> | 2022-06-13 00:43:18 +0200 |
---|---|---|
committer | Niels De Graef <nielsdegraef@gmail.com> | 2022-06-13 00:43:43 +0200 |
commit | f6e809bc15efcf0ead351adf8e4c8e6b1a01d791 (patch) | |
tree | b2724dbc90ec74e451726e7b52249fa7970e9e7d | |
parent | 8661e5e37e30e0d3672f5fa4d0f9aa6614e52e6b (diff) | |
download | gcr-f6e809bc15efcf0ead351adf8e4c8e6b1a01d791.tar.gz |
Replace g_memdup with g_memdup2
-rw-r--r-- | egg/test-openssl.c | 2 | ||||
-rw-r--r-- | egg/test-symkey.c | 2 | ||||
-rw-r--r-- | gck/gck-enumerator.c | 2 | ||||
-rw-r--r-- | gck/gck-module.c | 2 | ||||
-rw-r--r-- | gck/gck-session.c | 16 | ||||
-rw-r--r-- | gck/gck-slot.c | 6 | ||||
-rw-r--r-- | gck/gck-uri.c | 2 | ||||
-rw-r--r-- | gck/test-gck-attributes.c | 2 | ||||
-rw-r--r-- | gcr/gcr-certificate.c | 6 | ||||
-rw-r--r-- | gcr/gcr-gnupg-importer.c | 2 | ||||
-rw-r--r-- | gcr/gcr-key-mechanisms.c | 2 | ||||
-rw-r--r-- | gcr/gcr-memory-icon.c | 2 | ||||
-rw-r--r-- | gcr/test-certificate-chain.c | 2 |
13 files changed, 24 insertions, 24 deletions
diff --git a/egg/test-openssl.c b/egg/test-openssl.c index b18565f..488c583 100644 --- a/egg/test-openssl.c +++ b/egg/test-openssl.c @@ -89,7 +89,7 @@ parse_reference (GQuark type, g_assert ("no data in PEM callback" && data != NULL); g_assert ("no data in PEM callback" && g_bytes_get_size (data) > 0); - test->refenc = g_memdup (g_bytes_get_data (data, NULL), g_bytes_get_size (data)); + test->refenc = g_memdup2 (g_bytes_get_data (data, NULL), g_bytes_get_size (data)); test->n_refenc = g_bytes_get_size (data); g_assert ("no headers present in file" && headers != NULL); diff --git a/egg/test-symkey.c b/egg/test-symkey.c index f363681..f16119f 100644 --- a/egg/test-symkey.c +++ b/egg/test-symkey.c @@ -380,7 +380,7 @@ test_read_cipher (gconstpointer data) egg_asn1x_destroy (asn); g_assert (ret == TRUE); - block = g_memdup (test->plain_text, test->n_text_length); + block = g_memdup2 (test->plain_text, test->n_text_length); gcry = gcry_cipher_encrypt (cih, block, test->n_text_length, NULL, 0); g_assert_cmpint (gcry, ==, 0); diff --git a/gck/gck-enumerator.c b/gck/gck-enumerator.c index 902e756..97599ce 100644 --- a/gck/gck-enumerator.c +++ b/gck/gck-enumerator.c @@ -888,7 +888,7 @@ gck_enumerator_set_object_type_full (GckEnumerator *self, self->attr_count = 0; if (attr_types) { - self->attr_types = g_memdup (attr_types, sizeof (gulong) * attr_count); + self->attr_types = g_memdup2 (attr_types, sizeof (gulong) * attr_count); self->attr_count = attr_count; } diff --git a/gck/gck-module.c b/gck/gck-module.c index a3ecd46..6f85f33 100644 --- a/gck/gck-module.c +++ b/gck/gck-module.c @@ -227,7 +227,7 @@ gck_module_info_copy (GckModuleInfo *module_info) if (module_info == NULL) return NULL; - module_info = g_memdup (module_info, sizeof (GckModuleInfo)); + module_info = g_memdup2 (module_info, sizeof (GckModuleInfo)); module_info->manufacturer_id = g_strdup (module_info->manufacturer_id); module_info->library_description = g_strdup (module_info->library_description); return module_info; diff --git a/gck/gck-session.c b/gck/gck-session.c index 29ef89e..031d749 100644 --- a/gck/gck-session.c +++ b/gck/gck-session.c @@ -556,7 +556,7 @@ G_DEFINE_BOXED_TYPE (GckSessionInfo, gck_session_info, GckSessionInfo * gck_session_info_copy (GckSessionInfo *session_info) { - return g_memdup (session_info, sizeof (GckSessionInfo)); + return g_memdup2 (session_info, sizeof (GckSessionInfo)); } /** @@ -958,7 +958,7 @@ gck_session_init_pin_async (GckSession *self, const guchar *pin, gsize n_pin, call = _gck_call_async_prep (self, perform_init_pin, NULL, sizeof (*args), free_init_pin); args = _gck_call_get_arguments (call); - args->pin = pin && n_pin ? g_memdup (pin, n_pin) : NULL; + args->pin = pin && n_pin ? g_memdup2 (pin, n_pin) : NULL; args->n_pin = n_pin; _gck_call_async_ready_go (call, self, cancellable, callback, user_data); @@ -1063,9 +1063,9 @@ gck_session_set_pin_async (GckSession *self, const guchar *old_pin, gsize n_old_ call = _gck_call_async_prep (self, perform_set_pin, NULL, sizeof (*args), free_set_pin); args = _gck_call_get_arguments (call); - args->old_pin = old_pin && n_old_pin ? g_memdup (old_pin, n_old_pin) : NULL; + args->old_pin = old_pin && n_old_pin ? g_memdup2 (old_pin, n_old_pin) : NULL; args->n_old_pin = n_old_pin; - args->new_pin = new_pin && n_new_pin ? g_memdup (new_pin, n_new_pin) : NULL; + args->new_pin = new_pin && n_new_pin ? g_memdup2 (new_pin, n_new_pin) : NULL; args->n_new_pin = n_new_pin; _gck_call_async_ready_go (call, self, cancellable, callback, user_data); @@ -1163,7 +1163,7 @@ gck_session_login_async (GckSession *self, gulong user_type, const guchar *pin, args = _gck_call_get_arguments (call); args->user_type = user_type; - args->pin = pin && n_pin ? g_memdup (pin, n_pin) : NULL; + args->pin = pin && n_pin ? g_memdup2 (pin, n_pin) : NULL; args->n_pin = n_pin; _gck_call_async_ready_go (call, self, cancellable, callback, user_data); @@ -2682,7 +2682,7 @@ crypt_async (GckSession *self, GckObject *key, GckMechanism *mechanism, const gu /* Shallow copy of the mechanism structure */ memcpy (&args->mechanism, mechanism, sizeof (args->mechanism)); - args->input = input && n_input ? g_memdup (input, n_input) : NULL; + args->input = input && n_input ? g_memdup2 (input, n_input) : NULL; args->n_input = n_input; args->init_func = init_func; @@ -3238,9 +3238,9 @@ gck_session_verify_async (GckSession *self, GckObject *key, GckMechanism *mechan /* Shallow copy of the mechanism structure */ memcpy (&args->mechanism, mechanism, sizeof (args->mechanism)); - args->input = input && n_input ? g_memdup (input, n_input) : NULL; + args->input = input && n_input ? g_memdup2 (input, n_input) : NULL; args->n_input = n_input; - args->signature = signature && n_signature ? g_memdup (signature, n_signature) : NULL; + args->signature = signature && n_signature ? g_memdup2 (signature, n_signature) : NULL; args->n_signature = n_signature; args->key_object = g_object_ref (key); diff --git a/gck/gck-slot.c b/gck/gck-slot.c index b297629..7c795cb 100644 --- a/gck/gck-slot.c +++ b/gck/gck-slot.c @@ -188,7 +188,7 @@ gck_slot_info_copy (GckSlotInfo *slot_info) if (slot_info == NULL) return NULL; - slot_info = g_memdup (slot_info, sizeof (GckSlotInfo)); + slot_info = g_memdup2 (slot_info, sizeof (GckSlotInfo)); slot_info->manufacturer_id = g_strdup (slot_info->manufacturer_id); slot_info->slot_description = g_strdup (slot_info->slot_description); @@ -261,7 +261,7 @@ gck_token_info_copy (GckTokenInfo *token_info) if (token_info == NULL) return NULL; - token_info = g_memdup (token_info, sizeof (GckTokenInfo)); + token_info = g_memdup2 (token_info, sizeof (GckTokenInfo)); token_info->label = g_strdup (token_info->label); token_info->manufacturer_id = g_strdup (token_info->manufacturer_id); token_info->model = g_strdup (token_info->model); @@ -315,7 +315,7 @@ G_DEFINE_BOXED_TYPE (GckMechanismInfo, gck_mechanism_info, GckMechanismInfo * gck_mechanism_info_copy (GckMechanismInfo *mech_info) { - return g_memdup (mech_info, sizeof (GckMechanismInfo)); + return g_memdup2 (mech_info, sizeof (GckMechanismInfo)); } /** diff --git a/gck/gck-uri.c b/gck/gck-uri.c index e034ed5..91ec2b5 100644 --- a/gck/gck-uri.c +++ b/gck/gck-uri.c @@ -270,7 +270,7 @@ gck_uri_data_copy (GckUriData *uri_data) { GckUriData *copy; - copy = g_memdup (uri_data, sizeof (GckUriData)); + copy = g_memdup2 (uri_data, sizeof (GckUriData)); copy->attributes = gck_attributes_ref (uri_data->attributes); copy->module_info = gck_module_info_copy (copy->module_info); copy->token_info = gck_token_info_copy (copy->token_info); diff --git a/gck/test-gck-attributes.c b/gck/test-gck-attributes.c index da11bf4..ab066b7 100644 --- a/gck/test-gck-attributes.c +++ b/gck/test-gck-attributes.c @@ -421,7 +421,7 @@ test_build_take (void) const GckAttribute *attr; guchar *memory; - memory = g_memdup (ATTR_DATA, N_ATTR_DATA); + memory = g_memdup2 (ATTR_DATA, N_ATTR_DATA); gck_builder_take_data (&builder, ATTR_TYPE, memory, N_ATTR_DATA); attrs = gck_builder_end (&builder); diff --git a/gcr/gcr-certificate.c b/gcr/gcr-certificate.c index f3899ba..714f4a9 100644 --- a/gcr/gcr-certificate.c +++ b/gcr/gcr-certificate.c @@ -529,7 +529,7 @@ gcr_certificate_get_issuer_raw (GcrCertificate *self, } *n_data = g_bytes_get_size (bytes); - result = g_memdup (g_bytes_get_data (bytes, NULL), *n_data); + result = g_memdup2 (g_bytes_get_data (bytes, NULL), *n_data); g_bytes_unref (bytes); return result; @@ -741,7 +741,7 @@ gcr_certificate_get_subject_raw (GcrCertificate *self, gsize *n_data) } *n_data = g_bytes_get_size (bytes); - result = g_memdup (g_bytes_get_data (bytes, NULL), *n_data); + result = g_memdup2 (g_bytes_get_data (bytes, NULL), *n_data); g_bytes_unref (bytes); @@ -952,7 +952,7 @@ gcr_certificate_get_serial_number (GcrCertificate *self, gsize *n_length) g_return_val_if_fail (bytes != NULL, NULL); *n_length = g_bytes_get_size (bytes); - result = g_memdup (g_bytes_get_data (bytes, NULL), *n_length); + result = g_memdup2 (g_bytes_get_data (bytes, NULL), *n_length); g_bytes_unref (bytes); return result; diff --git a/gcr/gcr-gnupg-importer.c b/gcr/gcr-gnupg-importer.c index 63b7b58..5fa93bd 100644 --- a/gcr/gcr-gnupg-importer.c +++ b/gcr/gcr-gnupg-importer.c @@ -285,7 +285,7 @@ _gcr_gnupg_importer_queue_for_parsed (GcrImporter *importer, block = gcr_parsed_get_data (parsed, &n_block); g_return_val_if_fail (block, FALSE); - g_memory_input_stream_add_data (self->pv->packets, g_memdup (block, n_block), + g_memory_input_stream_add_data (self->pv->packets, g_memdup2 (block, n_block), n_block, g_free); return TRUE; } diff --git a/gcr/gcr-key-mechanisms.c b/gcr/gcr-key-mechanisms.c index 89f968a..1f60ba8 100644 --- a/gcr/gcr-key-mechanisms.c +++ b/gcr/gcr-key-mechanisms.c @@ -165,7 +165,7 @@ _gcr_key_mechanisms_check_async (GckObject *key, task = g_task_new (key, cancellable, callback, user_data); g_task_set_source_tag (task, _gcr_key_mechanisms_check_async); closure = g_new0 (CheckClosure, 1); - closure->mechanisms = g_memdup (mechanisms, n_mechanisms * sizeof (gulong)); + closure->mechanisms = g_memdup2 (mechanisms, n_mechanisms * sizeof (gulong)); closure->n_mechanisms = n_mechanisms; closure->action_attr_type = action_attr_type; g_task_set_task_data (task, closure, check_closure_free); diff --git a/gcr/gcr-memory-icon.c b/gcr/gcr-memory-icon.c index 40a4527..b37f9a5 100644 --- a/gcr/gcr-memory-icon.c +++ b/gcr/gcr-memory-icon.c @@ -184,7 +184,7 @@ _gcr_memory_icon_new (const gchar *image_type, gconstpointer data, gsize n_data) g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (n_data != 0, NULL); - return _gcr_memory_icon_new_full (image_type, g_memdup (data, n_data), + return _gcr_memory_icon_new_full (image_type, g_memdup2 (data, n_data), n_data, 0, g_free); } diff --git a/gcr/test-certificate-chain.c b/gcr/test-certificate-chain.c index 6cb8ee4..0d8d07f 100644 --- a/gcr/test-certificate-chain.c +++ b/gcr/test-certificate-chain.c @@ -109,7 +109,7 @@ static GcrCertificate* mock_certificate_new (gconstpointer data, gsize n_data) { MockCertificate *self = g_object_new (mock_certificate_get_type (), NULL); - self->data = g_memdup (data, n_data); + self->data = g_memdup2 (data, n_data); self->n_data = n_data; g_assert (self->created_on == g_thread_self ()); return GCR_CERTIFICATE (self); |