diff options
author | Eric Herman <eric@freesa.org> | 2021-09-03 06:38:54 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <cvicentiu@gmail.com> | 2021-10-15 12:14:47 +0300 |
commit | 0649bcff4e984cb29d9fc12bde7eccb87ea7e38e (patch) | |
tree | 7459ff3efdcfdfa2ab4094f7ff5b7e5d4332e9a0 /sql/sql_array.h | |
parent | a6cf8b34a834e5d16155f8bb3f33d57a4f87eb9e (diff) | |
download | mariadb-git-bb-10.7-vicentiu.tar.gz |
MDEV-26221: DYNAMIC_ARRAY use size_t for sizesbb-10.7-vicentiu
https://jira.mariadb.org/browse/MDEV-26221
my_sys DYNAMIC_ARRAY and DYNAMIC_STRING inconsistancy
The DYNAMIC_STRING uses size_t for sizes, but DYNAMIC_ARRAY used uint.
This patch adjusts DYNAMIC_ARRAY to use size_t like DYNAMIC_STRING.
As the MY_DIR member number_of_files is copied from a DYNAMIC_ARRAY,
this is changed to be size_t.
As MY_TMPDIR members 'cur' and 'max' are copied from a DYNAMIC_ARRAY,
these are also changed to be size_t.
The lists of plugins and stored procedures use DYNAMIC_ARRAY,
but their APIs assume a size of 'uint'; these are unchanged.
Diffstat (limited to 'sql/sql_array.h')
-rw-r--r-- | sql/sql_array.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sql/sql_array.h b/sql/sql_array.h index 0995653e1d7..85a53ae1a6f 100644 --- a/sql/sql_array.h +++ b/sql/sql_array.h @@ -114,19 +114,19 @@ template <class Elem> class Dynamic_array { DYNAMIC_ARRAY array; public: - Dynamic_array(PSI_memory_key psi_key, uint prealloc=16, uint increment=16) + Dynamic_array(PSI_memory_key psi_key, size_t prealloc=16, size_t increment=16) { init(psi_key, prealloc, increment); } - Dynamic_array(MEM_ROOT *root, uint prealloc=16, uint increment=16) + Dynamic_array(MEM_ROOT *root, size_t prealloc=16, size_t increment=16) { void *init_buffer= alloc_root(root, sizeof(Elem) * prealloc); init_dynamic_array2(root->psi_key, &array, sizeof(Elem), init_buffer, prealloc, increment, MYF(0)); } - void init(PSI_memory_key psi_key, uint prealloc=16, uint increment=16) + void init(PSI_memory_key psi_key, size_t prealloc=16, size_t increment=16) { init_dynamic_array2(psi_key, &array, sizeof(Elem), 0, prealloc, increment, MYF(0)); } @@ -217,7 +217,7 @@ public: void del(size_t idx) { DBUG_ASSERT(idx <= array.max_element); - delete_dynamic_element(&array, (uint)idx); + delete_dynamic_element(&array, idx); } size_t elements() const @@ -228,7 +228,7 @@ public: void elements(size_t num_elements) { DBUG_ASSERT(num_elements <= array.max_element); - array.elements= (uint)num_elements; + array.elements= num_elements; } void clear() @@ -236,7 +236,7 @@ public: elements(0); } - void set(uint idx, const Elem &el) + void set(size_t idx, const Elem &el) { set_dynamic(&array, &el, idx); } @@ -248,7 +248,7 @@ public: bool reserve(size_t new_size) { - return allocate_dynamic(&array, (uint)new_size); + return allocate_dynamic(&array, new_size); } @@ -260,7 +260,7 @@ public: if (new_size > old_size) { - set_dynamic(&array, (uchar*)&default_val, (uint)(new_size - 1)); + set_dynamic(&array, (uchar*)&default_val, new_size - 1); /*for (size_t i= old_size; i != new_size; i++) { at(i)= default_val; |