summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <monty@mishka.local>2005-06-21 18:18:58 +0300
committerunknown <monty@mishka.local>2005-06-21 18:18:58 +0300
commit280b1c33e3e1ddd7b4e3b295c9e30c766da6c494 (patch)
tree0a0a8e74a0ac586a06d40e05101d869295cbd90a /sql/sql_select.cc
parente17de6ecb472e84c7f826f6ac77c236ce952b9a8 (diff)
downloadmariadb-git-280b1c33e3e1ddd7b4e3b295c9e30c766da6c494.tar.gz
Cleanup during review of new code
Fixed wrong allocation that could cause buffer overrun when using join cache myisam/mi_open.c: Fixed indentation mysql-test/r/lowercase_table2.result: Drop tables and databases used in the test mysql-test/t/lowercase_table2.test: Drop tables and databases used in the test mysys/my_fopen.c: Cleanup of comments and parameter names Simple optimization Removed compiler warnings sql/field.cc: Fixed wrong allocation that could cause buffer overrun sql/mysqld.cc: Removed not needed code sql/set_var.cc: Simply code sql/sql_select.cc: Use int2store/int2korr to store length of cached VARCHAR fields (Not dependent on type and faster code as we avoid one possible call)
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 5bafe1a7df4..1031773eeed 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -28,8 +28,6 @@
#include <hash.h>
#include <ft_global.h>
-typedef uint32 cache_rec_length_type;
-
const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
"MAYBE_REF","ALL","range","index","fulltext",
"ref_or_null","unique_subquery","index_subquery"
@@ -8074,7 +8072,7 @@ used_blob_length(CACHE_FIELD **ptr)
static bool
store_record_in_cache(JOIN_CACHE *cache)
{
- cache_rec_length_type length;
+ uint length;
uchar *pos;
CACHE_FIELD *copy,*end_field;
bool last_record;
@@ -8119,9 +8117,9 @@ store_record_in_cache(JOIN_CACHE *cache)
end > str && end[-1] == ' ' ;
end--) ;
length=(uint) (end-str);
- memcpy(pos+sizeof(length), str, length);
- memcpy_fixed(pos, &length, sizeof(length));
- pos+= length+sizeof(length);
+ memcpy(pos+2, str, length);
+ int2store(pos, length);
+ pos+= length+2;
}
else
{
@@ -8155,7 +8153,7 @@ static void
read_cached_record(JOIN_TAB *tab)
{
uchar *pos;
- cache_rec_length_type length;
+ uint length;
bool last_record;
CACHE_FIELD *copy,*end_field;
@@ -8184,10 +8182,10 @@ read_cached_record(JOIN_TAB *tab)
{
if (copy->strip)
{
- memcpy_fixed(&length, pos, sizeof(length));
- memcpy(copy->str, pos+sizeof(length), length);
+ length= uint2korr(pos);
+ memcpy(copy->str, pos+2, length);
memset(copy->str+length, ' ', copy->length-length);
- pos+= sizeof(length)+length;
+ pos+= 2 + length;
}
else
{