fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: I9812658e8a96dd35d686c7ae7a8b829267c5c8bc Reviewed-on: https://gerrit.libreoffice.org/13499 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
committed by
Noel Grandin
parent
28d9983e2c
commit
e31657a1ea
@@ -638,12 +638,11 @@ int Formula::parse()
|
||||
if( res ){
|
||||
makeMathML( res );
|
||||
}
|
||||
Node *tmpNode;
|
||||
int count = nodelist.size();
|
||||
for( int i = 0 ; i < count ; i++ ){
|
||||
tmpNode = nodelist.front();
|
||||
nodelist.pop_front();
|
||||
delete tmpNode;
|
||||
const Node *tmpNode = nodelist.front();
|
||||
nodelist.pop_front();
|
||||
delete tmpNode;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@@ -498,7 +498,6 @@ static hchar lineCharConv(hchar ch)
|
||||
static int KsSearch(hchar c)
|
||||
{
|
||||
int lo, hi, mid;
|
||||
hchar c2;
|
||||
|
||||
lo = mid = 0;
|
||||
hi = 2350 - 1;
|
||||
@@ -506,7 +505,7 @@ static int KsSearch(hchar c)
|
||||
while (lo <= hi)
|
||||
{
|
||||
mid = (lo + hi) >> 1;
|
||||
c2 = ksTbl[mid];
|
||||
hchar c2 = ksTbl[mid];
|
||||
if (c == c2)
|
||||
break;
|
||||
if (c < c2)
|
||||
@@ -1187,11 +1186,11 @@ hchar_string hstr2ucsstr(hchar const* hstr)
|
||||
::std::string hstr2ksstr(hchar const* hstr)
|
||||
{
|
||||
::std::string ret;
|
||||
int res, j;
|
||||
int j;
|
||||
hchar dest[3];
|
||||
for( ; *hstr ; )
|
||||
{
|
||||
res = hcharconv(*hstr++, dest, KS);
|
||||
int res = hcharconv(*hstr++, dest, KS);
|
||||
for( j = 0 ; j < res ; j++ ){
|
||||
int c = dest[j];
|
||||
if( c < 32 )
|
||||
@@ -1397,7 +1396,7 @@ char* base64_encode_string( const uchar *buf, unsigned int len )
|
||||
char * out;
|
||||
int inPos = 0;
|
||||
int outPos = 0;
|
||||
int c1, c2, c3;
|
||||
int c1, c2;
|
||||
unsigned int i;
|
||||
|
||||
out=(char *)malloc( (len*4/3)+8 );
|
||||
@@ -1407,7 +1406,7 @@ char* base64_encode_string( const uchar *buf, unsigned int len )
|
||||
{
|
||||
c1 = buf[inPos++] & 0xFF;
|
||||
c2 = buf[inPos++] & 0xFF;
|
||||
c3 = buf[inPos++] & 0xFF;
|
||||
int c3 = buf[inPos++] & 0xFF;
|
||||
out[outPos++] = basis_64[(c1 & 0xFC) >> 2];
|
||||
out[outPos++] = basis_64[((c1 & 0x03) << 4) | ((c2 & 0xF0) >> 4)];
|
||||
out[outPos++] = basis_64[((c2 & 0x0F) << 2) | ((c3 & 0xC0) >> 6)];
|
||||
|
@@ -383,12 +383,12 @@ static const hwpeq eq_tbl[] = {
|
||||
static const hwpeq *lookup_eqn(char *str)
|
||||
{
|
||||
static const int eqCount = SAL_N_ELEMENTS(eq_tbl);
|
||||
int m, k, l = 0, r = eqCount;
|
||||
int l = 0, r = eqCount;
|
||||
const hwpeq *result = 0;
|
||||
|
||||
while( l < r ) {
|
||||
m = (l + r) / 2;
|
||||
k = strcmp(eq_tbl[m].key, str);
|
||||
const int m = (l + r) / 2;
|
||||
const int k = strcmp(eq_tbl[m].key, str);
|
||||
if( k == 0 ) {
|
||||
result = eq_tbl + m;
|
||||
break;
|
||||
@@ -613,9 +613,8 @@ static int eq_word(MzString& outs, istream *strm, int status)
|
||||
|
||||
if( 0 != (eq = lookup_eqn(keyword)) ) {
|
||||
int nargs = eq->nargs;
|
||||
int ch;
|
||||
while( nargs-- ) {
|
||||
ch = read_white_space(state, strm);
|
||||
const int ch = read_white_space(state, strm);
|
||||
if( ch != '{' ) state << '{';
|
||||
eq_word(state, strm, script_status);
|
||||
if( ch != '{' ) state << '}';
|
||||
|
@@ -270,13 +270,10 @@ bool HWPFile::ReadParaList(std::list < HWPPara* > &aplist, unsigned char flag)
|
||||
|
||||
bool HWPFile::TagsRead(void)
|
||||
{
|
||||
ulong tag;
|
||||
long size;
|
||||
|
||||
while (true)
|
||||
{
|
||||
tag = Read4b();
|
||||
size = Read4b();
|
||||
ulong tag = Read4b();
|
||||
long size = Read4b();
|
||||
if (size <= 0 && tag > 0){
|
||||
continue;
|
||||
}
|
||||
@@ -374,11 +371,10 @@ ColumnDef *HWPFile::GetColumnDef(int num)
|
||||
int HWPFile::GetPageMasterNum(int page)
|
||||
{
|
||||
std::list<ColumnInfo*>::iterator it = columnlist.begin();
|
||||
ColumnInfo *now = 0;
|
||||
int i;
|
||||
|
||||
for( i = 1 ; it != columnlist.end() ; ++it, i++){
|
||||
now = *it;
|
||||
ColumnInfo *now = *it;
|
||||
if( page < now->start_page )
|
||||
return i-1;
|
||||
}
|
||||
@@ -619,10 +615,9 @@ int HWPFile::compareCharShape(CharShape *shape)
|
||||
int count = cslist.size();
|
||||
if( count > 0 )
|
||||
{
|
||||
CharShape *cshape=0;
|
||||
for(int i = 0; i< count; i++)
|
||||
{
|
||||
cshape = getCharShape(i);
|
||||
CharShape *cshape = getCharShape(i);
|
||||
|
||||
if( shape->size == cshape->size &&
|
||||
shape->font[0] == cshape->font[0] &&
|
||||
@@ -646,10 +641,9 @@ int HWPFile::compareParaShape(ParaShape *shape)
|
||||
int count = pslist.size();
|
||||
if( count > 0 )
|
||||
{
|
||||
ParaShape *pshape=0;
|
||||
for(int i = 0; i< count; i++)
|
||||
{
|
||||
pshape = getParaShape(i);
|
||||
ParaShape *pshape = getParaShape(i);
|
||||
if( shape->left_margin == pshape->left_margin &&
|
||||
shape->right_margin == pshape->right_margin &&
|
||||
shape->pspacing_prev == pshape->pspacing_prev &&
|
||||
|
@@ -3962,14 +3962,14 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
|
||||
{
|
||||
int x = hbox->pgx;
|
||||
int y = hbox->pgy;
|
||||
int a, b;
|
||||
bool bIsRotate = false;
|
||||
|
||||
while (drawobj)
|
||||
{
|
||||
padd("draw:style-name", sXML_CDATA,
|
||||
ascii(Int2Str(drawobj->index, "Draw%d", buf)));
|
||||
a = 0; b = 0;
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
|
||||
switch (hbox->style.anchor_type)
|
||||
{
|
||||
|
@@ -81,14 +81,14 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b)
|
||||
int i, j, k;
|
||||
int irow = 0;
|
||||
int icol = 0;
|
||||
double big, pivinv, save;
|
||||
double save;
|
||||
|
||||
for (j = 0; j < n; j++)
|
||||
ipiv[j] = 0;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
big = 0;
|
||||
double big = 0;
|
||||
for (j = 0; j < n; j++)
|
||||
{
|
||||
if ( ipiv[j] != 1 )
|
||||
@@ -137,7 +137,7 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b)
|
||||
return 0;
|
||||
}
|
||||
|
||||
pivinv = 1/a[icol][icol];
|
||||
double pivinv = 1/a[icol][icol];
|
||||
a[icol][icol] = 1;
|
||||
for (k = 0; k < n; k++)
|
||||
a[icol][k] *= pivinv;
|
||||
|
Reference in New Issue
Block a user