From: Ove Kaaven Date: Mon, 14 Jun 1999 14:31:47 +0000 (+0000) Subject: Some more Unicode changes. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5f8e1c164d9705b52d0d60531d489c31430dc784 Some more Unicode changes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2783 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index 9beda80895..1699f9dce6 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -160,7 +160,7 @@ STDMETHODIMP wxIEnumFORMATETC::Next(ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched) { - wxLogTrace("wxIEnumFORMATETC::Next"); + wxLogTrace(_T("wxIEnumFORMATETC::Next")); if ( celt > 1 ) return S_FALSE; @@ -177,7 +177,7 @@ STDMETHODIMP wxIEnumFORMATETC::Next(ULONG celt, STDMETHODIMP wxIEnumFORMATETC::Skip(ULONG celt) { - wxLogTrace("wxIEnumFORMATETC::Skip"); + wxLogTrace(_T("wxIEnumFORMATETC::Skip")); if ( m_nCurrent == 0 ) m_nCurrent++; @@ -187,7 +187,7 @@ STDMETHODIMP wxIEnumFORMATETC::Skip(ULONG celt) STDMETHODIMP wxIEnumFORMATETC::Reset() { - wxLogTrace("wxIEnumFORMATETC::Reset"); + wxLogTrace(_T("wxIEnumFORMATETC::Reset")); m_nCurrent = 0; @@ -196,7 +196,7 @@ STDMETHODIMP wxIEnumFORMATETC::Reset() STDMETHODIMP wxIEnumFORMATETC::Clone(IEnumFORMATETC **ppenum) { - wxLogTrace("wxIEnumFORMATETC::Clone"); + wxLogTrace(_T("wxIEnumFORMATETC::Clone")); wxIEnumFORMATETC *pNew = new wxIEnumFORMATETC(m_format.cfFormat); pNew->AddRef(); @@ -225,7 +225,7 @@ wxIDataObject::wxIDataObject(wxDataObject *pDataObject) // get data functions STDMETHODIMP wxIDataObject::GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) { - wxLogTrace("wxIDataObject::GetData"); + wxLogTrace(_T("wxIDataObject::GetData")); // is data is in our format? HRESULT hr = QueryGetData(pformatetcIn); @@ -257,7 +257,7 @@ STDMETHODIMP wxIDataObject::GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) STDMETHODIMP wxIDataObject::GetDataHere(FORMATETC *pformatetc, STGMEDIUM *pmedium) { - wxLogTrace("wxIDataObject::GetDataHere"); + wxLogTrace(_T("wxIDataObject::GetDataHere")); // put data in caller provided medium if ( pmedium->tymed != TYMED_HGLOBAL ) @@ -266,7 +266,7 @@ STDMETHODIMP wxIDataObject::GetDataHere(FORMATETC *pformatetc, // copy data void *pBuf = GlobalLock(pmedium->hGlobal); if ( pBuf == NULL ) { - wxLogLastError("GlobalLock"); + wxLogLastError(_T("GlobalLock")); return E_OUTOFMEMORY; } @@ -282,7 +282,7 @@ STDMETHODIMP wxIDataObject::SetData(FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease) { - wxLogTrace("wxIDataObject::SetData"); + wxLogTrace(_T("wxIDataObject::SetData")); return E_NOTIMPL; } @@ -291,39 +291,39 @@ STDMETHODIMP wxIDataObject::QueryGetData(FORMATETC *pformatetc) { // do we accept data in this format? if ( pformatetc == NULL ) { - wxLogTrace("wxIDataObject::QueryGetData: invalid ptr."); + wxLogTrace(_T("wxIDataObject::QueryGetData: invalid ptr.")); return E_INVALIDARG; } // the only one allowed by current COM implementation if ( pformatetc->lindex != -1 ) { - wxLogTrace("wxIDataObject::QueryGetData: bad lindex %d", + wxLogTrace(_T("wxIDataObject::QueryGetData: bad lindex %d"), pformatetc->lindex); return DV_E_LINDEX; } // we don't support anything other (THUMBNAIL, ICON, DOCPRINT...) if ( pformatetc->dwAspect != DVASPECT_CONTENT ) { - wxLogTrace("wxIDataObject::QueryGetData: bad dwAspect %d", + wxLogTrace(_T("wxIDataObject::QueryGetData: bad dwAspect %d"), pformatetc->dwAspect); return DV_E_DVASPECT; } // @@ we only transfer data by global memory (bad for large amounts of it!) if ( !(pformatetc->tymed & TYMED_HGLOBAL) ) { - wxLogTrace("wxIDataObject::QueryGetData: %s != TYMED_HGLOBAL.", + wxLogTrace(_T("wxIDataObject::QueryGetData: %s != TYMED_HGLOBAL."), GetTymedName(pformatetc->tymed)); return DV_E_TYMED; } // and now check the type of data requested if ( m_pDataObject->IsSupportedFormat((wxDataFormatId)pformatetc->cfFormat) ) { - wxLogTrace("wxIDataObject::QueryGetData: %s ok", + wxLogTrace(_T("wxIDataObject::QueryGetData: %s ok"), wxDataObject::GetFormatName((wxDataFormatId)pformatetc->cfFormat)); return S_OK; } else { - wxLogTrace("wxIDataObject::QueryGetData: %s unsupported", + wxLogTrace(_T("wxIDataObject::QueryGetData: %s unsupported"), wxDataObject::GetFormatName((wxDataFormatId)pformatetc->cfFormat)); return DV_E_FORMATETC; } @@ -332,7 +332,7 @@ STDMETHODIMP wxIDataObject::QueryGetData(FORMATETC *pformatetc) STDMETHODIMP wxIDataObject::GetCanonicalFormatEtc(FORMATETC *pFormatetcIn, FORMATETC *pFormatetcOut) { - wxLogTrace("wxIDataObject::GetCanonicalFormatEtc"); + wxLogTrace(_T("wxIDataObject::GetCanonicalFormatEtc")); // @@ implementation is trivial, we might want something better here if ( pFormatetcOut != NULL ) @@ -343,7 +343,7 @@ STDMETHODIMP wxIDataObject::GetCanonicalFormatEtc(FORMATETC *pFormatetcIn, STDMETHODIMP wxIDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc) { - wxLogTrace("wxIDataObject::EnumFormatEtc"); + wxLogTrace(_T("wxIDataObject::EnumFormatEtc")); if ( dwDirection == DATADIR_SET ) { // we don't allow setting of data anyhow diff --git a/src/msw/ole/dropsrc.cpp b/src/msw/ole/dropsrc.cpp index a36ac856da..4a38d8125f 100644 --- a/src/msw/ole/dropsrc.cpp +++ b/src/msw/ole/dropsrc.cpp @@ -183,7 +183,7 @@ wxDropSource::~wxDropSource() // Notes : you must call SetData() before if you had used def ctor wxDragResult wxDropSource::DoDragDrop(bool bAllowMove) { - wxCHECK_MSG( m_pData != NULL, wxDragNone, "No data in wxDropSource!" ); + wxCHECK_MSG( m_pData != NULL, wxDragNone, _T("No data in wxDropSource!") ); DWORD dwEffect; HRESULT hr = ::DoDragDrop(m_pData->GetInterface(), @@ -215,10 +215,10 @@ wxDragResult wxDropSource::DoDragDrop(bool bAllowMove) else { if ( FAILED(hr) ) { wxLogApiError("DoDragDrop", hr); - wxLogError("Drag & drop operation failed."); + wxLogError(_T("Drag & drop operation failed.")); } else { - wxLogDebug("Unexpected success return code %08lx from DoDragDrop.", hr); + wxLogDebug(_T("Unexpected success return code %08lx from DoDragDrop."), hr); } return wxDragError; diff --git a/src/msw/ole/droptgt.cpp b/src/msw/ole/droptgt.cpp index 0bb7f00ad4..eaf3737995 100644 --- a/src/msw/ole/droptgt.cpp +++ b/src/msw/ole/droptgt.cpp @@ -136,7 +136,7 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource, POINTL pt, DWORD *pdwEffect) { - wxLogDebug("IDropTarget::DragEnter"); + wxLogDebug(_T("IDropTarget::DragEnter")); wxASSERT( m_pIDataObject == NULL ); @@ -187,7 +187,7 @@ STDMETHODIMP wxIDropTarget::DragOver(DWORD grfKeyState, // Notes : good place to do any clean-up STDMETHODIMP wxIDropTarget::DragLeave() { - wxLogDebug("IDropTarget::DragLeave"); + wxLogDebug(_T("IDropTarget::DragLeave")); // remove the UI feedback m_pTarget->OnLeave(); @@ -212,7 +212,7 @@ STDMETHODIMP wxIDropTarget::Drop(IDataObject *pIDataSource, POINTL pt, DWORD *pdwEffect) { - wxLogDebug("IDropTarget::Drop"); + wxLogDebug(_T("IDropTarget::Drop")); // TODO I don't know why there is this parameter, but so far I assume // that it's the same we've already got in DragEnter @@ -344,7 +344,7 @@ bool wxDropTarget::IsAcceptedData(IDataObject *pIDataSource) const bool wxTextDropTarget::OnDrop(long x, long y, const void *pData) { - return OnDropText(x, y, (const char *)pData); + return OnDropText(x, y, (const wxChar *)pData); } size_t wxTextDropTarget::GetFormatCount() const @@ -375,22 +375,22 @@ bool wxFileDropTarget::OnDrop(long x, long y, const void *pData) UINT nFiles = ::DragQueryFile(hdrop, (unsigned)-1, NULL, 0u); // for each file get the length, allocate memory and then get the name - char **aszFiles = new char *[nFiles]; + wxChar **aszFiles = new wxChar *[nFiles]; UINT len, n; for ( n = 0; n < nFiles; n++ ) { // +1 for terminating NUL len = ::DragQueryFile(hdrop, n, NULL, 0) + 1; - aszFiles[n] = new char[len]; + aszFiles[n] = new wxChar[len]; UINT len2 = ::DragQueryFile(hdrop, n, aszFiles[n], len); if ( len2 != len - 1 ) { - wxLogDebug("In wxFileDropTarget::OnDrop DragQueryFile returned %d " - "characters, %d expected.", len2, len - 1); + wxLogDebug(_T("In wxFileDropTarget::OnDrop DragQueryFile returned %d " + "characters, %d expected."), len2, len - 1); } } - bool bResult = OnDropFiles(x, y, nFiles, (const char**) aszFiles); + bool bResult = OnDropFiles(x, y, nFiles, (const wxChar**) aszFiles); // free memory for ( n = 0; n < nFiles; n++ ) { diff --git a/src/msw/ole/uuid.cpp b/src/msw/ole/uuid.cpp index 4df4faa7ba..ac55158ea5 100644 --- a/src/msw/ole/uuid.cpp +++ b/src/msw/ole/uuid.cpp @@ -50,12 +50,16 @@ Uuid::Uuid(const Uuid& uuid) // force the string to be allocated by RPC // (we free it later with RpcStringFree) +#ifdef _UNICODE + UuidToString(&m_uuid, (unsigned short **)&m_pszUuid); +#else UuidToString(&m_uuid, &m_pszUuid); +#endif // allocate new buffer - m_pszCForm = new char[UUID_CSTRLEN]; + m_pszCForm = new wxChar[UUID_CSTRLEN]; // and fill it - memcpy(m_pszCForm, uuid.m_pszCForm, UUID_CSTRLEN); + memcpy(m_pszCForm, uuid.m_pszCForm, UUID_CSTRLEN*sizeof(wxChar)); } // assignment operator @@ -65,14 +69,18 @@ Uuid& Uuid::operator=(const Uuid& uuid) // force the string to be allocated by RPC // (we free it later with RpcStringFree) +#ifdef _UNICODE + UuidToString(&m_uuid, (unsigned short **)&m_pszUuid); +#else UuidToString(&m_uuid, &m_pszUuid); +#endif // allocate new buffer if not done yet if ( !m_pszCForm ) - m_pszCForm = new char[UUID_CSTRLEN]; + m_pszCForm = new wxChar[UUID_CSTRLEN]; // and fill it - memcpy(m_pszCForm, uuid.m_pszCForm, UUID_CSTRLEN); + memcpy(m_pszCForm, uuid.m_pszCForm, UUID_CSTRLEN*sizeof(wxChar)); return *this; } @@ -83,7 +91,11 @@ Uuid::~Uuid() // this string must be allocated by RPC! // (otherwise you get a debug breakpoint deep inside RPC DLL) if ( m_pszUuid ) +#ifdef _UNICODE + RpcStringFree((unsigned short **)&m_pszUuid); +#else RpcStringFree(&m_pszUuid); +#endif // perhaps we should just use a static buffer and not bother // with new and delete? @@ -97,7 +109,11 @@ void Uuid::Set(const UUID &uuid) m_uuid = uuid; // get string representation +#ifdef _UNICODE + UuidToString(&m_uuid, (unsigned short **)&m_pszUuid); +#else UuidToString(&m_uuid, &m_pszUuid); +#endif // cache UUID in C format UuidToCForm(); @@ -115,15 +131,23 @@ void Uuid::Create() } // set the value -bool Uuid::Set(const char *pc) +bool Uuid::Set(const wxChar *pc) { // get UUID from string - if ( UuidFromString((uchar *)pc, &m_uuid) != RPC_S_OK) +#ifdef _UNICODE + if ( UuidFromString((unsigned short *)pc, &m_uuid) != RPC_S_OK) +#else + if ( UuidFromString((wxUChar *)pc, &m_uuid) != RPC_S_OK) +#endif // failed: probably invalid string return FALSE; // transform it back to string to normalize it +#ifdef _UNICODE + UuidToString(&m_uuid, (unsigned short **)&m_pszUuid); +#else UuidToString(&m_uuid, &m_pszUuid); +#endif // update m_pszCForm UuidToCForm(); @@ -139,10 +163,10 @@ bool Uuid::Set(const char *pc) void Uuid::UuidToCForm() { if ( m_pszCForm == NULL ) - m_pszCForm = new char[UUID_CSTRLEN]; + m_pszCForm = new wxChar[UUID_CSTRLEN]; - wsprintf(m_pszCForm, "0x%8.8X,0x%4.4X,0x%4.4X,0x%2.2X,0x2.2%X," - "0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X", + wsprintf(m_pszCForm, _T("0x%8.8X,0x%4.4X,0x%4.4X,0x%2.2X,0x2.2%X," + "0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X"), m_uuid.Data1, m_uuid.Data2, m_uuid.Data3, m_uuid.Data4[1], m_uuid.Data4[2], m_uuid.Data4[3], m_uuid.Data4[4], m_uuid.Data4[5], m_uuid.Data4[6], m_uuid.Data4[7], m_uuid.Data4[8]);