use WXSIZEOF(x) instead of sizeof(x)/sizeof(x[0]) (closes #10701)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
609aa390f4
commit
9611b7975f
@ -934,7 +934,7 @@ void wxDateTime::GetAmPmStrings(wxString *am, wxString *pm)
|
||||
// assert, even though it is a perfectly legal use.
|
||||
if ( am )
|
||||
{
|
||||
if (wxStrftime(buffer, sizeof(buffer)/sizeof(wxChar), _T("%p"), &tm) > 0)
|
||||
if (wxStrftime(buffer, WXSIZEOF(buffer), _T("%p"), &tm) > 0)
|
||||
*am = wxString(buffer);
|
||||
else
|
||||
*am = wxString();
|
||||
@ -942,7 +942,7 @@ void wxDateTime::GetAmPmStrings(wxString *am, wxString *pm)
|
||||
if ( pm )
|
||||
{
|
||||
tm.tm_hour = 13;
|
||||
if (wxStrftime(buffer, sizeof(buffer)/sizeof(wxChar), _T("%p"), &tm) > 0)
|
||||
if (wxStrftime(buffer, WXSIZEOF(buffer), _T("%p"), &tm) > 0)
|
||||
*pm = wxString(buffer);
|
||||
else
|
||||
*pm = wxString();
|
||||
|
@ -831,13 +831,13 @@ void wxDebugContext::OutputDumpLine(const wxChar *szFormat, ...)
|
||||
int count;
|
||||
va_list argptr;
|
||||
va_start(argptr, szFormat);
|
||||
buf[sizeof(buf)/sizeof(wxChar)-1] = _T('\0');
|
||||
buf[WXSIZEOF(buf)-1] = _T('\0');
|
||||
|
||||
// keep 3 bytes for a \r\n\0
|
||||
count = wxVsnprintf(buf, sizeof(buf)/sizeof(wxChar)-3, szFormat, argptr);
|
||||
count = wxVsnprintf(buf, WXSIZEOF(buf)-3, szFormat, argptr);
|
||||
|
||||
if ( count < 0 )
|
||||
count = sizeof(buf)/sizeof(wxChar)-3;
|
||||
count = WXSIZEOF(buf)-3;
|
||||
buf[count]=_T('\r');
|
||||
buf[count+1]=_T('\n');
|
||||
buf[count+2]=_T('\0');
|
||||
|
@ -442,7 +442,7 @@ void wxFontRefData::MacFindFont()
|
||||
kATSUQDCondensedTag ,
|
||||
kATSUQDExtendedTag ,
|
||||
};
|
||||
ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
|
||||
ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
|
||||
{
|
||||
sizeof( ATSUFontID ) ,
|
||||
sizeof( Fixed ) ,
|
||||
@ -460,7 +460,7 @@ void wxFontRefData::MacFindFont()
|
||||
Fixed atsuSize = IntToFixed( m_info.m_pointSize );
|
||||
ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
|
||||
FMFontStyle addQDStyle = m_info.m_atsuAdditionalQDStyles;
|
||||
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
|
||||
ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
|
||||
{
|
||||
&m_info.m_atsuFontID ,
|
||||
&atsuSize ,
|
||||
@ -474,7 +474,7 @@ void wxFontRefData::MacFindFont()
|
||||
|
||||
status = ::ATSUSetAttributes(
|
||||
(ATSUStyle)m_macATSUStyle,
|
||||
sizeof(atsuTags) / sizeof(ATSUAttributeTag) ,
|
||||
WXSIZEOF(atsuTags),
|
||||
atsuTags, atsuSizes, atsuValues);
|
||||
|
||||
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
|
||||
|
@ -869,19 +869,19 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
|
||||
kATSUSizeTag ,
|
||||
kATSUColorTag ,
|
||||
};
|
||||
ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
|
||||
ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
|
||||
{
|
||||
sizeof( Fixed ) ,
|
||||
sizeof( RGBColor ) ,
|
||||
};
|
||||
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
|
||||
ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
|
||||
{
|
||||
&atsuSize ,
|
||||
&atsuColor ,
|
||||
};
|
||||
|
||||
status = ::ATSUSetAttributes(
|
||||
m_macATSUIStyle, sizeof(atsuTags) / sizeof(ATSUAttributeTag) ,
|
||||
m_macATSUIStyle, WXSIZEOF(atsuTags),
|
||||
atsuTags, atsuSizes, atsuValues);
|
||||
|
||||
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
|
||||
@ -2268,15 +2268,15 @@ void wxMacCoreGraphicsContext::DoDrawRotatedText(const wxString &str,
|
||||
{
|
||||
kATSULineRotationTag ,
|
||||
};
|
||||
ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
|
||||
ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
|
||||
{
|
||||
sizeof( Fixed ) ,
|
||||
};
|
||||
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
|
||||
ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
|
||||
{
|
||||
&atsuAngle ,
|
||||
};
|
||||
status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags) / sizeof(ATSUAttributeTag),
|
||||
status = ::ATSUSetLayoutControls(atsuLayout , WXSIZEOF(atsuTags),
|
||||
atsuTags, atsuSizes, atsuValues );
|
||||
}
|
||||
|
||||
@ -2285,15 +2285,15 @@ void wxMacCoreGraphicsContext::DoDrawRotatedText(const wxString &str,
|
||||
{
|
||||
kATSUCGContextTag ,
|
||||
};
|
||||
ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
|
||||
ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
|
||||
{
|
||||
sizeof( CGContextRef ) ,
|
||||
};
|
||||
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
|
||||
ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
|
||||
{
|
||||
&m_cgContext ,
|
||||
};
|
||||
status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags) / sizeof(ATSUAttributeTag),
|
||||
status = ::ATSUSetLayoutControls(atsuLayout , WXSIZEOF(atsuTags),
|
||||
atsuTags, atsuSizes, atsuValues );
|
||||
}
|
||||
|
||||
|
@ -893,7 +893,7 @@ void wxMacMLTEControl::AdjustCreationAttributes(const wxColour &background,
|
||||
} ;
|
||||
|
||||
err = TXNSetTypeAttributes(
|
||||
m_txn, sizeof(typeAttr) / sizeof(TXNTypeAttributes),
|
||||
m_txn, WXSIZEOF(typeAttr),
|
||||
typeAttr, kTXNStartOffset, kTXNEndOffset );
|
||||
verify_noerr( err );
|
||||
|
||||
|
@ -515,7 +515,7 @@ bool wxSymbolPickerDialog::TransferDataToWindow()
|
||||
{
|
||||
// Insert items into subset combo
|
||||
int i;
|
||||
for (i = 0; i < (int) (sizeof(g_UnicodeSubsetTable)/sizeof(g_UnicodeSubsetTable[0])); i++)
|
||||
for (i = 0; i < (int) WXSIZEOF(g_UnicodeSubsetTable); i++)
|
||||
{
|
||||
m_subsetCtrl->Append(g_UnicodeSubsetTable[i].m_name);
|
||||
}
|
||||
@ -617,7 +617,7 @@ void wxSymbolPickerDialog::OnSymbolSelected( wxCommandEvent& event )
|
||||
{
|
||||
// Need to make the subset selection reflect the current symbol
|
||||
int i;
|
||||
for (i = 0; i < (int) (sizeof(g_UnicodeSubsetTable)/sizeof(g_UnicodeSubsetTable[0])); i++)
|
||||
for (i = 0; i < (int) WXSIZEOF(g_UnicodeSubsetTable); i++)
|
||||
{
|
||||
if (sel >= g_UnicodeSubsetTable[i].m_low && sel <= g_UnicodeSubsetTable[i].m_high)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user