made strings used in wxIPC methods const as a temporary compilation fix (they will need to be also made void* and not wxChar* later) (patch 1759924)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47764 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-07-27 23:59:11 +00:00
parent fc9361e3ec
commit 1e0f0a90e0
12 changed files with 47 additions and 47 deletions

View File

@@ -79,7 +79,7 @@ transactions.
\membersection{wxDDEConnection::Advise}\label{wxddeconnectionadvise} \membersection{wxDDEConnection::Advise}\label{wxddeconnectionadvise}
\func{bool}{Advise}{\param{const wxString\& }{item}, \param{char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}} \func{bool}{Advise}{\param{const wxString\& }{item}, \param{const char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}}
Called by the server application to advise the client of a change in Called by the server application to advise the client of a change in
the data associated with the given item. Causes the client the data associated with the given item. Causes the client
@@ -140,7 +140,7 @@ accept the given data.
\membersection{wxDDEConnection::OnRequest}\label{wxddeconnectiononrequest} \membersection{wxDDEConnection::OnRequest}\label{wxddeconnectiononrequest}
\func{virtual char*}{OnRequest}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}, \param{int *}{size}, \param{wxIPCFormat}{ format}} \func{virtual const char*}{OnRequest}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}, \param{int *}{size}, \param{wxIPCFormat}{ format}}
Message sent to the server application when the client Message sent to the server application when the client
calls \helpref{wxDDEConnection::Request}{wxddeconnectionrequest}. The server calls \helpref{wxDDEConnection::Request}{wxddeconnectionrequest}. The server
@@ -166,7 +166,7 @@ this doesn't have much meaning in practice.
\membersection{wxDDEConnection::Poke}\label{wxddeconnectionpoke} \membersection{wxDDEConnection::Poke}\label{wxddeconnectionpoke}
\func{bool}{Poke}{\param{const wxString\& }{item}, \param{char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}} \func{bool}{Poke}{\param{const wxString\& }{item}, \param{const char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}}
Called by the client application to poke data into the server. Can be Called by the client application to poke data into the server. Can be
used to transfer arbitrary data to the server. Causes the server used to transfer arbitrary data to the server. Causes the server

View File

@@ -84,7 +84,7 @@ mainly for backwards compatibility.
\membersection{wxConnection::Advise}\label{wxconnectionadvise} \membersection{wxConnection::Advise}\label{wxconnectionadvise}
\func{bool}{Advise}{\param{const wxString\& }{item}, \param{char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}} \func{bool}{Advise}{\param{const wxString\& }{item}, \param{const char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}}
Called by the server application to advise the client of a change Called by the server application to advise the client of a change
in the data associated with the given item. Causes the client in the data associated with the given item. Causes the client
@@ -148,7 +148,7 @@ accept the given data.
\membersection{wxConnection::OnRequest}\label{wxconnectiononrequest} \membersection{wxConnection::OnRequest}\label{wxconnectiononrequest}
\func{virtual char*}{OnRequest}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}, \param{int *}{size}, \param{wxIPCFormat}{ format}} \func{virtual const char*}{OnRequest}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}, \param{int *}{size}, \param{wxIPCFormat}{ format}}
Message sent to the server application when the client calls Message sent to the server application when the client calls
\helpref{wxConnection::Request}{wxconnectionrequest}. The \helpref{wxConnection::Request}{wxconnectionrequest}. The
@@ -176,7 +176,7 @@ this doesn't have much meaning in practice.
\membersection{wxConnection::Poke}\label{wxconnectionpoke} \membersection{wxConnection::Poke}\label{wxconnectionpoke}
\func{bool}{Poke}{\param{const wxString\& }{item}, \param{char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}} \func{bool}{Poke}{\param{const wxString\& }{item}, \param{const char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}}
Called by the client application to poke data into the server. Called by the client application to poke data into the server.
Can be used to transfer arbitrary data to the server. Causes the Can be used to transfer arbitrary data to the server. Causes the

