mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2
This patch fixes a number of GCC warnings about variables used
before initialized. A new macro UNINIT_VAR() is introduced for
use in the variable declaration, and LINT_INIT() usage will be
gradually deprecated. (A workaround is used for g++, pending a
patch for a g++ bug.)
GCC warnings for unused results (attribute warn_unused_result)
for a number of system calls (present at least in later
Ubuntus, where the usual void cast trick doesn't work) are
also fixed.
client/mysqlmanager-pwgen.c:
A fix for warn_unused_result, adding fallback to use of
srand()/rand() if /dev/random cannot be used. Also actually
adds calls to rand() in the second branch so that it actually
creates a random password.
This commit is contained in:
@@ -935,13 +935,10 @@ int Gis_polygon::interior_ring_n(uint32 num, String *result) const
|
||||
int Gis_polygon::centroid_xy(double *x, double *y) const
|
||||
{
|
||||
uint32 n_linear_rings;
|
||||
double res_area;
|
||||
double res_cx, res_cy;
|
||||
double UNINIT_VAR(res_area);
|
||||
double UNINIT_VAR(res_cx), UNINIT_VAR(res_cy);
|
||||
const char *data= m_data;
|
||||
bool first_loop= 1;
|
||||
LINT_INIT(res_area);
|
||||
LINT_INIT(res_cx);
|
||||
LINT_INIT(res_cy);
|
||||
|
||||
if (no_data(data, 4))
|
||||
return 1;
|
||||
@@ -1634,14 +1631,10 @@ int Gis_multi_polygon::centroid(String *result) const
|
||||
uint32 n_polygons;
|
||||
bool first_loop= 1;
|
||||
Gis_polygon p;
|
||||
double res_area, res_cx, res_cy;
|
||||
double UNINIT_VAR(res_area), UNINIT_VAR(res_cx), UNINIT_VAR(res_cy);
|
||||
double cur_area, cur_cx, cur_cy;
|
||||
const char *data= m_data;
|
||||
|
||||
LINT_INIT(res_area);
|
||||
LINT_INIT(res_cx);
|
||||
LINT_INIT(res_cy);
|
||||
|
||||
if (no_data(data, 4))
|
||||
return 1;
|
||||
n_polygons= uint4korr(data);
|
||||
|
||||
Reference in New Issue
Block a user