mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Fixes during review of new code
- Mostly indentation fixes - Added missing test - Ensure that Item_func_case() checks for stack overruns - Use real_item() instead of (Item_ref*) item - Fixed wrong error handling myisam/mi_unique.c: Improved comments myisam/myisampack.c: Updated version number mysql-test/r/group_by.result: Added test that was lost during earlier merge mysql-test/r/information_schema.result: Safety fix: Drop procedures before used mysql-test/t/group_by.test: Added test that was lost during earlier merge mysql-test/t/information_schema.test: Safety fix: Drop procedures before used mysys/hash.c: Updated comment sql/field.cc: false -> FALSE sql/ha_ndbcluster.cc: Fix some style issues - No () around argument to 'case' - Space before ( in switch and if - Removed 'goto' - Added {} - Added () to make expressions easier to read - my_snprintf -> strmov sql/handler.cc: if( -> if ( sql/item.cc: Indentation changes sql/item.h: false -> FALSE sql/item_cmpfunc.cc: Ensure that Item_func_case() check for stack overrun properly sql/item_cmpfunc.h: Ensure that Item_func_case() check for stack overrun properly sql/item_func.cc: Indentation fixes Fixed wrong goto label sql/mysqld.cc: Remove test for opt_disable_networking as this flag can never be set here sql/opt_range.cc: Simplify code sql/sql_class.h: Move define out from middle of class definition sql/sql_parse.cc: Remove extra empty lines sql/sql_select.cc: use real_item() instead of (Item_ref*) item Modifed function comment to be align with others Simple optimization sql/sql_union.cc: Portability fix: Don't use 'bool_variable|=...' sql/sql_view.cc: Move List_iterator_fast out from loops (rewind is faster than creating a new itearator) strings/ctype-utf8.c: if( -> if ( strings/ctype.c: Remove disabled code strings/decimal.c: Indentation fixes strings/xml.c: Indentation fixes
This commit is contained in:
@@ -96,13 +96,13 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a)
|
||||
a->end=p->cur;
|
||||
lex=a->beg[0];
|
||||
}
|
||||
else if ( (p->cur[0]=='"') || (p->cur[0]=='\'') )
|
||||
else if ( (p->cur[0] == '"') || (p->cur[0] == '\'') )
|
||||
{
|
||||
p->cur++;
|
||||
for( ; ( p->cur < p->end ) && (p->cur[0] != a->beg[0]); p->cur++)
|
||||
{}
|
||||
a->end=p->cur;
|
||||
if (a->beg[0]==p->cur[0])p->cur++;
|
||||
if (a->beg[0] == p->cur[0])p->cur++;
|
||||
a->beg++;
|
||||
my_xml_norm_text(a);
|
||||
lex=MY_XML_STRING;
|
||||
@@ -169,8 +169,8 @@ static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen)
|
||||
int rc;
|
||||
|
||||
/* Find previous '.' or beginning */
|
||||
for( e=p->attrend; (e>p->attr) && (e[0]!='.') ; e--);
|
||||
glen = (uint) ((e[0]=='.') ? (p->attrend-e-1) : p->attrend-e);
|
||||
for( e=p->attrend; (e>p->attr) && (e[0] != '.') ; e--);
|
||||
glen = (uint) ((e[0] == '.') ? (p->attrend-e-1) : p->attrend-e);
|
||||
|
||||
if (str && (slen != glen))
|
||||
{
|
||||
@@ -199,7 +199,7 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
|
||||
while ( p->cur < p->end )
|
||||
{
|
||||
MY_XML_ATTR a;
|
||||
if(p->cur[0]=='<')
|
||||
if (p->cur[0] == '<')
|
||||
{
|
||||
int lex;
|
||||
int question=0;
|
||||
@@ -207,40 +207,40 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
|
||||
|
||||
lex=my_xml_scan(p,&a);
|
||||
|
||||
if (MY_XML_COMMENT==lex)
|
||||
if (MY_XML_COMMENT == lex)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
lex=my_xml_scan(p,&a);
|
||||
|
||||
if (MY_XML_SLASH==lex)
|
||||
if (MY_XML_SLASH == lex)
|
||||
{
|
||||
if(MY_XML_IDENT!=(lex=my_xml_scan(p,&a)))
|
||||
if (MY_XML_IDENT != (lex=my_xml_scan(p,&a)))
|
||||
{
|
||||
sprintf(p->errstr,"1: %s unexpected (ident wanted)",lex2str(lex));
|
||||
return MY_XML_ERROR;
|
||||
}
|
||||
if(MY_XML_OK!=my_xml_leave(p,a.beg,(uint) (a.end-a.beg)))
|
||||
if (MY_XML_OK != my_xml_leave(p,a.beg,(uint) (a.end-a.beg)))
|
||||
return MY_XML_ERROR;
|
||||
lex=my_xml_scan(p,&a);
|
||||
goto gt;
|
||||
}
|
||||
|
||||
if (MY_XML_EXCLAM==lex)
|
||||
if (MY_XML_EXCLAM == lex)
|
||||
{
|
||||
lex=my_xml_scan(p,&a);
|
||||
exclam=1;
|
||||
}
|
||||
else if (MY_XML_QUESTION==lex)
|
||||
else if (MY_XML_QUESTION == lex)
|
||||
{
|
||||
lex=my_xml_scan(p,&a);
|
||||
question=1;
|
||||
}
|
||||
|
||||
if (MY_XML_IDENT==lex)
|
||||
if (MY_XML_IDENT == lex)
|
||||
{
|
||||
if(MY_XML_OK!=my_xml_enter(p,a.beg,(uint) (a.end-a.beg)))
|
||||
if (MY_XML_OK != my_xml_enter(p,a.beg,(uint) (a.end-a.beg)))
|
||||
return MY_XML_ERROR;
|
||||
}
|
||||
else
|
||||
@@ -250,17 +250,18 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
|
||||
return MY_XML_ERROR;
|
||||
}
|
||||
|
||||
while ((MY_XML_IDENT==(lex=my_xml_scan(p,&a))) || (MY_XML_STRING==lex))
|
||||
while ((MY_XML_IDENT == (lex=my_xml_scan(p,&a))) ||
|
||||
(MY_XML_STRING == lex))
|
||||
{
|
||||
MY_XML_ATTR b;
|
||||
if(MY_XML_EQ==(lex=my_xml_scan(p,&b)))
|
||||
if (MY_XML_EQ == (lex=my_xml_scan(p,&b)))
|
||||
{
|
||||
lex=my_xml_scan(p,&b);
|
||||
if ( (lex==MY_XML_IDENT) || (lex==MY_XML_STRING) )
|
||||
if ( (lex == MY_XML_IDENT) || (lex == MY_XML_STRING) )
|
||||
{
|
||||
if((MY_XML_OK!=my_xml_enter(p,a.beg,(uint) (a.end-a.beg))) ||
|
||||
(MY_XML_OK!=my_xml_value(p,b.beg,(uint) (b.end-b.beg))) ||
|
||||
(MY_XML_OK!=my_xml_leave(p,a.beg,(uint) (a.end-a.beg))))
|
||||
if ((MY_XML_OK != my_xml_enter(p,a.beg,(uint) (a.end-a.beg))) ||
|
||||
(MY_XML_OK != my_xml_value(p,b.beg,(uint) (b.end-b.beg))) ||
|
||||
(MY_XML_OK != my_xml_leave(p,a.beg,(uint) (a.end-a.beg))))
|
||||
return MY_XML_ERROR;
|
||||
}
|
||||
else
|
||||
@@ -270,19 +271,19 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
|
||||
return MY_XML_ERROR;
|
||||
}
|
||||
}
|
||||
else if ( (MY_XML_STRING==lex) || (MY_XML_IDENT==lex) )
|
||||
else if ((MY_XML_STRING == lex) || (MY_XML_IDENT == lex))
|
||||
{
|
||||
if((MY_XML_OK!=my_xml_enter(p,a.beg,(uint) (a.end-a.beg))) ||
|
||||
(MY_XML_OK!=my_xml_leave(p,a.beg,(uint) (a.end-a.beg))))
|
||||
if ((MY_XML_OK != my_xml_enter(p,a.beg,(uint) (a.end-a.beg))) ||
|
||||
(MY_XML_OK != my_xml_leave(p,a.beg,(uint) (a.end-a.beg))))
|
||||
return MY_XML_ERROR;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (lex==MY_XML_SLASH)
|
||||
if (lex == MY_XML_SLASH)
|
||||
{
|
||||
if(MY_XML_OK!=my_xml_leave(p,NULL,0))
|
||||
if (MY_XML_OK != my_xml_leave(p,NULL,0))
|
||||
return MY_XML_ERROR;
|
||||
lex=my_xml_scan(p,&a);
|
||||
}
|
||||
@@ -290,23 +291,23 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len)
|
||||
gt:
|
||||
if (question)
|
||||
{
|
||||
if (lex!=MY_XML_QUESTION)
|
||||
if (lex != MY_XML_QUESTION)
|
||||
{
|
||||
sprintf(p->errstr,"6: %s unexpected ('?' wanted)",lex2str(lex));
|
||||
return MY_XML_ERROR;
|
||||
}
|
||||
if(MY_XML_OK!=my_xml_leave(p,NULL,0))
|
||||
if (MY_XML_OK != my_xml_leave(p,NULL,0))
|
||||
return MY_XML_ERROR;
|
||||
lex=my_xml_scan(p,&a);
|
||||
}
|
||||
|
||||
if (exclam)
|
||||
{
|
||||
if(MY_XML_OK!=my_xml_leave(p,NULL,0))
|
||||
if (MY_XML_OK != my_xml_leave(p,NULL,0))
|
||||
return MY_XML_ERROR;
|
||||
}
|
||||
|
||||
if (lex!=MY_XML_GT)
|
||||
if (lex != MY_XML_GT)
|
||||
{
|
||||
sprintf(p->errstr,"5: %s unexpected ('>' wanted)",lex2str(lex));
|
||||
return MY_XML_ERROR;
|
||||
@@ -315,11 +316,11 @@ gt:
|
||||
else
|
||||
{
|
||||
a.beg=p->cur;
|
||||
for ( ; (p->cur < p->end) && (p->cur[0]!='<') ; p->cur++);
|
||||
for ( ; (p->cur < p->end) && (p->cur[0] != '<') ; p->cur++);
|
||||
a.end=p->cur;
|
||||
|
||||
my_xml_norm_text(&a);
|
||||
if (a.beg!=a.end)
|
||||
if (a.beg != a.end)
|
||||
{
|
||||
my_xml_value(p,a.beg,(uint) (a.end-a.beg));
|
||||
}
|
||||
@@ -381,7 +382,7 @@ uint my_xml_error_pos(MY_XML_PARSER *p)
|
||||
const char *s;
|
||||
for ( s=p->beg ; s<p->cur; s++)
|
||||
{
|
||||
if (s[0]=='\n')
|
||||
if (s[0] == '\n')
|
||||
beg=s;
|
||||
}
|
||||
return (uint) (p->cur-beg);
|
||||
@@ -391,9 +392,9 @@ uint my_xml_error_lineno(MY_XML_PARSER *p)
|
||||
{
|
||||
uint res=0;
|
||||
const char *s;
|
||||
for ( s=p->beg ; s<p->cur; s++)
|
||||
for (s=p->beg ; s<p->cur; s++)
|
||||
{
|
||||
if (s[0]=='\n')
|
||||
if (s[0] == '\n')
|
||||
res++;
|
||||
}
|
||||
return res;
|
||||
|
Reference in New Issue
Block a user