From: Vadim Zeitlin Date: Fri, 27 Jul 2007 23:59:11 +0000 (+0000) Subject: made strings used in wxIPC methods const as a temporary compilation fix (they will... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1e0f0a90e0c1c9d6ba64cbe6115573b07debc819 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 --- diff --git a/docs/latex/wx/ddeconn.tex b/docs/latex/wx/ddeconn.tex index 07e598dd69..53dce0c606 100644 --- a/docs/latex/wx/ddeconn.tex +++ b/docs/latex/wx/ddeconn.tex @@ -79,7 +79,7 @@ transactions. \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 the data associated with the given item. Causes the client @@ -140,7 +140,7 @@ accept the given data. \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 calls \helpref{wxDDEConnection::Request}{wxddeconnectionrequest}. The server @@ -166,7 +166,7 @@ this doesn't have much meaning in practice. \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 used to transfer arbitrary data to the server. Causes the server diff --git a/docs/latex/wx/ipcconn.tex b/docs/latex/wx/ipcconn.tex index 0463305be0..f977f8da9f 100644 --- a/docs/latex/wx/ipcconn.tex +++ b/docs/latex/wx/ipcconn.tex @@ -84,7 +84,7 @@ mainly for backwards compatibility. \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 in the data associated with the given item. Causes the client @@ -148,7 +148,7 @@ accept the given data. \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 \helpref{wxConnection::Request}{wxconnectionrequest}. The @@ -176,7 +176,7 @@ this doesn't have much meaning in practice. \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. Can be used to transfer arbitrary data to the server. Causes the diff --git a/docs/latex/wx/tcpconn.tex b/docs/latex/wx/tcpconn.tex index a530e47064..b9316b36bd 100644 --- a/docs/latex/wx/tcpconn.tex +++ b/docs/latex/wx/tcpconn.tex @@ -78,7 +78,7 @@ transactions. \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 the data associated with the given item. Causes the client @@ -139,7 +139,7 @@ accept the given data. \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 calls \helpref{wxTCPConnection::Request}{wxtcpconnectionrequest}. The server @@ -165,7 +165,7 @@ this doesn't have much meaning in practice. \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 used to transfer arbitrary data to the server. Causes the server diff --git a/include/wx/ipcbase.h b/include/wx/ipcbase.h index e82287d136..660a339121 100644 --- a/include/wx/ipcbase.h +++ b/include/wx/ipcbase.h @@ -61,12 +61,12 @@ public: virtual bool Execute(const wxString& str) { return Execute(str.c_str(), -1, wxIPC_TEXT); } 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 StopAdvise(const wxString& item) = 0; // 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 virtual bool Disconnect(void) = 0; @@ -78,11 +78,11 @@ public: wxIPCFormat WXUNUSED(format) ) { return false; } - virtual wxChar *OnRequest ( const wxString& WXUNUSED(topic), - const wxString& WXUNUSED(item), - int *WXUNUSED(size), - wxIPCFormat WXUNUSED(format) ) - { return (wxChar *) NULL; } + virtual const wxChar *OnRequest ( const wxString& WXUNUSED(topic), + const wxString& WXUNUSED(item), + int *WXUNUSED(size), + wxIPCFormat WXUNUSED(format) ) + { return (wxChar *) NULL; } virtual bool OnPoke ( const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), diff --git a/include/wx/msw/dde.h b/include/wx/msw/dde.h index 4595599738..ae94324f63 100644 --- a/include/wx/msw/dde.h +++ b/include/wx/msw/dde.h @@ -56,12 +56,12 @@ public: virtual bool Execute(const wxString& str) { return Execute(str.c_str(), -1, 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 StopAdvise(const wxString& item); // 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 virtual bool Disconnect(void); @@ -75,9 +75,9 @@ public: wxDDEClient* m_client; WXHCONV m_hConv; - wxChar* m_sendingData; + const wxChar* m_sendingData; int m_dataSize; - wxIPCFormat m_dataType; + wxIPCFormat m_dataType; DECLARE_NO_COPY_CLASS(wxDDEConnection) }; diff --git a/include/wx/sckipc.h b/include/wx/sckipc.h index a131e2b1fd..e4b4064a76 100644 --- a/include/wx/sckipc.h +++ b/include/wx/sckipc.h @@ -64,12 +64,12 @@ public: // Calls that CLIENT can make 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 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 StopAdvise(const wxString& item); // 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 virtual bool Disconnect(void); diff --git a/samples/ipc/client.cpp b/samples/ipc/client.cpp index 7bca7c5e77..25dc58e45c 100644 --- a/samples/ipc/client.cpp +++ b/samples/ipc/client.cpp @@ -417,7 +417,7 @@ MyClient::~MyClient() // ---------------------------------------------------------------------------- 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; if (topic.IsEmpty() && item.IsEmpty()) @@ -475,7 +475,7 @@ wxChar *MyConnection::Request(const wxString& item, int *size, wxIPCFormat forma 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); return wxConnection::Poke(item, data, size, format); diff --git a/samples/ipc/client.h b/samples/ipc/client.h index c9e06778ff..e08f9868c1 100644 --- a/samples/ipc/client.h +++ b/samples/ipc/client.h @@ -83,12 +83,12 @@ class MyConnection: public wxConnection public: 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 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 OnDisconnect(); protected: 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 diff --git a/samples/ipc/server.cpp b/samples/ipc/server.cpp index a4f01ac0a5..11b50b4053 100644 --- a/samples/ipc/server.cpp +++ b/samples/ipc/server.cpp @@ -285,9 +285,9 @@ void MyServer::Advise() if (CanAdvise()) { 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(); - 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 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); } -wxChar *MyConnection::OnRequest(const wxString& topic, +const wxChar *MyConnection::OnRequest(const wxString& topic, const wxString& item, int * size, wxIPCFormat format) { - wxChar *data; + const wxChar *data; if (item == _T("Date")) { m_sRequestDate = wxDateTime::Now().Format(); - data = (wxChar *)m_sRequestDate.c_str(); + data = m_sRequestDate.c_str(); *size = -1; } else if (item == _T("Date+len")) { 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); } 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'; *size = 3; } @@ -379,7 +379,7 @@ bool MyConnection::OnStopAdvise(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; 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); } -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); return wxConnection::Advise(item, data, size, format); diff --git a/samples/ipc/server.h b/samples/ipc/server.h index 5eeaa8549a..6f4e0e7ce1 100644 --- a/samples/ipc/server.h +++ b/samples/ipc/server.h @@ -70,14 +70,14 @@ public: ~MyConnection(); 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 OnStartAdvise(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(); 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: wxString m_sAdvise; protected: diff --git a/src/common/sckipc.cpp b/src/common/sckipc.cpp index 9922b0d04c..350b824257 100644 --- a/src/common/sckipc.cpp +++ b/src/common/sckipc.cpp @@ -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()) return false; @@ -499,7 +499,7 @@ bool wxTCPConnection::StopAdvise (const wxString& item) // Calls that SERVER can make bool wxTCPConnection::Advise (const wxString& item, - wxChar *data, int size, wxIPCFormat format) + const wxChar *data, int size, wxIPCFormat format) { if (!m_sock->IsConnected()) return false; @@ -648,7 +648,7 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event) format = (wxIPCFormat)codeci->Read8(); 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) { diff --git a/src/msw/dde.cpp b/src/msw/dde.cpp index c9f1b2735e..1580323420 100644 --- a/src/msw/dde.cpp +++ b/src/msw/dde.cpp @@ -606,7 +606,7 @@ wxChar *wxDDEConnection::Request(const wxString& item, int *size, wxIPCFormat fo 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; if (size < 0) @@ -670,7 +670,7 @@ bool wxDDEConnection::StopAdvise(const wxString& item) // Calls that SERVER can make bool wxDDEConnection::Advise(const wxString& item, - wxChar *data, + const wxChar *data, int size, wxIPCFormat format) { @@ -805,10 +805,10 @@ _DDECallback(WORD wType, wxString item_name = DDEStringFromAtom(hsz2); int user_size = -1; - wxChar *data = connection->OnRequest(connection->m_topicName, - item_name, - &user_size, - (wxIPCFormat) wFmt); + const wxChar *data = connection->OnRequest(connection->m_topicName, + item_name, + &user_size, + (wxIPCFormat)wFmt); if (data) { if (user_size < 0)