+// sanitize entry or group name: insert '\\' before any special characters
+static wxString FilterOutEntryName(const wxString& str)
+{
+ wxString strResult;
+ strResult.Alloc(str.Len());
+
+ for ( const wxChar *pc = str.c_str(); *pc != wxT('\0'); pc++ ) {
+ wxChar c = *pc;
+
+ // we explicitly allow some of "safe" chars and 8bit ASCII characters
+ // which will probably never have special meaning
+ // NB: note that wxCONFIG_IMMUTABLE_PREFIX and wxCONFIG_PATH_SEPARATOR
+ // should *not* be quoted
+ if ( !wxIsalnum(c) && !wxStrchr(wxT("@_/-!.*%"), c) && ((c & 0x80) == 0) )
+ strResult += wxT('\\');
+
+ strResult += c;
+ }
+
+ return strResult;
+}
+
+// we can't put ?: in the ctor initializer list because it confuses some
+// broken compilers (Borland C++)
+static wxString GetAppName(const wxString& appName)
+{
+ if ( !appName && wxTheApp )
+ return wxTheApp->GetAppName();
+ else
+ return appName;
+}