pcsx2|utilities: Remove ambiguous wxString-related overloads

Avoid some function overloads that can accept char*, wxChar* and
wxString as a parameter. wxString can be constructed with either of
those parameters, so the function overloads may actually result in
ambiguity errors. Keep the wxString parameter versions and remove the
rest.

Fixes some compile errors on FreeBSD.
This commit is contained in:
Jonathan Li 2019-09-01 20:49:09 +01:00
parent aee571e9b2
commit c87b8c7f49
5 changed files with 6 additions and 39 deletions

View File

@ -185,11 +185,7 @@ extern pxDoAssertFnType *pxDoAssert;
#define IndexBoundsAssumeDev(objname, idx, sze) pxAssumeDev((uint)(idx) < (uint)(sze), \ #define IndexBoundsAssumeDev(objname, idx, sze) pxAssumeDev((uint)(idx) < (uint)(sze), \
pxsFmt(L"Array index out of bounds accessing object '%s' (index=%d, size=%d)", objname, (idx), (sze))) pxsFmt(L"Array index out of bounds accessing object '%s' (index=%d, size=%d)", objname, (idx), (sze)))
extern void pxOnAssert(const DiagnosticOrigin &origin, const wxChar *msg = NULL);
extern void pxOnAssert(const DiagnosticOrigin &origin, const char *msg);
extern void pxOnAssert(const DiagnosticOrigin &origin, const wxString &msg); extern void pxOnAssert(const DiagnosticOrigin &origin, const wxString &msg);
extern void pxOnAssert(const DiagnosticOrigin &origin, const FastFormatUnicode &msg);
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// jNO_DEFAULT -- disables the default case in a switch, which improves switch optimization // jNO_DEFAULT -- disables the default case in a switch, which improves switch optimization

View File

@ -680,8 +680,7 @@ protected:
wxPoint m_curpos; wxPoint m_curpos;
int m_leading; int m_leading;
virtual void _DoWriteLn(const wxChar *msg); virtual void _DoWriteLn(const wxString &msg);
void _DoWriteLn(const wxString msg);
void _DoWrite(const wxChar *msg); void _DoWrite(const wxChar *msg);
public: public:

View File

@ -95,7 +95,7 @@ bool pxAssertImpl_LogIt(const DiagnosticOrigin &origin, const wxChar *msg)
} }
DEVASSERT_INLINE void pxOnAssert(const DiagnosticOrigin &origin, const wxChar *msg) DEVASSERT_INLINE void pxOnAssert(const DiagnosticOrigin &origin, const wxString &msg)
{ {
// Recursion guard: Allow at least one recursive call. This is useful because sometimes // Recursion guard: Allow at least one recursive call. This is useful because sometimes
// we get meaningless assertions while unwinding stack traces after exceptions have occurred. // we get meaningless assertions while unwinding stack traces after exceptions have occurred.
@ -114,9 +114,9 @@ DEVASSERT_INLINE void pxOnAssert(const DiagnosticOrigin &origin, const wxChar *m
if (pxDoAssert == NULL) { if (pxDoAssert == NULL) {
// Note: Format uses MSVC's syntax for output window hotlinking. // Note: Format uses MSVC's syntax for output window hotlinking.
trapit = pxAssertImpl_LogIt(origin, msg); trapit = pxAssertImpl_LogIt(origin, msg.wc_str());
} else { } else {
trapit = pxDoAssert(origin, msg); trapit = pxDoAssert(origin, msg.wc_str());
} }
if (trapit) { if (trapit) {
@ -124,21 +124,6 @@ DEVASSERT_INLINE void pxOnAssert(const DiagnosticOrigin &origin, const wxChar *m
} }
} }
__fi void pxOnAssert(const DiagnosticOrigin &origin, const char *msg)
{
pxOnAssert(origin, fromUTF8(msg));
}
__fi void pxOnAssert(const DiagnosticOrigin &origin, const wxString &msg)
{
pxOnAssert(origin, msg.wc_str());
}
__fi void pxOnAssert(const DiagnosticOrigin &origin, const FastFormatUnicode &msg)
{
pxOnAssert(origin, msg.c_str());
}
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// BaseException (implementations) // BaseException (implementations)
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------

View File

@ -84,10 +84,8 @@ pxWindowTextWriter &pxWindowTextWriter::MoveY(int ydelta)
return *this; return *this;
} }
void pxWindowTextWriter::_DoWriteLn(const wxChar *msg) void pxWindowTextWriter::_DoWriteLn(const wxString &msg)
{ {
pxAssert(msg);
int tWidth, tHeight; int tWidth, tHeight;
m_dc.GetMultiLineTextExtent(msg, &tWidth, &tHeight); m_dc.GetMultiLineTextExtent(msg, &tWidth, &tHeight);
@ -103,11 +101,6 @@ void pxWindowTextWriter::_DoWriteLn(const wxChar *msg)
m_curpos.y += tHeight + m_leading; m_curpos.y += tHeight + m_leading;
} }
void pxWindowTextWriter::_DoWriteLn(const wxString msg)
{
_DoWriteLn(msg.wc_str());
}
// Splits incoming multi-line strings into pieces, and dispatches each line individually // Splits incoming multi-line strings into pieces, and dispatches each line individually
// to the text writer. // to the text writer.
void pxWindowTextWriter::_DoWrite(const wxChar *msg) void pxWindowTextWriter::_DoWrite(const wxChar *msg)

View File

@ -227,7 +227,7 @@ public:
ConsoleLogFromVM( const TraceLogDescriptor* desc ) : _parent( desc ) {} ConsoleLogFromVM( const TraceLogDescriptor* desc ) : _parent( desc ) {}
bool Write( const wxChar* msg ) const bool Write( const wxString &msg ) const
{ {
ConsoleColorScope cs(conColor); ConsoleColorScope cs(conColor);
Console.WriteRaw( msg ); Console.WriteRaw( msg );
@ -239,12 +239,6 @@ public:
return false; return false;
} }
bool Write( const wxString msg ) const
{
return Write(msg.wc_str());
}
}; };
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------