]> git.saurik.com Git - wxWidgets.git/commitdiff
use WXSIZEOF(x) instead of sizeof(x)/sizeof(x[0]) (closes #10701)
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 2 Jul 2009 22:43:31 +0000 (22:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 2 Jul 2009 22:43:31 +0000 (22:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/datetime.cpp
src/common/memory.cpp
src/osx/carbon/font.cpp
src/osx/carbon/graphics.cpp
src/osx/carbon/textctrl.cpp
src/richtext/richtextsymboldlg.cpp

index 928d2effc3a2ee24816b3958e0a39b4e4129b388..e13ac2e8083756c9e0e719dabd4884fcec2d3742 100644 (file)
@@ -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();
index c55af4d9bc6a41cca95c9aecc661fd6ea350a2db..71658b74dbde4d43a3cf13c8591223a134c6b09c 100644 (file)
@@ -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');
index c68ff2bd84776642852ea5cb85fae8d84f43ce8d..3295417d81a730f2b7c4cd5891886f72ba44f5a1 100644 (file)
@@ -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") );
index 4a1e139f31780e58e6a6be569e561b6f06b4d37c..b446fc502cf188fc934e63e611eaf0be1a781984 100644 (file)
@@ -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 );
         }
 
index 57c315012a780c41ab7d583df772f49b2091d044..e0089b8859f8695dca747a3c768a96216585c595 100644 (file)
@@ -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 );
 
index 5c83e5f66eecc6c9ef84e61a0502370d1124bfa4..d455090b8d8711bad27fa96d3c75c9161a96c2e4 100644 (file)
@@ -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)
             {