View File

@@ -78,7 +78,7 @@ transactions.
\membersection{wxTCPConnection::Advise}\label{wxtcpconnectionadvise} \membersection{wxTCPConnection::Advise}\label{wxtcpconnectionadvise}
\func{bool}{Advise}{\param{const wxString\& }{item}, \param{char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}} \func{bool}{Advise}{\param{const wxString\& }{item}, \param{const char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}}
Called by the server application to advise the client of a change in Called by the server application to advise the client of a change in
the data associated with the given item. Causes the client the data associated with the given item. Causes the client
@@ -139,7 +139,7 @@ accept the given data.
\membersection{wxTCPConnection::OnRequest}\label{wxtcpconnectiononrequest} \membersection{wxTCPConnection::OnRequest}\label{wxtcpconnectiononrequest}
\func{virtual char*}{OnRequest}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}, \param{int *}{size}, \param{wxIPCFormat}{ format}} \func{virtual const char*}{OnRequest}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}, \param{int *}{size}, \param{wxIPCFormat}{ format}}
Message sent to the server application when the client Message sent to the server application when the client
calls \helpref{wxTCPConnection::Request}{wxtcpconnectionrequest}. The server calls \helpref{wxTCPConnection::Request}{wxtcpconnectionrequest}. The server
@@ -165,7 +165,7 @@ this doesn't have much meaning in practice.
\membersection{wxTCPConnection::Poke}\label{wxtcpconnectionpoke} \membersection{wxTCPConnection::Poke}\label{wxtcpconnectionpoke}
\func{bool}{Poke}{\param{const wxString\& }{item}, \param{char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}} \func{bool}{Poke}{\param{const wxString\& }{item}, \param{const char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}}
Called by the client application to poke data into the server. Can be Called by the client application to poke data into the server. Can be
used to transfer arbitrary data to the server. Causes the server used to transfer arbitrary data to the server. Causes the server

View File

@@ -61,12 +61,12 @@ public:
virtual bool Execute(const wxString& str) virtual bool Execute(const wxString& str)
{ return Execute(str.c_str(), -1, wxIPC_TEXT); } { return Execute(str.c_str(), -1, wxIPC_TEXT); }
virtual wxChar *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0; virtual wxChar *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0;
virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0; virtual bool Poke(const wxString& item, const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
virtual bool StartAdvise(const wxString& item) = 0; virtual bool StartAdvise(const wxString& item) = 0;
virtual bool StopAdvise(const wxString& item) = 0; virtual bool StopAdvise(const wxString& item) = 0;
// Calls that SERVER can make // Calls that SERVER can make
virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0; virtual bool Advise(const wxString& item, const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
// Calls that both can make // Calls that both can make
virtual bool Disconnect(void) = 0; virtual bool Disconnect(void) = 0;
@@ -78,11 +78,11 @@ public:
wxIPCFormat WXUNUSED(format) ) wxIPCFormat WXUNUSED(format) )
{ return false; } { return false; }
virtual wxChar *OnRequest ( const wxString& WXUNUSED(topic), virtual const wxChar *OnRequest ( const wxString& WXUNUSED(topic),
const wxString& WXUNUSED(item), const wxString& WXUNUSED(item),
int *WXUNUSED(size), int *WXUNUSED(size),
wxIPCFormat WXUNUSED(format) ) wxIPCFormat WXUNUSED(format) )
{ return (wxChar *) NULL; } { return (wxChar *) NULL; }
virtual bool OnPoke ( const wxString& WXUNUSED(topic), virtual bool OnPoke ( const wxString& WXUNUSED(topic),
const wxString& WXUNUSED(item), const wxString& WXUNUSED(item),

View File

@@ -56,12 +56,12 @@ public:
virtual bool Execute(const wxString& str) virtual bool Execute(const wxString& str)
{ return Execute(str.c_str(), -1, wxIPC_TEXT); } { return Execute(str.c_str(), -1, wxIPC_TEXT); }
virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT); virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT);
virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); virtual bool Poke(const wxString& item, const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual bool StartAdvise(const wxString& item); virtual bool StartAdvise(const wxString& item);
virtual bool StopAdvise(const wxString& item); virtual bool StopAdvise(const wxString& item);
// Calls that SERVER can make // Calls that SERVER can make
virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); virtual bool Advise(const wxString& item, const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
// Calls that both can make // Calls that both can make
virtual bool Disconnect(void); virtual bool Disconnect(void);
@@ -75,9 +75,9 @@ public:
wxDDEClient* m_client; wxDDEClient* m_client;
WXHCONV m_hConv; WXHCONV m_hConv;
wxChar* m_sendingData; const wxChar* m_sendingData;
int m_dataSize; int m_dataSize;
wxIPCFormat m_dataType; wxIPCFormat m_dataType;
DECLARE_NO_COPY_CLASS(wxDDEConnection) DECLARE_NO_COPY_CLASS(wxDDEConnection)
}; };

