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

@ -155,13 +155,14 @@ Card* Pile::RemoveTopCard()
//+-------------------------------------------------------------+
Card* Pile::RemoveTopCard(wxDC& dc, int xOffset, int yOffset)
{
int topX, topY, x, y;
int topX, topY;
GetTopCardPos(topX, topY);
Card* card = RemoveTopCard();
if (card)
{
int x, y;
card->Erase(dc, topX - xOffset, topY - yOffset);
GetTopCardPos(x, y);
if (m_topCard < 0)

View File

@ -584,7 +584,7 @@ extern int g_tab2[];
bool Life::NextTic()
{
LifeCellBox *c, *up, *dn, *lf, *rt;
wxUint32 t1, t2, t3, t4;
wxUint32 t1, t2;
bool changed = false;
m_numcells = 0;
@ -833,6 +833,7 @@ bool Life::NextTic()
t1 = 0;
t2 = 0;
wxUint32 t3, t4;
t3 = c->m_live1;
c->m_old1 = t3;

View File

@ -148,7 +148,6 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
int i = pages[current_page];
int ch = -1;
int y = 0;
int j;
wxChar *line_ptr;
int curr_width = 0;
bool page_break = false;
@ -204,6 +203,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y)
while (ch != 0 && !page_break)
{
int j;
j = 0;
#if defined(__WXMSW__) || defined(__WXMAC__)
while (((ch = poem_buffer[i]) != 13) && (ch != 0))
@ -464,8 +464,6 @@ void MainWindow::PreviousPage(void)
// Search for a string
void MainWindow::Search(bool ask)
{
long position;
if (ask || m_searchString.empty())
{
wxString s = wxGetTextFromUser( wxT("Enter search string"), wxT("Search"), m_searchString);
@ -488,6 +486,7 @@ void MainWindow::Search(bool ask)
if (!m_searchString.empty() && search_ok)
{
long position;
position = DoSearch();
if (position > -1)
{

View File

@ -1613,11 +1613,11 @@ void MyFrame::OnUpdateFormat(wxUpdateUIEvent& event)
void MyFrame::OnUpdateImage(wxUpdateUIEvent& event)
{
wxRichTextRange range;
wxRichTextObject *obj;
range = m_richTextCtrl->GetSelectionRange();
if (range.ToInternal().GetLength() == 1)
{
wxRichTextObject *obj;
obj = m_richTextCtrl->GetFocusObject()->GetLeafObjectAtPosition(range.GetStart());
if (obj && obj->IsKindOf(CLASSINFO(wxRichTextImage)))
{

View File

@ -343,13 +343,12 @@ public:
wxSize clientSize = GetClientSize();
wxCoord y = 0;
wxCoord x = 0;
for ( size_t row = rowFirst; row < rowLast; row++ )
{
wxCoord rowHeight = OnGetRowHeight(row);
dc.DrawLine(0, y, clientSize.GetWidth(), y);
x = 0;
wxCoord x = 0;
for ( size_t col = columnFirst; col < columnLast; col++ )
{
wxCoord colWidth = OnGetColumnWidth(col);

View File

@ -1571,12 +1571,13 @@ void wxAuiToolBar::ToggleTool(int tool_id, bool state)
{
if (tool->m_kind == wxITEM_RADIO)
{
int i, idx, count;
int idx, count;
idx = GetToolIndex(tool_id);
count = (int)m_items.GetCount();
if (idx >= 0 && idx < count)
{
int i;
for (i = idx + 1; i < count; ++i)
{
if (m_items[i].m_kind != wxITEM_RADIO)

View File

@ -1674,7 +1674,7 @@ void wxAuiManager::GetPanePositionsAndSizes(wxAuiDockInfo& dock,
positions.Empty();
sizes.Empty();
int offset, action_pane = -1;
int action_pane = -1;
int pane_i, pane_count = dock.panes.GetCount();
// find the pane marked as our action pane
@ -1737,7 +1737,7 @@ void wxAuiManager::GetPanePositionsAndSizes(wxAuiDockInfo& dock,
// if the dock mode is fixed, make sure none of the panes
// overlap; we will bump panes that overlap
offset = 0;
int offset = 0;
for (pane_i = action_pane; pane_i < pane_count; ++pane_i)
{
int amount = positions[pane_i] - offset;

View File

@ -308,9 +308,9 @@ void wxAuiGtkTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& p
wxCoord textX = tab_rect.x + padding + style_notebook->xthickness;
int bitmap_offset = 0;
if (page.bitmap.IsOk())
{
int bitmap_offset;
bitmap_offset = textX;
// draw bitmap

View File

@ -370,13 +370,14 @@ int wxArrayString::Index(const wxString& str, bool bCase, bool bFromEnd) const
wxASSERT_MSG( bCase && !bFromEnd,
wxT("search parameters ignored for auto sorted array") );
size_t i,
size_t
lo = 0,
hi = m_nCount;
int res;
while ( lo < hi ) {
size_t i;
i = (lo + hi)/2;
int res;
res = str.compare(m_pItems[i]);
if ( res < 0 )
hi = i;
@ -416,13 +417,14 @@ size_t wxArrayString::Add(const wxString& str, size_t nInsert)
{
if ( m_autoSort ) {
// insert the string at the correct position to keep the array sorted
size_t i,
size_t
lo = 0,
hi = m_nCount;
int res;
while ( lo < hi ) {
size_t i;
i = (lo + hi)/2;
int res;
res = m_compareFunction ? m_compareFunction(str, m_pItems[i]) : str.Cmp(m_pItems[i]);
if ( res < 0 )
hi = i;

View File

@ -792,13 +792,13 @@ static wxPointList wx_spline_point_list;
void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4,
double b4)
{
double xmid, ymid;
double x1, y1, x2, y2, x3, y3, x4, y4;
wx_clear_stack();
wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4);
while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) {
double xmid, ymid;
xmid = (double)half(x2, x3);
ymid = (double)half(y2, y3);
if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD &&
@ -888,7 +888,7 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points )
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
const wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
double cx1, cy1, cx2, cy2;
double x1, y1, x2, y2;
wxPointList::compatibility_iterator node = points->GetFirst();
@ -919,6 +919,7 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points )
#endif // !wxUSE_STD_CONTAINERS
)
{
double cx3, cy3, cx4, cy4;
p = node->GetData();
x1 = x2;
y1 = y2;

View File

@ -911,7 +911,6 @@ bool wxStandardDialogLayoutAdapter::DoFitWithScrolling(wxDialog* dialog, wxWindo
wxSize windowSize, displaySize;
int scrollFlags = DoMustScroll(dialog, windowSize, displaySize);
int scrollBarSize = 20;
if (scrollFlags)
{
@ -922,6 +921,7 @@ bool wxStandardDialogLayoutAdapter::DoFitWithScrolling(wxDialog* dialog, wxWindo
if (windows.GetCount() != 0)
{
// Allow extra for a scrollbar, assuming we resizing in one direction only.
int scrollBarSize = 20;
if ((resizeVertically && !resizeHorizontally) && (windowSize.x < (displaySize.x - scrollBarSize)))
scrollBarExtraX = scrollBarSize;
if ((resizeHorizontally && !resizeVertically) && (windowSize.y < (displaySize.y - scrollBarSize)))

View File

@ -2235,11 +2235,10 @@ bool wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream)
if ( !file.IsOpened() )
return false;
char buf[4096];
size_t nRead;
do
{
char buf[4096];
size_t nRead;
nRead = file.Read(buf, WXSIZEOF(buf));
if ( file.Error() )
return false;

View File

@ -157,12 +157,12 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e
else // output !Unicode
{
CharsetItem *rev = BuildReverseTable(out_tbl);
CharsetItem *item;
CharsetItem key;
for (i = 0; i < 128; i++)
{
key.u = in_tbl[i];
CharsetItem* item;
item = (CharsetItem*) bsearch(&key, rev, 128, sizeof(CharsetItem), CompareCharsetItems);
if (item == NULL && method == wxCONVERT_SUBSTITUTE)
item = (CharsetItem*) bsearch(&key, encoding_unicode_fallback,

View File

@ -263,11 +263,11 @@ wxFileOffset wxFFile::Length() const
wxCHECK_MSG( IsOpened(), wxInvalidOffset,
wxT("wxFFile::Length(): file is closed!") );
wxFFile& self = *const_cast<wxFFile *>(this);
wxFileOffset posOld = Tell();
if ( posOld != wxInvalidOffset )
{
wxFFile& self = *const_cast<wxFFile*>(this);
if ( self.SeekEnd() )
{
wxFileOffset len = Tell();

View File

@ -1535,16 +1535,17 @@ wxString wxFileConfigGroup::GetFullName() const
wxFileConfigEntry *
wxFileConfigGroup::FindEntry(const wxString& name) const
{
size_t i,
size_t
lo = 0,
hi = m_aEntries.GetCount();
int res;
wxFileConfigEntry *pEntry;
while ( lo < hi ) {
size_t i;
i = (lo + hi)/2;
pEntry = m_aEntries[i];
int res;
#if wxCONFIG_CASE_SENSITIVE
res = pEntry->Name().compare(name);
#else
@ -1565,16 +1566,17 @@ wxFileConfigGroup::FindEntry(const wxString& name) const
wxFileConfigGroup *
wxFileConfigGroup::FindSubgroup(const wxString& name) const
{
size_t i,
size_t
lo = 0,
hi = m_aSubgroups.GetCount();
int res;
wxFileConfigGroup *pGroup;
while ( lo < hi ) {
size_t i;
i = (lo + hi)/2;
pGroup = m_aSubgroups[i];
int res;
#if wxCONFIG_CASE_SENSITIVE
res = pGroup->Name().compare(name);
#else

View File

@ -58,12 +58,12 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location)
{
wxString ext, mime;
wxString loc = GetRightLocation(location);
wxChar c;
int l = loc.length(), l2;
l2 = l;
for (int i = l-1; i >= 0; i--)
{
wxChar c;
c = loc[(unsigned int) i];
if ( c == wxT('#') )
l2 = i + 1;
@ -234,10 +234,10 @@ wxString wxFileSystemHandler::GetRightLocation(const wxString& location)
/* static */
wxString wxFileSystemHandler::GetAnchor(const wxString& location)
{
wxChar c;
int l = location.length();
for (int i = l-1; i >= 0; i--) {
wxChar c;
c = location[i];
if (c == wxT('#'))
return location.Right(l-i-1);
@ -384,7 +384,6 @@ static wxString MakeCorrectPath(const wxString& path)
void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir)
{
int i, pathpos = -1;
m_Path = MakeCorrectPath(location);
@ -393,9 +392,9 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir)
if (!m_Path.empty() && m_Path.Last() != wxT('/') && m_Path.Last() != wxT(':'))
m_Path << wxT('/');
}
else
{
int i, pathpos = -1;
for (i = m_Path.length()-1; i >= 0; i--)
{
if (m_Path[(unsigned int) i] == wxT('/'))

View File

@ -546,11 +546,11 @@ void wxGridBagSizer::RepositionChildren(const wxSize& minSize)
wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
int row, col, endrow, endcol;
wxGBSizerItem* item = (wxGBSizerItem*)node->GetData();
if ( item->IsShown() )
{
int row, col, endrow, endcol;
item->GetPos(row, col);
item->GetEndPos(endrow, endcol);

View File

@ -376,7 +376,7 @@ wxGIFDecoder::dgif(wxInputStream& stream, GIFImage *img, int interl, int bits)
int pos; // index into decompresion stack
unsigned int x, y; // position in image buffer
int code, readcode, lastcode, abcabca;
int code, lastcode, abcabca;
// these won't change
ab_clr = (1 << bits);
@ -399,6 +399,7 @@ wxGIFDecoder::dgif(wxInputStream& stream, GIFImage *img, int interl, int bits)
do
{
// get next code
int readcode;
readcode = code = getcode(stream, ab_bits, ab_fin);
// end of image?

View File

@ -1004,7 +1004,6 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
{
wxUint16 aWord;
wxInt32 dbuf[4];
wxInt8 bbuf[4];
// offset to bitmap data
wxFileOffset offset;
@ -1012,6 +1011,7 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
wxInt32 hdrSize;
if ( IsBmp )
{
wxInt8 bbuf[4];
// read the header off the .BMP format file
if ( !stream.ReadAll(bbuf, 2) ||
!stream.ReadAll(dbuf, 16) )

View File

@ -1339,7 +1339,6 @@ wxImage wxImage::Rotate90( bool clockwise ) const
if ( source_alpha )
{
unsigned char *alpha_data = image.GetAlpha();
unsigned char *target_alpha = 0 ;
for (long ii = 0; ii < width; )
{
@ -1351,6 +1350,7 @@ wxImage wxImage::Rotate90( bool clockwise ) const
for (long i = ii; i < next_ii; i++)
{
unsigned char* target_alpha;
if ( clockwise )
{
target_alpha = alpha_data + (i+1)*height - j - 1;
@ -1929,10 +1929,10 @@ void wxImage::SetRGB( const wxRect& rect_, unsigned char r, unsigned char g, uns
x2 = rect.GetRight() + 1,
y2 = rect.GetBottom() + 1;
unsigned char *data wxDUMMY_INITIALIZE(NULL);
int x, y, width = GetWidth();
for (y = y1; y < y2; y++)
{
unsigned char* data;
data = M_IMGDATA->m_data + (y*width + x1)*3;
for (x = x1; x < x2; x++)
{
@ -3236,8 +3236,6 @@ void wxImage::RotateHue(double angle)
{
AllocExclusive();
unsigned char *srcBytePtr;
unsigned char *dstBytePtr;
unsigned long count;
wxImage::HSVValue hsv;
wxImage::RGBValue rgb;
@ -3246,6 +3244,8 @@ void wxImage::RotateHue(double angle)
count = M_IMGDATA->m_width * M_IMGDATA->m_height;
if ( count > 0 && !wxIsNullDouble(angle) )
{
unsigned char* srcBytePtr;
unsigned char* dstBytePtr;
srcBytePtr = M_IMGDATA->m_data;
dstBytePtr = srcBytePtr;
do
@ -3448,9 +3448,8 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) const
{
wxHashTable h;
wxObject dummy;
unsigned char r, g, b;
unsigned char *p;
unsigned long size, nentries, key;
unsigned long size, nentries;
p = GetData();
size = static_cast<unsigned long>(GetWidth()) * GetHeight();
@ -3458,6 +3457,8 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) const
for (unsigned long j = 0; (j < size) && (nentries <= stopafter) ; j++)
{
unsigned char r, g, b;
unsigned long key;
r = *(p++);
g = *(p++);
b = *(p++);
@ -3483,9 +3484,9 @@ unsigned long wxImage::ComputeHistogram( wxImageHistogram &h ) const
const unsigned long size = static_cast<unsigned long>(GetWidth()) * GetHeight();
unsigned char r, g, b;
for ( unsigned long n = 0; n < size; n++ )
{
unsigned char r, g, b;
r = *p++;
g = *p++;
b = *p++;

View File

@ -394,9 +394,7 @@ bool wxGIFHandler::SetupCompress(wxOutputStream *stream, int bpp)
bool wxGIFHandler::CompressLine(wxOutputStream *stream,
const wxUint8 *line, int lineLen)
{
int i = 0, crntCode, newCode;
unsigned long newKey;
wxUint8 pixel;
int i = 0, crntCode;
if (m_crntCode == FIRST_CODE) // It's first time!
crntCode = line[i++];
else
@ -405,10 +403,13 @@ bool wxGIFHandler::CompressLine(wxOutputStream *stream,
while (i < lineLen)
{
// Decode lineLen items.
wxUint8 pixel;
pixel = line[i++]; // Get next pixel from stream.
// Form a new unique key to search hash table for the code combines
// crntCode as Prefix string with Pixel as postfix char.
unsigned long newKey;
newKey = (((unsigned long) crntCode) << 8) + pixel;
int newCode;
if ((newCode = ExistsHashTable(newKey)) >= 0)
{
// This Key is already there, or the string is old one, so

View File

@ -44,7 +44,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPCXHandler,wxImageHandler);
static
void RLEencode(unsigned char *p, unsigned int size, wxOutputStream& s)
{
unsigned int data, last, cont;
unsigned int last, cont;
// Write 'size' bytes. The PCX official specs say there will be
// a decoding break at the end of each scanline, so in order to
@ -57,6 +57,7 @@ void RLEencode(unsigned char *p, unsigned int size, wxOutputStream& s)
while (size-- > 0)
{
unsigned data;
data = (unsigned char) *(p++);
// Up to 63 bytes with the same value can be stored using
@ -266,8 +267,6 @@ int ReadPCX(wxImage *image, wxInputStream& stream)
if (format == wxPCX_8BIT)
{
unsigned char index;
if (stream.GetC() != 12)
return wxPCX_INVFORMAT;
@ -276,6 +275,7 @@ int ReadPCX(wxImage *image, wxInputStream& stream)
p = image->GetData();
for (unsigned long k = height * width; k; k--)
{
unsigned char index;
index = *p;
*(p++) = pal[3 * index];
*(p++) = pal[3 * index + 1];
@ -310,7 +310,6 @@ static
int SavePCX(wxImage *image, wxOutputStream& stream)
{
unsigned char hdr[128]; // PCX header
unsigned char pal[768]; // palette for 8 bit images
unsigned char *p; // space to store one scanline
unsigned char *src; // pointer into wxImage data
unsigned int width, height; // size of the image
@ -376,10 +375,9 @@ int SavePCX(wxImage *image, wxOutputStream& stream)
{
case wxPCX_8BIT:
{
unsigned char r, g, b;
for (i = 0; i < width; i++)
{
unsigned char r, g, b;
r = *(src++);
g = *(src++);
b = *(src++);
@ -409,15 +407,15 @@ int SavePCX(wxImage *image, wxOutputStream& stream)
// For 8 bit images, build the palette and write it to the stream:
if (format == wxPCX_8BIT)
{
unsigned char pal[768];
// zero unused colours
memset(pal, 0, sizeof(pal));
unsigned long index;
for (wxImageHistogram::iterator entry = histogram.begin();
entry != histogram.end(); ++entry )
{
key = entry->first;
unsigned long index;
index = entry->second.index;
pal[3 * index] = (unsigned char)(key >> 16);
pal[3 * index + 1] = (unsigned char)(key >> 8);

View File

@ -97,9 +97,10 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
if (c=='2') // Ascii GREY
{
wxUint32 value, size=width*height;
wxUint32 size=width*height;
for (wxUint32 i=0; i<size; ++i)
{
wxUint32 value;
value=text_stream.Read32();
if ( maxval != 255 )
value = (255 * value)/maxval;
@ -118,11 +119,12 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
}
if (c=='3') // Ascii RBG
{
wxUint32 value, size=3*width*height;
wxUint32 size=3*width*height;
for (wxUint32 i=0; i<size; ++i)
{
//this is very slow !!!
//I wonder how we can make any better ?
wxUint32 value;
value=text_stream.Read32();
if ( maxval != 255 )
value = (255 * value)/maxval;
@ -141,9 +143,9 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
if (c=='5') // Raw GREY
{
wxUint32 size=width*height;
unsigned char value;
for (wxUint32 i=0; i<size; ++i)
{
unsigned char value;
buf_stream.Read(&value,1);
if ( maxval != 255 )
value = (255 * value)/maxval;

View File

@ -106,7 +106,6 @@ int DecodeRLE(unsigned char* imageData, unsigned long imageSize,
short pixelSize, wxInputStream& stream)
{
unsigned long outputLength = 0;
unsigned char current;
unsigned int length;
unsigned char buf[4];
@ -116,6 +115,7 @@ int DecodeRLE(unsigned char* imageData, unsigned long imageSize,
if ( ch == wxEOF )
return wxTGA_IOERR;
unsigned char current;
current = ch;
// RLE packet.
@ -373,10 +373,9 @@ int ReadTGA(wxImage* image, wxInputStream& stream)
case 16:
{
unsigned char temp;
for (unsigned long index = 0; index < imageSize; index += pixelSize)
{
unsigned char temp;
temp = (imageData[index + 1] & 0x7c) << 1;
temp |= temp >> 5;
*(dst++) = temp;
@ -571,10 +570,9 @@ int ReadTGA(wxImage* image, wxInputStream& stream)
case 16:
{
unsigned char temp;
for (unsigned long index = 0; index < imageSize; index += pixelSize)
{
unsigned char temp;
temp = (imageData[index + 1] & 0x7c) << 1;
temp |= temp >> 5;
*(dst++) = temp;

View File

@ -1087,10 +1087,10 @@ wxString wxMenuBarBase::GetHelpString(int itemid) const
void wxMenuBarBase::UpdateMenus()
{
wxMenu* menu;
int nCount = GetMenuCount();
for (int n = 0; n < nCount; n++)
{
wxMenu* menu;
menu = GetMenu( n );
if (menu != NULL)
menu->UpdateUI();

View File

@ -1195,7 +1195,6 @@ size_t wxMBConvUTF8::ToWChar(wchar_t *buf, size_t n,
while ((isNulTerminated ? *psz : srcLen--) && ((!buf) || (len < n)))
{
const char *opsz = psz;
bool invalid = false;
unsigned char cc = *psz++, fc = cc;
unsigned cnt;
for (cnt = 0; fc & 0x80; cnt++)
@ -1219,6 +1218,7 @@ size_t wxMBConvUTF8::ToWChar(wchar_t *buf, size_t n,
}
else
{
bool invalid = false;
cnt--;
if (!cnt)
{

View File

@ -1338,9 +1338,9 @@ wxString wxTarOutputStream::PaxHeaderPath(const wxString& format,
ret.reserve(format.length() + path.length() + 16);
size_t begin = 0;
size_t end;
for (;;) {
size_t end;
end = format.find('%', begin);
if (end == wxString::npos || end + 1 >= format.length())
break;

View File

@ -1478,9 +1478,9 @@ wxTranslations::~wxTranslations()
delete m_loader;
// free catalogs memory
wxMsgCatalog *pTmpCat;
while ( m_pMsgCat != NULL )
{
wxMsgCatalog* pTmpCat;
pTmpCat = m_pMsgCat;
m_pMsgCat = m_pMsgCat->m_pNext;
delete pTmpCat;

View File

@ -526,9 +526,6 @@ static unsigned char ParseHexadecimal(char digit1, char digit2)
static bool GetRGBFromName(const char *inname, bool *isNone,
unsigned char *r, unsigned char*g, unsigned char *b)
{
int left, right, middle;
int cmp;
wxUint32 rgbVal;
char *name;
char *grey, *p;
@ -583,14 +580,18 @@ static bool GetRGBFromName(const char *inname, bool *isNone,
found = false;
// binary search:
int left, right;
left = 0;
right = numTheRGBRecords - 1;
do
{
int middle;
middle = (left + right) / 2;
int cmp;
cmp = strcmp(name, theRGBRecords[middle].name);
if ( cmp == 0 )
{
wxUint32 rgbVal;
rgbVal = theRGBRecords[middle].rgb;
*r = (unsigned char)((rgbVal >> 16) & 0xFF);
*g = (unsigned char)((rgbVal >> 8) & 0xFF);
@ -663,7 +664,6 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data)
unsigned width, height, colors_cnt, chars_per_pixel;
size_t i, j, i_key;
char key[64];
const char *clr_def;
wxXPMColourMap clr_tbl;
wxXPMColourMap::iterator it;
wxString maskKey;
@ -709,6 +709,7 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data)
for (i_key = 0; i_key < chars_per_pixel; i_key++)
key[i_key] = xmpColLine[i_key];
const char *clr_def;
clr_def = ParseColor(xmpColLine + chars_per_pixel);
if ( clr_def == NULL )

View File

@ -1471,7 +1471,7 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points )
// a and b are not used
//double a, b;
double c, d, x1, y1, x2, y2, x3, y3;
double c, d, x1, y1, x3, y3;
wxPoint *p, *q;
wxPointList::compatibility_iterator node = points->GetFirst();
@ -1509,6 +1509,7 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points )
node = node->GetNext();
while (node)
{
double x2, y2;
q = node->GetData();
x1 = x3;

View File

@ -1304,16 +1304,17 @@ void wxGridStringTable::SetValue( int row, int col, const wxString& value )
void wxGridStringTable::Clear()
{
int row, col;
int numRows, numCols;
int numRows;
numRows = m_data.GetCount();
if ( numRows > 0 )
{
int numCols;
numCols = m_data[0].GetCount();
int row;
for ( row = 0; row < numRows; row++ )
{
int col;
for ( col = 0; col < numCols; col++ )
{
m_data[row][col].clear();
@ -3167,10 +3168,10 @@ wxArrayInt wxGrid::CalcColLabelsExposed( const wxRegion& reg ) const
// find the cells within these bounds
//
int col;
int colPos;
for ( colPos = GetColPos( internalXToCol(left) ); colPos < m_numCols; colPos++ )
{
int col;
col = GetColAt( colPos );
if ( GetColRight(col) < left )
@ -5355,11 +5356,11 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells )
return;
int i, numCells = cells.GetCount();
int row, col, cell_rows, cell_cols;
wxGridCellCoordsArray redrawCells;
for ( i = numCells - 1; i >= 0; i-- )
{
int row, col, cell_rows, cell_cols;
row = cells[i].GetRow();
col = cells[i].GetCol();
GetCellSize( row, col, &cell_rows, &cell_cols );
@ -6141,12 +6142,12 @@ void wxGrid::DrawTextRectangle(wxDC& dc,
void wxGrid::StringToLines( const wxString& value, wxArrayString& lines ) const
{
int startPos = 0;
int pos;
wxString eol = wxTextFile::GetEOL( wxTextFileType_Unix );
wxString tVal = wxTextFile::Translate( value, wxTextFileType_Unix );
while ( startPos < (int)tVal.length() )
{
int pos;
pos = tVal.Mid(startPos).Find( eol );
if ( pos < 0 )
{
@ -6774,7 +6775,6 @@ bool wxGrid::IsVisible( int row, int col, bool wholeCellVisible ) const
//
void wxGrid::MakeCellVisible( int row, int col )
{
int i;
int xpos = -1, ypos = -1;
if ( row >= 0 && row < m_numRows &&
@ -6799,6 +6799,7 @@ void wxGrid::MakeCellVisible( int row, int col )
{
int h = r.GetHeight();
ypos = r.GetTop();
int i;
for ( i = row - 1; i >= 0; i-- )
{
int rowHeight = GetRowHeight(i);

View File

@ -597,10 +597,9 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid,
int hAlign, vAlign;
attr.GetAlignment(&hAlign, &vAlign);
int overflowCols = 0;
if (attr.GetOverflow())
{
int overflowCols = 0;
int cols = grid.GetNumberCols();
int best_width = GetBestSize(grid,attr,dc,row,col).GetWidth();
int cell_rows, cell_cols;

View File

@ -349,9 +349,9 @@ bool wxExtHelpController::DisplaySection(int sectionNo)
wxBusyCursor b; // display a busy cursor
wxList::compatibility_iterator node = m_MapList->GetFirst();
wxExtHelpMapEntry *entry;
while (node)
{
wxExtHelpMapEntry* entry;
entry = (wxExtHelpMapEntry *)node->GetData();
if (entry->entryid == sectionNo)
return DisplayHelp(entry->url);

View File

@ -3129,10 +3129,13 @@ void wxListMainWindow::SetImageList( wxImageList *imageList, int which )
m_dirty = true;
// calc the spacing from the icon size
int width = 0, height = 0;
int width = 0;
if ((imageList) && (imageList->GetImageCount()) )
{
int height;
imageList->GetSize(0, width, height);
}
if (which == wxIMAGE_LIST_NORMAL)
{
@ -4052,16 +4055,16 @@ void wxListMainWindow::DeleteItem( long lindex )
// we're deleting contain the Max Column Width
wxListLineData * const line = GetLine(index);
wxListItemDataList::compatibility_iterator n;
wxListItemData *itemData;
wxListItem item;
int itemWidth;
for (size_t i = 0; i < m_columns.GetCount(); i++)
{
n = line->m_items.Item( i );
wxListItemData* itemData;
itemData = n->GetData();
itemData->GetItem(item);
int itemWidth;
itemWidth = GetItemWidthWithImage(&item);
wxColWidthInfo *pWidthInfo = m_aColWidths.Item(i);

View File

@ -709,21 +709,21 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest(const wxPoint& point,
if ((point.x >= m_x) && (point.x <= m_x+m_width))
{
int image_w = -1;
int image_h;
// assuming every image (normal and selected) has the same size!
if ( (GetImage() != NO_IMAGE) && theCtrl->m_imageListNormal )
{
int image_h;
theCtrl->m_imageListNormal->GetSize(GetImage(),
image_w, image_h);
}
int state_w = -1;
int state_h;
if ( (GetState() != wxTREE_ITEMSTATE_NONE) &&
theCtrl->m_imageListState )
{
int state_h;
theCtrl->m_imageListState->GetSize(GetState(),
state_w, state_h);
}
@ -3419,18 +3419,20 @@ bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item,
if ( textOnly )
{
int image_h = 0, image_w = 0;
int image_w = 0;
int image = ((wxGenericTreeItem*) item.m_pItem)->GetCurrentImage();
if ( image != NO_IMAGE && m_imageListNormal )
{
int image_h;
m_imageListNormal->GetSize( image, image_w, image_h );
image_w += MARGIN_BETWEEN_IMAGE_AND_TEXT;
}
int state_h = 0, state_w = 0;
int state_w = 0;
int state = ((wxGenericTreeItem*) item.m_pItem)->GetState();
if ( state != wxTREE_ITEMSTATE_NONE && m_imageListState )
{
int state_h;
m_imageListState->GetSize( state, state_w, state_h );
if ( image_w != 0 )
state_w += MARGIN_BETWEEN_STATE_AND_IMAGE;

View File

@ -677,12 +677,12 @@ int wxListBox::GetSelections( wxArrayInt& aSelections ) const
aSelections.Empty();
int i = 0;
GtkTreeIter iter;
GtkTreeSelection* selection = gtk_tree_view_get_selection(m_treeview);
if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(m_liststore), &iter))
{ //gtk_tree_selection_get_selected_rows is GTK 2.2+ so iter instead
int i = 0;
do
{
if (gtk_tree_selection_iter_is_selected(selection, &iter))

View File

@ -1699,7 +1699,7 @@ void wxGtkPrinterDCImpl::DoDrawSpline(const wxPointList *points)
{
SetPen (m_pen);
double c, d, x1, y1, x2, y2, x3, y3;
double c, d, x1, y1, x3, y3;
wxPoint *p, *q;
wxPointList::compatibility_iterator node = points->GetFirst();
@ -1726,6 +1726,7 @@ void wxGtkPrinterDCImpl::DoDrawSpline(const wxPointList *points)
node = node->GetNext();
while (node)
{
double x2, y2;
q = node->GetData();
x1 = x3;

View File

@ -409,11 +409,12 @@ au_check_word( GtkTextIter *s, GtkTextIter *e )
gtk_text_iter_forward_char(&end);
wxGtkString text(gtk_text_iter_get_text( &start, &end ));
size_t len = strlen(text), prefix_len;
size_t len = strlen(text);
size_t n;
for( n = 0; n < WXSIZEOF(URIPrefixes); ++n )
{
size_t prefix_len;
prefix_len = strlen(URIPrefixes[n]);
if((len > prefix_len) && !wxStrnicmp(text, URIPrefixes[n], prefix_len))
break;

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]);

View File

@ -1104,7 +1104,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
const size_t n_bezier_points = n_points * 3 + 1;
POINT *lppt = new POINT[n_bezier_points];
size_t bezier_pos = 0;
wxCoord x1, y1, x2, y2, cx1, cy1, cx4, cy4;
wxCoord x1, y1, x2, y2, cx1, cy1;
wxPointList::compatibility_iterator node = points->GetFirst();
wxPoint *p = node->GetData();
@ -1135,6 +1135,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
while ((node = node->GetNext()))
#endif // !wxUSE_STD_CONTAINERS
{
int cx4, cy4;
p = (wxPoint *)node->GetData();
x1 = x2;
y1 = y2;

View File

@ -787,11 +787,11 @@ bool wxMenuItem::OnMeasureItem(size_t *width, size_t *height)
if ( IsOwnerDrawn() )
{
*width = data->ItemMargin.GetTotalX();
*height = data->ItemMargin.GetTotalY();
if ( IsSeparator() )
{
*width = data->ItemMargin.GetTotalX();
*height = data->ItemMargin.GetTotalY();
*width += data->SeparatorSize.cx
+ data->SeparatorMargin.GetTotalX();
*height += data->SeparatorSize.cy

View File

@ -857,21 +857,18 @@ wxRendererXP::DrawCollapseButton(wxWindow *win,
{
wxUxThemeHandle hTheme(win, L"TASKDIALOG");
int state;
if (flags & wxCONTROL_PRESSED)
state = TDLGEBS_PRESSED;
else if (flags & wxCONTROL_CURRENT)
state = TDLGEBS_HOVER;
else
state = TDLGEBS_NORMAL;
if ( flags & wxCONTROL_EXPANDED )
state += 3;
if ( ::IsThemePartDefined(hTheme, TDLG_EXPANDOBUTTON, 0) )
{
if (flags & wxCONTROL_EXPANDED)
flags |= wxCONTROL_CHECKED;
int state;
if (flags & wxCONTROL_PRESSED)
state = TDLGEBS_PRESSED;
else if (flags & wxCONTROL_CURRENT)
state = TDLGEBS_HOVER;
else
state = TDLGEBS_NORMAL;
if ( flags & wxCONTROL_EXPANDED )
state += 3;
RECT r = ConvertToRECT(dc, rect);

View File

@ -298,9 +298,9 @@ void wxDataObject::AddToPasteboard( void * pb, wxIntPtr itemID )
memset( buf, 0, sz );
if ( GetDataHere( thisFormat, buf ) )
{
wxIntPtr counter = 1 ;
if ( thisFormat.GetType() == wxDF_FILENAME )
{
wxIntPtr counter = 1;
// the data is D-normalized UTF8 strings of filenames delimited with \n
char *fname = strtok((char*) buf,"\n");
while (fname != NULL)
@ -398,7 +398,6 @@ bool wxDataObject::GetFromPasteboard( void * pb )
ItemCount itemCount = 0;
wxString filenamesPassed;
bool transferred = false;
bool pastelocationset = false;
// we synchronize here once again, so we don't mind which flags get returned
PasteboardSynchronize( pasteboard );
@ -406,6 +405,7 @@ bool wxDataObject::GetFromPasteboard( void * pb )
OSStatus err = PasteboardGetItemCount( pasteboard, &itemCount );
if ( err == noErr )
{
bool pastelocationset = false;
for (size_t i = 0; !transferred && i < formatcount; i++)
{
// go through the data in our order of preference

View File

@ -857,10 +857,10 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
for ( int y = 0 ; y < the_height ; ++y , linestart += linesize, destptr += GetBitmapData()->GetBytesPerRow() )
{
unsigned char* destination = destptr;
int index, bit, mask;
for ( int x = 0 ; x < the_width ; ++x )
{
int index, bit, mask;
index = x / 8 ;
bit = x % 8 ;
mask = 1 << bit ;
@ -1311,11 +1311,11 @@ wxImage wxBitmap::ConvertToImage() const
{
unsigned char * maskp = mask ;
const wxUint32 * source = (wxUint32*)sourcestart;
unsigned char a, r, g, b;
for (int xx = 0; xx < width; xx++)
{
const wxUint32 color = *source++;
unsigned char a, r, g, b;
#ifdef WORDS_BIGENDIAN
a = ((color&0xFF000000) >> 24) ;
r = ((color&0x00FF0000) >> 16) ;

View File

@ -133,15 +133,13 @@ bool CheckDocTypeMatchesExt( CFDictionaryRef docType, CFStringRef requiredExt )
// if a match is found, or null otherwise
CFDictionaryRef GetDocTypeForExt( CFTypeRef docTypeData, CFStringRef requiredExt )
{
CFDictionaryRef docType;
CFArrayRef docTypes;
CFTypeRef item;
if( !docTypeData )
return NULL;
if( CFGetTypeID( docTypeData ) == CFArrayGetTypeID() )
{
CFTypeRef item;
CFArrayRef docTypes;
docTypes = reinterpret_cast< CFArrayRef >( docTypeData );
for( CFIndex i = 0, n = CFArrayGetCount( docTypes ); i < n; i++ )
@ -150,6 +148,7 @@ CFDictionaryRef GetDocTypeForExt( CFTypeRef docTypeData, CFStringRef requiredExt
if( CFGetTypeID( item ) == CFDictionaryGetTypeID() )
{
CFDictionaryRef docType;
docType = reinterpret_cast< CFDictionaryRef >( item );
if( CheckDocTypeMatchesExt( docType, requiredExt ) )

View File

@ -113,11 +113,10 @@ void wxOSXPrintData::UpdateToPMState()
void wxOSXPrintData::TransferPrinterNameFrom( const wxPrintData &data )
{
CFArrayRef printerList;
CFIndex index, count;
CFStringRef name;
if (PMServerCreatePrinterList(kPMServerLocal, &printerList) == noErr)
{
CFIndex index, count;
PMPrinter printer = NULL;
count = CFArrayGetCount(printerList);
for (index = 0; index < count; index++)
@ -127,6 +126,7 @@ void wxOSXPrintData::TransferPrinterNameFrom( const wxPrintData &data )
break;
else
{
CFStringRef name;
name = PMPrinterGetName(printer);
CFRetain(name);
if (data.GetPrinterName() == wxCFStringRef(name).AsString())

View File

@ -99,11 +99,11 @@ int wxPalette::GetPixel(unsigned char red, unsigned char green, unsigned char bl
long bestdiff = 3 * 256 ;
long bestpos = 0 ;
long currentdiff ;
for ( int i = 0 ; i < M_PALETTEDATA->m_count ; ++i )
{
const wxColour& col = M_PALETTEDATA->m_palette[i] ;
long currentdiff;
currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue ) ;
if ( currentdiff < bestdiff )
{

View File

@ -368,7 +368,6 @@ void wxRadioBox::SetFocus()
void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
int i;
wxRadioButton *current;
// define the position
@ -470,6 +469,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
y_offset = y_start;
current = m_radioButtonCycle;
int i;
for (i = 0 ; i < (int)m_noItems; i++)
{
// not to do for the zero button!

View File

@ -397,9 +397,7 @@ wxSize wxSlider::DoGetBestSize() const
void wxSlider::DoSetSize(int x, int y, int w, int h, int sizeFlags)
{
int yborder = 0;
int minValWidth, maxValWidth, textheight;
int sliderBreadth;
int width = w;
if (GetWindowStyle() & wxSL_LABELS)
@ -444,9 +442,11 @@ void wxSlider::DoSetSize(int x, int y, int w, int h, int sizeFlags)
GetTextExtent(text, &valValWidth, &ht);
int yborder;
yborder = textheight + wxSLIDER_BORDERTEXT;
// Get slider breadth
int sliderBreadth;
if (GetWindowStyle() & wxSL_AUTOTICKS)
sliderBreadth = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
else

View File

@ -1701,10 +1701,9 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
GetPeer()->ScrollRect( &scrollrect, dx, dy );
}
wxWindowMac *child;
int x, y, w, h;
for (wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext())
{
wxWindowMac* child;
child = node->GetData();
if (child == NULL)
continue;
@ -1715,6 +1714,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
if ( !IsClientAreaChild(child) )
continue;
int x, y, w, h;
child->GetPosition( &x, &y );
child->GetSize( &w, &h );
if (rect)
@ -2003,10 +2003,10 @@ void wxWindowMac::MacPaintChildrenBorders()
// in Composited windowing
wxPoint clientOrigin = GetClientAreaOrigin() ;
wxWindowMac *child;
int x, y, w, h;
for (wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext())
{
wxWindowMac* child;
child = node->GetData();
if (child == NULL)
continue;
@ -2230,10 +2230,10 @@ void wxWindowMac::MacSuperChangedPosition()
m_cachedClippedRectValid = false ;
wxWindowMac *child;
wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node )
{
wxWindowMac* child;
child = node->GetData();
child->MacSuperChangedPosition() ;
@ -2245,10 +2245,10 @@ void wxWindowMac::MacTopLevelWindowChangedPosition()
{
// only screen-absolute structures have to be moved i.e. glcanvas
wxWindowMac *child;
wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node )
{
wxWindowMac* child;
child = node->GetData();
child->MacTopLevelWindowChangedPosition() ;

View File

@ -303,13 +303,12 @@ bool wxPGSpinCtrlEditor::OnEvent( wxPropertyGrid* propgrid, wxPGProperty* proper
wxWindow* wnd, wxEvent& event ) const
{
wxEventType evtType = event.GetEventType();
int keycode = -1;
int spins = 1;
bool bigStep = false;
if ( evtType == wxEVT_KEY_DOWN )
{
wxKeyEvent& keyEvent = (wxKeyEvent&)event;
int keycode;
keycode = keyEvent.GetKeyCode();
if ( keycode == WXK_UP )
@ -330,6 +329,7 @@ bool wxPGSpinCtrlEditor::OnEvent( wxPropertyGrid* propgrid, wxPGProperty* proper
if ( evtType == wxEVT_SCROLL_LINEUP || evtType == wxEVT_SCROLL_LINEDOWN )
{
int spins = 1;
#if IS_MOTION_SPIN_SUPPORTED
if ( property->GetAttributeAsLong(wxPG_ATTR_SPINCTRL_MOTION, 0) )
{

View File

@ -107,9 +107,9 @@ void wxFrame::SetStatusBar( wxStatusBar *statusBar )
void wxFrame::SetToolBar(wxToolBar *toolbar)
{
int area = 0;
if ( toolbar != NULL )
{
int area = 0;
if (toolbar->HasFlag(wxTB_LEFT)) { area = Qt::LeftToolBarArea; }
else if (toolbar->HasFlag(wxTB_RIGHT)) { area = Qt::RightToolBarArea; }
else if (toolbar->HasFlag(wxTB_BOTTOM)){ area = Qt::BottomToolBarArea;}

View File

@ -88,10 +88,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
{
DoCreate(parent, style);
QListWidgetItem* item;
while ( n-- > 0 )
{
QListWidgetItem* item;
item = new QListWidgetItem();
item->setText(wxQtConvertString( *choices++ ));
if ( m_hasCheckBoxes )

View File

@ -878,12 +878,12 @@ bool wxListCtrl::EnsureVisible(long item)
long wxListCtrl::FindItem(long start, const wxString& str, bool partial)
{
int ret;
QList <QTreeWidgetItem *> qitems = m_qtTreeWidget->findItems(
wxQtConvertString(str),
!partial ? Qt::MatchExactly : Qt::MatchContains );
for (int i=0; i<qitems.length(); i++)
{
int ret;
ret = m_qtTreeWidget->indexOfTopLevelItem(qitems.at(i));
if ( ret >= start )
return ret;

View File

@ -1258,7 +1258,7 @@ wxSize wxRibbonBar::DoGetBestSize() const
void wxRibbonBar::HitTestRibbonButton(const wxRect& rect, const wxPoint& position, bool &hover_flag)
{
bool hovered = false, toggle_button_hovered = false;
bool hovered = false;
if(position.x >= 0 && position.y >= 0)
{
wxSize size = GetSize();
@ -1269,6 +1269,7 @@ void wxRibbonBar::HitTestRibbonButton(const wxRect& rect, const wxPoint& positio
}
if(hovered)
{
bool toggle_button_hovered;
toggle_button_hovered = rect.Contains(position);
if ( hovered != m_bar_hovered || toggle_button_hovered != hover_flag )

View File

@ -1008,7 +1008,6 @@ bool wxRibbonPage::CollapsePanels(wxOrientation direction, int minimum_amount)
{
while(minimum_amount > 0)
{
int largest_size = 0;
wxRibbonPanel* largest_panel = NULL;
wxSize* largest_panel_size = NULL;
wxSize* panel_size = m_size_calc_array;
@ -1032,6 +1031,7 @@ bool wxRibbonPage::CollapsePanels(wxOrientation direction, int minimum_amount)
}
else
{
int largest_size = 0;
for(wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext(), ++panel_size )

View File

@ -7026,8 +7026,6 @@ bool wxRichTextPlainText::DrawTabbedString(wxDC& dc, const wxRichTextAttr& attr,
else
tabCount = 0;
int nextTabPos = -1;
int tabPos = -1;
wxCoord w, h;
if (selected)
@ -7061,10 +7059,12 @@ bool wxRichTextPlainText::DrawTabbedString(wxDC& dc, const wxRichTextAttr& attr,
wxString stringChunk = str.BeforeFirst(wxT('\t'));
str = str.AfterFirst(wxT('\t'));
dc.GetTextExtent(stringChunk, & w, & h);
int tabPos;
tabPos = x + w;
bool not_found = true;
for (int i = 0; i < tabCount && not_found; ++i)
{
int nextTabPos;
nextTabPos = tabArray.Item(i) + x_orig;
// Find the next tab position.
@ -7253,8 +7253,6 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz
tabArray[i] = pos;
}
int nextTabPos = -1;
while (stringChunk.Find(wxT('\t')) >= 0)
{
int absoluteWidth = 0;
@ -7295,6 +7293,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz
bool notFound = true;
for (int i = 0; i < tabCount && notFound; ++i)
{
int nextTabPos;
nextTabPos = tabArray.Item(i);
// Find the next tab position.

View File

@ -1842,11 +1842,10 @@ void wxThreadModule::OnExit()
{
wxASSERT_MSG( wxThread::IsMain(), wxT("only main thread can be here") );
// are there any threads left which are being deleted right now?
size_t nThreadsBeingDeleted;
{
wxMutexLocker lock( *gs_mutexDeleteThread );
// are there any threads left which are being deleted right now?
size_t nThreadsBeingDeleted;
nThreadsBeingDeleted = gs_nThreadsBeingDeleted;
if ( nThreadsBeingDeleted > 0 )