// headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "regex.h"
 #endif
 
 
         msg = wxString(buf.data(), wxConvLibc);
 #else // !Unicode
-        (void)regerror(errorcode, &m_RegEx, msg.GetWriteBuf(len), len);
-
-        msg.UngetWriteBuf();
+        (void)regerror(errorcode, &m_RegEx, wxStringBuffer(msg, len), len);
 #endif // Unicode/!Unicode
     }
     else // regerror() returned 0