View File

@@ -64,12 +64,12 @@ public:
// Calls that CLIENT can make // Calls that CLIENT can make
virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT); virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT);
virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); virtual bool Poke(const wxString& item, const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual bool StartAdvise(const wxString& item); virtual bool StartAdvise(const wxString& item);
virtual bool StopAdvise(const wxString& item); virtual bool StopAdvise(const wxString& item);
// Calls that SERVER can make // Calls that SERVER can make
virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); virtual bool Advise(const wxString& item, const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
// Calls that both can make // Calls that both can make
virtual bool Disconnect(void); virtual bool Disconnect(void);

View File

@@ -417,7 +417,7 @@ MyClient::~MyClient()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void MyConnection::Log(const wxString& command, const wxString& topic, void MyConnection::Log(const wxString& command, const wxString& topic,
const wxString& item, wxChar *data, int size, wxIPCFormat format) const wxString& item, const wxChar *data, int size, wxIPCFormat format)
{ {
wxString s; wxString s;
if (topic.IsEmpty() && item.IsEmpty()) if (topic.IsEmpty() && item.IsEmpty())
@@ -475,7 +475,7 @@ wxChar *MyConnection::Request(const wxString& item, int *size, wxIPCFormat forma
return data; return data;
} }
bool MyConnection::Poke(const wxString& item, wxChar *data, int size, wxIPCFormat format) bool MyConnection::Poke(const wxString& item, const wxChar *data, int size, wxIPCFormat format)
{ {
Log(_T("Poke"), wxEmptyString, item, data, size, format); Log(_T("Poke"), wxEmptyString, item, data, size, format);
return wxConnection::Poke(item, data, size, format); return wxConnection::Poke(item, data, size, format);

View File

@@ -83,12 +83,12 @@ class MyConnection: public wxConnection
public: public:
virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT); virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT);
virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); virtual bool Poke(const wxString& item, const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual bool OnAdvise(const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format); virtual bool OnAdvise(const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format);
virtual bool OnDisconnect(); virtual bool OnDisconnect();
protected: protected:
void Log(const wxString& command, const wxString& topic, void Log(const wxString& command, const wxString& topic,
const wxString& item, wxChar *data, int size, wxIPCFormat format); const wxString& item, const wxChar *data, int size, wxIPCFormat format);
}; };
class MyClient: public wxClient class MyClient: public wxClient

View File

