Commit cbd420a0 authored by monty@mysql.com's avatar monty@mysql.com

Remove compiler warnings

Add missing DBUG_RETURN
Fixed stack overflow in NdbBlob (found by ndb_gis.test)
Fixed access to freed memory in ndb_cluster_real_free_share()
parent 1994ed49
...@@ -550,7 +550,7 @@ finish: ...@@ -550,7 +550,7 @@ finish:
} }
#endif #endif
keycache_pthread_mutex_unlock(&keycache->cache_lock); keycache_pthread_mutex_unlock(&keycache->cache_lock);
return blocks; DBUG_RETURN(blocks);
} }
......
...@@ -7060,7 +7060,6 @@ void ndbcluster_real_free_share(NDB_SHARE **share) ...@@ -7060,7 +7060,6 @@ void ndbcluster_real_free_share(NDB_SHARE **share)
hash_delete(&ndbcluster_open_tables, (byte*) *share); hash_delete(&ndbcluster_open_tables, (byte*) *share);
thr_lock_delete(&(*share)->lock); thr_lock_delete(&(*share)->lock);
pthread_mutex_destroy(&(*share)->mutex); pthread_mutex_destroy(&(*share)->mutex);
free_root(&(*share)->mem_root, MYF(0));
#ifdef HAVE_NDB_BINLOG #ifdef HAVE_NDB_BINLOG
if ((*share)->table) if ((*share)->table)
...@@ -7081,6 +7080,7 @@ void ndbcluster_real_free_share(NDB_SHARE **share) ...@@ -7081,6 +7080,7 @@ void ndbcluster_real_free_share(NDB_SHARE **share)
#endif #endif
} }
#endif #endif
free_root(&(*share)->mem_root, MYF(0));
my_free((gptr) *share, MYF(0)); my_free((gptr) *share, MYF(0));
*share= 0; *share= 0;
......
...@@ -4463,7 +4463,7 @@ double Item_func_match::val_real() ...@@ -4463,7 +4463,7 @@ double Item_func_match::val_real()
DBUG_RETURN(-1.0); DBUG_RETURN(-1.0);
if (table->null_row) /* NULL row from an outer join */ if (table->null_row) /* NULL row from an outer join */
return 0.0; DBUG_RETURN(0.0);
if (join_key) if (join_key)
{ {
...@@ -4480,9 +4480,8 @@ double Item_func_match::val_real() ...@@ -4480,9 +4480,8 @@ double Item_func_match::val_real()
DBUG_RETURN(ft_handler->please->find_relevance(ft_handler, DBUG_RETURN(ft_handler->please->find_relevance(ft_handler,
(byte *)a->ptr(), a->length())); (byte *)a->ptr(), a->length()));
} }
else DBUG_RETURN(ft_handler->please->find_relevance(ft_handler,
DBUG_RETURN(ft_handler->please->find_relevance(ft_handler, table->record[0], 0));
table->record[0], 0));
} }
void Item_func_match::print(String *str) void Item_func_match::print(String *str)
......
...@@ -2593,7 +2593,7 @@ String *Item_load_file::val_str(String *str) ...@@ -2593,7 +2593,7 @@ String *Item_load_file::val_str(String *str)
tmp_value.length(stat_info.st_size); tmp_value.length(stat_info.st_size);
my_close(file, MYF(0)); my_close(file, MYF(0));
null_value = 0; null_value = 0;
return &tmp_value; DBUG_RETURN(&tmp_value);
err: err:
null_value = 1; null_value = 1;
......
...@@ -563,6 +563,7 @@ create_typelib(MEM_ROOT *mem_root, create_field *field_def, List<String> *src) ...@@ -563,6 +563,7 @@ create_typelib(MEM_ROOT *mem_root, create_field *field_def, List<String> *src)
TYPELIB *result= NULL; TYPELIB *result= NULL;
CHARSET_INFO *cs= field_def->charset; CHARSET_INFO *cs= field_def->charset;
DBUG_ENTER("create_typelib"); DBUG_ENTER("create_typelib");
if (src->elements) if (src->elements)
{ {
result= (TYPELIB*) alloc_root(mem_root, sizeof(TYPELIB)); result= (TYPELIB*) alloc_root(mem_root, sizeof(TYPELIB));
...@@ -570,8 +571,8 @@ create_typelib(MEM_ROOT *mem_root, create_field *field_def, List<String> *src) ...@@ -570,8 +571,8 @@ create_typelib(MEM_ROOT *mem_root, create_field *field_def, List<String> *src)
result->name= ""; result->name= "";
if (!(result->type_names=(const char **) if (!(result->type_names=(const char **)
alloc_root(mem_root,(sizeof(char *)+sizeof(int))*(result->count+1)))) alloc_root(mem_root,(sizeof(char *)+sizeof(int))*(result->count+1))))
return 0; DBUG_RETURN(0);
result->type_lengths= (unsigned int *)(result->type_names + result->count+1); result->type_lengths= (uint*)(result->type_names + result->count+1);
List_iterator<String> it(*src); List_iterator<String> it(*src);
String conv; String conv;
for (uint i=0; i < result->count; i++) for (uint i=0; i < result->count; i++)
...@@ -604,7 +605,7 @@ create_typelib(MEM_ROOT *mem_root, create_field *field_def, List<String> *src) ...@@ -604,7 +605,7 @@ create_typelib(MEM_ROOT *mem_root, create_field *field_def, List<String> *src)
result->type_names[result->count]= 0; result->type_names[result->count]= 0;
result->type_lengths[result->count]= 0; result->type_lengths[result->count]= 0;
} }
return result; DBUG_RETURN(result);
} }
......
...@@ -1738,7 +1738,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, ...@@ -1738,7 +1738,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
/* an open table operation needs a lot of the stack space */ /* an open table operation needs a lot of the stack space */
if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (char *)&alias)) if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (char *)&alias))
return 0; DBUG_RETURN(0);
if (thd->killed) if (thd->killed)
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -981,12 +981,13 @@ int ha_tina::rnd_end() ...@@ -981,12 +981,13 @@ int ha_tina::rnd_end()
int ha_tina::delete_all_rows() int ha_tina::delete_all_rows()
{ {
int rc;
DBUG_ENTER("ha_tina::delete_all_rows"); DBUG_ENTER("ha_tina::delete_all_rows");
if (!records_is_known) if (!records_is_known)
return (my_errno=HA_ERR_WRONG_COMMAND); DBUG_RETURN(my_errno=HA_ERR_WRONG_COMMAND);
int rc= my_chsize(share->data_file, 0, 0, MYF(MY_WME)); rc= my_chsize(share->data_file, 0, 0, MYF(MY_WME));
if (get_mmap(share, 0) > 0) if (get_mmap(share, 0) > 0)
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
...@@ -64,7 +64,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, ...@@ -64,7 +64,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
TODO: nulls processing TODO: nulls processing
*/ */
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
return sp_make_key(info,keynr,key,record,filepos); DBUG_RETURN(sp_make_key(info,keynr,key,record,filepos));
#else #else
DBUG_ASSERT(0); /* mi_open should check that this never happens*/ DBUG_ASSERT(0); /* mi_open should check that this never happens*/
#endif #endif
......
...@@ -159,4 +159,5 @@ void mi_change_key_cache(KEY_CACHE *old_key_cache, ...@@ -159,4 +159,5 @@ void mi_change_key_cache(KEY_CACHE *old_key_cache,
*/ */
multi_key_cache_change(old_key_cache, new_key_cache); multi_key_cache_change(old_key_cache, new_key_cache);
pthread_mutex_unlock(&THR_LOCK_myisam); pthread_mutex_unlock(&THR_LOCK_myisam);
DBUG_VOID_RETURN;
} }
...@@ -35,6 +35,8 @@ public: ...@@ -35,6 +35,8 @@ public:
STATIC_CONST( DataLength = 2 ); STATIC_CONST( DataLength = 2 );
STATIC_CONST( TextLength = DataLength * 8 ); // hex digits STATIC_CONST( TextLength = DataLength * 8 ); // hex digits
ArbitTicket() {}
inline void clear() { inline void clear() {
data[0] = 0; data[0] = 0;
data[1] = 0; data[1] = 0;
...@@ -145,6 +147,7 @@ public: ...@@ -145,6 +147,7 @@ public:
STATIC_CONST( SignalLength = 3 + ArbitTicket::DataLength + NodeBitmask::Size ); STATIC_CONST( SignalLength = 3 + ArbitTicket::DataLength + NodeBitmask::Size );
ArbitSignalData() {}
inline bool match(ArbitSignalData& aData) const { inline bool match(ArbitSignalData& aData) const {
return return
node == aData.node && node == aData.node &&
......
...@@ -336,6 +336,7 @@ public: ...@@ -336,6 +336,7 @@ public:
Uint32 RowGCIFlag; Uint32 RowGCIFlag;
Uint32 RowChecksumFlag; Uint32 RowChecksumFlag;
Table() {}
void init(); void init();
}; };
...@@ -398,6 +399,7 @@ public: ...@@ -398,6 +399,7 @@ public:
Uint32 AttributeStorageType; Uint32 AttributeStorageType;
char AttributeDefaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE]; char AttributeDefaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE];
Attribute() {}
void init(); void init();
inline inline
...@@ -685,6 +687,7 @@ struct DictFilegroupInfo { ...@@ -685,6 +687,7 @@ struct DictFilegroupInfo {
//GrowSpec LF_RedoGrow; //GrowSpec LF_RedoGrow;
Uint32 LF_UndoFreeWordsHi; Uint32 LF_UndoFreeWordsHi;
Uint32 LF_UndoFreeWordsLo; Uint32 LF_UndoFreeWordsLo;
Filegroup() {}
void init(); void init();
}; };
static const Uint32 MappingSize; static const Uint32 MappingSize;
...@@ -700,6 +703,8 @@ struct DictFilegroupInfo { ...@@ -700,6 +703,8 @@ struct DictFilegroupInfo {
Uint32 FileSizeHi; Uint32 FileSizeHi;
Uint32 FileSizeLo; Uint32 FileSizeLo;
Uint32 FileFreeExtents; Uint32 FileFreeExtents;
File() {}
void init(); void init();
}; };
static const Uint32 FileMappingSize; static const Uint32 FileMappingSize;
......
...@@ -117,6 +117,7 @@ struct SegmentedSectionPtr { ...@@ -117,6 +117,7 @@ struct SegmentedSectionPtr {
Uint32 i; Uint32 i;
struct SectionSegment * p; struct SectionSegment * p;
SegmentedSectionPtr() {}
void setNull() { p = 0;} void setNull() { p = 0;}
bool isNull() const { return p == 0;} bool isNull() const { return p == 0;}
}; };
......
...@@ -166,6 +166,7 @@ public: ...@@ -166,6 +166,7 @@ public:
*/ */
class Writer { class Writer {
public: public:
Writer() {}
virtual ~Writer() {} virtual ~Writer() {}
bool first(); bool first();
......
...@@ -60,6 +60,7 @@ public: ...@@ -60,6 +60,7 @@ public:
*/ */
class Service { class Service {
public: public:
Service() {}
virtual ~Service(){} virtual ~Service(){}
/** /**
......
...@@ -179,6 +179,8 @@ private: ...@@ -179,6 +179,8 @@ private:
ArbitSignalData data; ArbitSignalData data;
NDB_TICKS timestamp; NDB_TICKS timestamp;
ArbitSignal() {}
inline void init(GlobalSignalNumber aGsn, const Uint32* aData) { inline void init(GlobalSignalNumber aGsn, const Uint32* aData) {
gsn = aGsn; gsn = aGsn;
if (aData != NULL) if (aData != NULL)
......
...@@ -195,7 +195,7 @@ NdbBlob::getBlobEvent(NdbEventImpl& be, const NdbEventImpl* e, const NdbColumnIm ...@@ -195,7 +195,7 @@ NdbBlob::getBlobEvent(NdbEventImpl& be, const NdbEventImpl* e, const NdbColumnIm
assert(c->m_blobTable != NULL); assert(c->m_blobTable != NULL);
const NdbTableImpl& bt = *c->m_blobTable; const NdbTableImpl& bt = *c->m_blobTable;
// blob event name // blob event name
char bename[NdbBlobImpl::BlobTableNameSize]; char bename[MAX_TAB_NAME_SIZE];
getBlobEventName(bename, e, c); getBlobEventName(bename, e, c);
be.setName(bename); be.setName(bename);
be.setTable(bt); be.setTable(bt);
......
...@@ -51,6 +51,7 @@ struct EventBufData ...@@ -51,6 +51,7 @@ struct EventBufData
EventBufData *m_next_hash; // Next in per-GCI hash EventBufData *m_next_hash; // Next in per-GCI hash
Uint32 m_pkhash; // PK hash (without op) for fast compare Uint32 m_pkhash; // PK hash (without op) for fast compare
EventBufData() {}
// Get blob part number from blob data // Get blob part number from blob data
Uint32 get_blob_part_no() { Uint32 get_blob_part_no() {
assert(ptr[0].sz > 2); assert(ptr[0].sz > 2);
......
...@@ -169,7 +169,7 @@ NdbScanOperation::readTuples(NdbScanOperation::LockMode lm, ...@@ -169,7 +169,7 @@ NdbScanOperation::readTuples(NdbScanOperation::LockMode lm,
{ char* p = getenv("NDB_USE_TUPSCAN"); { char* p = getenv("NDB_USE_TUPSCAN");
if (p != 0) { if (p != 0) {
unsigned n = atoi(p); // 0-10 unsigned n = atoi(p); // 0-10
if (::time(0) % 10 < n) tupScan = true; if ((unsigned int) (::time(0) % 10) < n) tupScan = true;
} }
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment