Skip to content

Commit 13ac4bd

Browse files
committed
Replace PYWIN_ATTR_CONVERT with PyUnicode_AsUTF8
1 parent c18be83 commit 13ac4bd

27 files changed

+64
-69
lines changed

Pythonwin/win32cmdui.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ BOOL Python_OnCmdMsg(CCmdTarget *obj, UINT nID, int nCode, void *pExtra, AFX_CMD
8282
pObj->pOleEventHookList->Lookup((unsigned short)pEvent->m_dispid, (void *&)method)) {
8383
if (pfnMakeOlePythonCall == NULL) {
8484
pfnMakeOlePythonCall =
85-
(BOOL(*)(PyObject *, DISPPARAMS FAR *, VARIANT FAR *, EXCEPINFO FAR *, UINT FAR *,
86-
PyObject *))GetPythonOleProcAddress("PyCom_MakeOlePythonCall");
85+
(BOOL (*)(PyObject *, DISPPARAMS FAR *, VARIANT FAR *, EXCEPINFO FAR *, UINT FAR *,
86+
PyObject *))GetPythonOleProcAddress("PyCom_MakeOlePythonCall");
8787

8888
ASSERT(pfnMakeOlePythonCall);
8989
}
@@ -282,7 +282,7 @@ static struct PyMethodDef PyCCmdUI_methods[] = {
282282

283283
PyObject *PyCCmdUI::getattro(PyObject *obname)
284284
{
285-
char *name = PYWIN_ATTR_CONVERT(obname);
285+
const char *name = PyUnicode_AsUTF8(obname);
286286
if (strcmp(name, "m_nIndex") == 0) { // @prop int|m_nIndex|
287287
CCmdUI *pCU = PyCCmdUI::GetCCmdUIPtr(this);
288288
if (!pCU)

Pythonwin/win32dlg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ PyCDialog::~PyCDialog()
171171

172172
PyObject *PyCDialog::getattro(PyObject *obname)
173173
{
174-
char *name = PYWIN_ATTR_CONVERT(obname);
174+
const char *name = PyUnicode_AsUTF8(obname);
175175
if (strcmp(name, "data") == 0) {
176176
Py_INCREF(dddict);
177177
return dddict;

Pythonwin/win32toolbar.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct MyMemberList dcmembers[] = {
164164

165165
PyObject *PyCDockContext::getattro(PyObject *obname)
166166
{
167-
char *name = PYWIN_ATTR_CONVERT(obname);
167+
const char *name = PyUnicode_AsUTF8(obname);
168168
if (name == NULL)
169169
return NULL;
170170
CDockContext *pC = GetDockContext(this);
@@ -200,7 +200,7 @@ PyObject *PyCDockContext::getattro(PyObject *obname)
200200

201201
int PyCDockContext::setattro(PyObject *obname, PyObject *value)
202202
{
203-
char *name = PYWIN_ATTR_CONVERT(obname);
203+
const char *name = PyUnicode_AsUTF8(obname);
204204
if (name == NULL)
205205
return -1;
206206
CDockContext *pC = GetDockContext(this);
@@ -446,7 +446,7 @@ static struct PyMethodDef PyCControlBar_methods[] = {
446446

447447
PyObject *PyCControlBar::getattro(PyObject *obname)
448448
{
449-
char *name = PYWIN_ATTR_CONVERT(obname);
449+
const char *name = PyUnicode_AsUTF8(obname);
450450
if (name == NULL)
451451
return NULL;
452452
CControlBar *pCtlBar = PyCControlBar::GetControlBar(this);
@@ -477,7 +477,7 @@ PyObject *PyCControlBar::getattro(PyObject *obname)
477477

478478
int PyCControlBar::setattro(PyObject *obname, PyObject *v)
479479
{
480-
char *name = PYWIN_ATTR_CONVERT(obname);
480+
const char *name = PyUnicode_AsUTF8(obname);
481481
if (name == NULL)
482482
return -1;
483483

Pythonwin/win32util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static PySequenceMethods PyCRect_Sequence = {
9292

9393
PyObject *PyCRect::getattro(PyObject *obname)
9494
{
95-
char *name = PYWIN_ATTR_CONVERT(obname);
95+
const char *name = PyUnicode_AsUTF8(obname);
9696
if (name == NULL)
9797
return NULL;
9898
if (strcmp(name, "left") == 0)
@@ -140,7 +140,7 @@ CString PyCRect::repr()
140140

141141
int PyCRect::setattro(PyObject *obname, PyObject *v)
142142
{
143-
char *name = PYWIN_ATTR_CONVERT(obname);
143+
const char *name = PyUnicode_AsUTF8(obname);
144144
if (name == NULL)
145145
return -1;
146146
int intval = PyLong_AsLong(v);

com/win32com/src/PyIBase.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ PyObject *PyIBase::getattr(char *name) { return PyObject_GetAttrString(this, nam
3232

3333
/*static*/ int PyIBase::setattro(PyObject *op, PyObject *obname, PyObject *v)
3434
{
35-
char *name = PYWIN_ATTR_CONVERT(obname);
35+
const char *name = PyUnicode_AsUTF8(obname);
3636
if (name == NULL)
3737
return -1;
3838
PyIBase *bc = (PyIBase *)op;
3939
return bc->setattr(name, v);
4040
}
4141

42-
int PyIBase::setattr(char *name, PyObject *v)
42+
int PyIBase::setattr(const char *name, PyObject *v)
4343
{
4444
char buf[128];
4545
sprintf(buf, "%s has read-only attributes", ob_type->tp_name);

com/win32com/src/PyRecord.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ PyObject *PyRecord::getattro(PyObject *self, PyObject *obname)
590590
PyRecord *pyrec = (PyRecord *)self;
591591
GUID structguid;
592592
OLECHAR *guidString;
593-
char *name = PYWIN_ATTR_CONVERT(obname);
593+
const char *name = PyUnicode_AsUTF8(obname);
594594
if (name == NULL)
595595
return NULL;
596596
if (strcmp(name, "__record_type_guid__") == 0) {

com/win32com/src/extensions/PySTGMEDIUM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void PySTGMEDIUM::Close()
230230

231231
PyObject *PySTGMEDIUM::getattro(PyObject *self, PyObject *obname)
232232
{
233-
char *name = PYWIN_ATTR_CONVERT(obname);
233+
const char *name = PyUnicode_AsUTF8(obname);
234234
if (name == NULL)
235235
return NULL;
236236

com/win32com/src/include/PythonCOM.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class PYCOM_EXPORT PyIBase : public PyObject {
168168
public:
169169
// virtuals for Python support
170170
virtual PyObject *getattr(char *name);
171-
virtual int setattr(char *name, PyObject *v);
171+
virtual int setattr(const char *name, PyObject *v);
172172
virtual PyObject *repr();
173173
virtual int compare(PyObject *other)
174174
{

com/win32comext/adsi/src/PyADSIUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ class PyADS_ATTR_INFO : public PyObject {
449449

450450
static PyObject *getattro(PyObject *self, PyObject *obname)
451451
{
452-
char *name = PYWIN_ATTR_CONVERT(obname);
452+
const char *name = PyUnicode_AsUTF8(obname);
453453
if (name == NULL)
454454
return NULL;
455455
if (strcmp(name, "__members__") == 0) {

com/win32comext/directsound/src/PyDSBUFFERDESC.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ PyTypeObject PyDSBUFFERDESCType = {
103103
// IDirectSound::CreateSoundBuffer call. With this flag set, an application using DirectSound can continue to play
104104
// its sticky focus buffers if the user switches to another application not using DirectSound. In this situation,
105105
// the application's normal buffers are muted, but the sticky focus buffers are still audible. This is useful for
106-
// nongame applications, such as movie playback (DirectShow), when the user wants to hear the soundtrack while
107-
// typing in Microsoft Word or Microsoft® Excel, for example. However, if the user switches to another DirectSound
106+
// nongame applications, such as movie playback (DirectShow), when the user wants to hear the soundtrack while
107+
// typing in Microsoft Word or Microsoft Excel, for example. However, if the user switches to another DirectSound
108108
// application, all sound buffers, both normal and sticky focus, in the previous application are muted.
109109
// @flag DSBCAPS_GLOBALFOCUS|The buffer is a global sound buffer. With this flag set, an application using
110110
// DirectSound can continue to play its buffers if the user switches focus to another application, even if the new
@@ -167,7 +167,7 @@ PyDSBUFFERDESC::~PyDSBUFFERDESC() { Py_XDECREF(m_obWFX); }
167167
int PyDSBUFFERDESC::setattro(PyObject *self, PyObject *obname, PyObject *obvalue)
168168
{
169169
PyDSBUFFERDESC *obself = (PyDSBUFFERDESC *)self;
170-
char *name = PYWIN_ATTR_CONVERT(obname);
170+
const char *name = PyUnicode_AsUTF8(obname);
171171
if (name == NULL)
172172
return -1;
173173

0 commit comments

Comments
 (0)