@@ -285,9 +285,9 @@ void MyServer::Advise()
if (CanAdvise()) if (CanAdvise())
{ {
wxString s = wxDateTime::Now().Format(); wxString s = wxDateTime::Now().Format();
m_connection->Advise(m_connection->m_sAdvise, (wxChar *)s.c_str()); m_connection->Advise(m_connection->m_sAdvise, s.c_str());
s = wxDateTime::Now().FormatTime() + _T(" ") + wxDateTime::Now().FormatDate(); s = wxDateTime::Now().FormatTime() + _T(" ") + wxDateTime::Now().FormatDate();
m_connection->Advise(m_connection->m_sAdvise, (wxChar *)s.c_str(), (s.Length() + 1) * sizeof(wxChar)); m_connection->Advise(m_connection->m_sAdvise, s.c_str(), (s.Length() + 1) * sizeof(wxChar));
#if wxUSE_DDE_FOR_IPC #if wxUSE_DDE_FOR_IPC
wxLogMessage(_T("DDE Advise type argument cannot be wxIPC_PRIVATE. The client will receive it as wxIPC_TEXT, and receive the correct no of bytes, but not print a correct log entry.")); wxLogMessage(_T("DDE Advise type argument cannot be wxIPC_PRIVATE. The client will receive it as wxIPC_TEXT, and receive the correct no of bytes, but not print a correct log entry."));
@@ -327,25 +327,25 @@ bool MyConnection::OnPoke(const wxString& topic,
return wxConnection::OnPoke(topic, item, data, size, format); return wxConnection::OnPoke(topic, item, data, size, format);
} }
wxChar *MyConnection::OnRequest(const wxString& topic, const wxChar *MyConnection::OnRequest(const wxString& topic,
const wxString& item, int * size, wxIPCFormat format) const wxString& item, int * size, wxIPCFormat format)
{ {
wxChar *data; const wxChar *data;
if (item == _T("Date")) if (item == _T("Date"))
{ {
m_sRequestDate = wxDateTime::Now().Format(); m_sRequestDate = wxDateTime::Now().Format();
data = (wxChar *)m_sRequestDate.c_str(); data = m_sRequestDate.c_str();
*size = -1; *size = -1;
} }
else if (item == _T("Date+len")) else if (item == _T("Date+len"))
{ {
m_sRequestDate = wxDateTime::Now().FormatTime() + _T(" ") + wxDateTime::Now().FormatDate(); m_sRequestDate = wxDateTime::Now().FormatTime() + _T(" ") + wxDateTime::Now().FormatDate();
data = (wxChar *)m_sRequestDate.c_str(); data = m_sRequestDate.c_str();
*size = (m_sRequestDate.Length() + 1) * sizeof(wxChar); *size = (m_sRequestDate.Length() + 1) * sizeof(wxChar);
} }
else if (item == _T("bytes[3]")) else if (item == _T("bytes[3]"))
{ {
data = (wxChar *)m_achRequestBytes; data = m_achRequestBytes;
m_achRequestBytes[0] = '1'; m_achRequestBytes[1] = '2'; m_achRequestBytes[2] = '3'; m_achRequestBytes[0] = '1'; m_achRequestBytes[1] = '2'; m_achRequestBytes[2] = '3';
*size = 3; *size = 3;
} }
@@ -379,7 +379,7 @@ bool MyConnection::OnStopAdvise(const wxString& topic,
} }
void MyConnection::Log(const wxString& command, const wxString& topic, void MyConnection::Log(const wxString& command, const wxString& topic,
const wxString& item, wxChar *data, int size, wxIPCFormat format) const wxString& item, const wxChar *data, int size, wxIPCFormat format)
{ {
wxString s; wxString s;
if (topic.IsEmpty() && item.IsEmpty()) if (topic.IsEmpty() && item.IsEmpty())
@@ -407,7 +407,7 @@ void MyConnection::Log(const wxString& command, const wxString& topic,
wxLogMessage(_T("%s[invalid data],%d)"), s.c_str(), size); wxLogMessage(_T("%s[invalid data],%d)"), s.c_str(), size);
} }
bool MyConnection::Advise(const wxString& item, wxChar *data, int size, wxIPCFormat format) bool MyConnection::Advise(const wxString& item, const wxChar *data, int size, wxIPCFormat format)
{ {
Log(_T("Advise"), _T(""), item, data, size, format); Log(_T("Advise"), _T(""), item, data, size, format);
return wxConnection::Advise(item, data, size, format); return wxConnection::Advise(item, data, size, format);

View File

@@ -70,14 +70,14 @@ public:
~MyConnection(); ~MyConnection();
virtual bool OnExecute(const wxString& topic, wxChar *data, int size, wxIPCFormat format); virtual bool OnExecute(const wxString& topic, wxChar *data, int size, wxIPCFormat format);
virtual wxChar *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format); virtual const wxChar *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format);
virtual bool OnPoke(const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format); virtual bool OnPoke(const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format);
virtual bool OnStartAdvise(const wxString& topic, const wxString& item); virtual bool OnStartAdvise(const wxString& topic, const wxString& item);
virtual bool OnStopAdvise(const wxString& topic, const wxString& item); virtual bool OnStopAdvise(const wxString& topic, const wxString& item);
virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); virtual bool Advise(const wxString& item, const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual bool OnDisconnect(); virtual bool OnDisconnect();
protected: protected:
void Log(const wxString& command, const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format); void Log(const wxString& command, const wxString& topic, const wxString& item, const wxChar *data, int size, wxIPCFormat format);
public: public:
wxString m_sAdvise; wxString m_sAdvise;
protected: protected:

View File

@@ -443,7 +443,7 @@ wxChar *wxTCPConnection::Request (const wxString& item, int *size, wxIPCFormat f
} }
} }
bool wxTCPConnection::Poke (const wxString& item, wxChar *data, int size, wxIPCFormat format) bool wxTCPConnection::Poke (const wxString& item, const wxChar *data, int size, wxIPCFormat format)
{ {
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return false; return false;
@@ -499,7 +499,7 @@ bool wxTCPConnection::StopAdvise (const wxString& item)
// Calls that SERVER can make // Calls that SERVER can make
bool wxTCPConnection::Advise (const wxString& item, bool wxTCPConnection::Advise (const wxString& item,
wxChar *data, int size, wxIPCFormat format) const wxChar *data, int size, wxIPCFormat format)
{ {
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return false; return false;
@@ -648,7 +648,7 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event)
format = (wxIPCFormat)codeci->Read8(); format = (wxIPCFormat)codeci->Read8();
int user_size = -1; int user_size = -1;
wxChar *user_data = connection->OnRequest (topic_name, item, &user_size, format); const wxChar *user_data = connection->OnRequest (topic_name, item, &user_size, format);
if (user_data) if (user_data)
{ {

View File

@@ -606,7 +606,7 @@ wxChar *wxDDEConnection::Request(const wxString& item, int *size, wxIPCFormat fo
return data; return data;
} }
bool wxDDEConnection::Poke(const wxString& item, wxChar *data, int size, wxIPCFormat format) bool wxDDEConnection::Poke(const wxString& item, const wxChar *data, int size, wxIPCFormat format)
{ {
DWORD result; DWORD result;
if (size < 0) if (size < 0)
@@ -670,7 +670,7 @@ bool wxDDEConnection::StopAdvise(const wxString& item)
// Calls that SERVER can make // Calls that SERVER can make
bool wxDDEConnection::Advise(const wxString& item, bool wxDDEConnection::Advise(const wxString& item,
wxChar *data, const wxChar *data,
int size, int size,
wxIPCFormat format) wxIPCFormat format)
{ {
@@ -805,10 +805,10 @@ _DDECallback(WORD wType,
wxString item_name = DDEStringFromAtom(hsz2); wxString item_name = DDEStringFromAtom(hsz2);
int user_size = -1; int user_size = -1;
wxChar *data = connection->OnRequest(connection->m_topicName, const wxChar *data = connection->OnRequest(connection->m_topicName,
item_name, item_name,
&user_size, &user_size,
(wxIPCFormat) wFmt); (wxIPCFormat)wFmt);
if (data) if (data)
{ {
if (user_size < 0) if (user_size < 0)