Reduce the scope of some local variables

This commit is contained in:
Paul Cornett
2019-04-05 10:44:02 -07:00
parent af1cf0a5f3
commit fe1737d399
63 changed files with 163 additions and 152 deletions

View File

@@ -732,10 +732,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x)
if (!has_non_ascii)
{
wxFileSystem fsys;
wxFSFile *f;
// 1. try to open given file:
for (i = 0; i < cnt; i++)
{
wxFSFile *f;
f = fsys.OpenFile(m_bookRecords[i].GetFullPath(x));
if (f)
{

View File

@@ -861,9 +861,9 @@ bool wxHtmlHelpWindow::KeywordSearch(const wxString& keyword,
wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
#endif
int curi;
while (status.IsActive())
{
int curi;
curi = status.GetCurIndex();
if (curi % 32 == 0
#if wxUSE_PROGRESSDLG
@@ -1092,13 +1092,13 @@ void wxHtmlHelpWindow::ReadCustomization(wxConfigBase *cfg, const wxString& path
m_FontSize = cfg->Read(wxT("hcBaseFontSize"), m_FontSize);
{
int i;
int cnt;
wxString val, s;
cnt = cfg->Read(wxT("hcBookmarksCnt"), 0L);
if (cnt != 0)
{
int i;
m_BookmarksNames.Clear();
m_BookmarksPages.Clear();
if (m_Bookmarks)
@@ -1296,7 +1296,6 @@ wxEND_EVENT_TABLE()
void wxHtmlHelpWindow::OptionsDialog()
{
wxHtmlHelpWindowOptionsDialog dlg(this);
unsigned i;
if (m_NormalFonts == NULL)
{
@@ -1331,6 +1330,7 @@ void wxHtmlHelpWindow::OptionsDialog()
// Lock updates to the choice controls before inserting potentially many
// items into them until the end of this block.
{
unsigned i;
wxWindowUpdateLocker lockNormalFont(dlg.NormalFont);
wxWindowUpdateLocker lockFixedFont(dlg.FixedFont);

View File

@@ -730,8 +730,8 @@ void wxHtmlContainerCell::Layout(int w)
wxHtmlCell *nextCell;
long xpos = 0, ypos = m_IndentTop;
int xdelta = 0, ybasicpos = 0, ydiff;
int s_width, nextWordWidth, s_indent;
int xdelta = 0, ybasicpos = 0;
int s_width, s_indent;
int ysizeup = 0, ysizedown = 0;
int MaxLineWidth = 0;
int curLineWidth = 0;
@@ -784,6 +784,7 @@ void wxHtmlContainerCell::Layout(int w)
case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell->GetHeight(); break;
case wxHTML_ALIGN_CENTER : ybasicpos = - cell->GetHeight() / 2; break;
}
int ydiff;
ydiff = cell->GetHeight() + ybasicpos;
if (cell->GetDescent() + ydiff > ysizedown) ysizedown = cell->GetDescent() + ydiff;
@@ -809,6 +810,7 @@ void wxHtmlContainerCell::Layout(int w)
cell = cell->GetNext();
// compute length of the next word that would be added:
int nextWordWidth;
nextWordWidth = 0;
if (cell)
{
@@ -1322,9 +1324,9 @@ wxHtmlCell *wxHtmlContainerCell::GetFirstTerminal() const
{
if ( m_Cells )
{
wxHtmlCell *c2;
for (wxHtmlCell *c = m_Cells; c; c = c->GetNext())
{
wxHtmlCell *c2;
c2 = c->GetFirstTerminal();
if ( c2 )
return c2;

View File

@@ -150,7 +150,6 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur,
if (end_pos <= begin_pos)
return;
wxChar c;
wxString::const_iterator i = begin_pos;
wxString::const_iterator textBeginning = begin_pos;
@@ -165,6 +164,7 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur,
while (i < end_pos)
{
wxChar c;
c = *i;
if (c == wxT('<'))

View File

@@ -454,7 +454,6 @@ bool wxHtmlWindow::DoSetPage(const wxString& source)
if (m_Processors || m_GlobalProcessors)
{
wxHtmlProcessorList::compatibility_iterator nodeL, nodeG;
int prL, prG;
if ( m_Processors )
nodeL = m_Processors->GetFirst();
@@ -468,6 +467,7 @@ bool wxHtmlWindow::DoSetPage(const wxString& source)
// in every iteration
while (nodeL || nodeG)
{
int prL, prG;
prL = (nodeL) ? nodeL->GetData()->GetPriority() : -1;
prG = (nodeG) ? nodeG->GetData()->GetPriority() : -1;
if (prL > prG)

View File

@@ -86,10 +86,10 @@ TAG_HANDLER_BEGIN(FONT, "FONT" )
m_Faces = wxFontEnumerator::GetFacenames();
wxStringTokenizer tk(faces, wxT(","));
int index;
while (tk.HasMoreTokens())
{
int index;
if ((index = m_Faces.Index(tk.GetNextToken(), false)) != wxNOT_FOUND)
{
m_WParser->SetFontFace(m_Faces[index]);