Skip to content
Permalink
Browse files

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.
  • Loading branch information...
turtleli committed Sep 1, 2019
1 parent aee571e commit c87b8c7f49a7ecc415b380cc72b87da39201aa03
@@ -185,11 +185,7 @@ extern pxDoAssertFnType *pxDoAssert;
#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)))


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 FastFormatUnicode &msg);

// --------------------------------------------------------------------------------------
// jNO_DEFAULT -- disables the default case in a switch, which improves switch optimization
@@ -680,8 +680,7 @@ class pxWindowTextWriter
wxPoint m_curpos;
int m_leading;

virtual void _DoWriteLn(const wxChar *msg);
void _DoWriteLn(const wxString msg);
virtual void _DoWriteLn(const wxString &msg);
void _DoWrite(const wxChar *msg);

public:
@@ -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
// we get meaningless assertions while unwinding stack traces after exceptions have occurred.
@@ -114,31 +114,16 @@ DEVASSERT_INLINE void pxOnAssert(const DiagnosticOrigin &origin, const wxChar *m

if (pxDoAssert == NULL) {
// Note: Format uses MSVC's syntax for output window hotlinking.
trapit = pxAssertImpl_LogIt(origin, msg);
trapit = pxAssertImpl_LogIt(origin, msg.wc_str());
} else {
trapit = pxDoAssert(origin, msg);
trapit = pxDoAssert(origin, msg.wc_str());
}

if (trapit) {
pxTrap();
}
}

__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)
// --------------------------------------------------------------------------------------
@@ -84,10 +84,8 @@ pxWindowTextWriter &pxWindowTextWriter::MoveY(int ydelta)
return *this;
}

void pxWindowTextWriter::_DoWriteLn(const wxChar *msg)
void pxWindowTextWriter::_DoWriteLn(const wxString &msg)
{
pxAssert(msg);

int tWidth, tHeight;
m_dc.GetMultiLineTextExtent(msg, &tWidth, &tHeight);

@@ -103,11 +101,6 @@ void pxWindowTextWriter::_DoWriteLn(const wxChar *msg)
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
// to the text writer.
void pxWindowTextWriter::_DoWrite(const wxChar *msg)
@@ -227,7 +227,7 @@ class ConsoleLogFromVM : public BaseTraceLogSource

ConsoleLogFromVM( const TraceLogDescriptor* desc ) : _parent( desc ) {}

bool Write( const wxChar* msg ) const
bool Write( const wxString &msg ) const
{
ConsoleColorScope cs(conColor);
Console.WriteRaw( msg );
@@ -239,12 +239,6 @@ class ConsoleLogFromVM : public BaseTraceLogSource

return false;
}

bool Write( const wxString msg ) const
{
return Write(msg.wc_str());
}

};

// --------------------------------------------------------------------------------------

0 comments on commit c87b8c7

Please sign in to comment.
You can’t perform that action at this time.