summaryrefslogtreecommitdiff
path: root/sql/gstream.h
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2004-03-15 16:32:53 +0400
committerunknown <hf@deer.(none)>2004-03-15 16:32:53 +0400
commit9a3fbf0d96426dd5273bb8992c4b131965e6d1e1 (patch)
tree2cab975faaba9bbd5292393c6b415c5159079213 /sql/gstream.h
parent22657f672c8d4c005f85cd3efc714d98b635f3f0 (diff)
downloadmariadb-git-9a3fbf0d96426dd5273bb8992c4b131965e6d1e1.tar.gz
Fix for valgrind's warning
sql/gstream.cc: checking for ending \0 changed with m_limit sql/gstream.h: checking for ending \0 changed with m_limit sql/item_geofunc.cc: we should check for null value before we use val_str result sql/item_strfunc.cc: get rid of annoying warnings sql/spatial.h: error about size_t type fixed
Diffstat (limited to 'sql/gstream.h')
-rw-r--r--sql/gstream.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/gstream.h b/sql/gstream.h
index 2e9513d2639..bfbf28851ce 100644
--- a/sql/gstream.h
+++ b/sql/gstream.h
@@ -29,8 +29,8 @@ public:
comma
};
- Gis_read_stream(const char *buffer, int size)
- :m_cur(buffer), m_limit(buffer + size), m_err_msg(NULL)
+ Gis_read_stream(CHARSET_INFO *charset, const char *buffer, int size)
+ :m_cur(buffer), m_limit(buffer + size), m_err_msg(NULL), m_charset(charset)
{}
Gis_read_stream(): m_cur(NullS), m_limit(NullS), m_err_msg(NullS)
{}
@@ -46,14 +46,14 @@ public:
inline void skip_space()
{
- while (my_isspace(&my_charset_latin1, *m_cur))
+ while ((m_cur < m_limit) && my_isspace(&my_charset_latin1, *m_cur))
m_cur++;
}
/* Skip next character, if match. Return 1 if no match */
inline bool skip_char(char skip)
{
skip_space();
- if (*m_cur != skip)
+ if ((m_cur >= m_limit) || *m_cur != skip)
return 1; /* Didn't find char */
m_cur++;
return 0;
@@ -72,4 +72,5 @@ protected:
const char *m_cur;
const char *m_limit;
char *m_err_msg;
+ CHARSET_INFO *m_charset;
};