Skip to content

Commit eb958fc

Browse files
Copilotnijel
andauthored
Replace deprecated Py_UNICODE with wchar_t (#184)
* Replace Py_UNICODE with wchar_t to fix deprecation warnings Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: nijel <212189+nijel@users.noreply.github.com> Co-authored-by: Michal Čihař <michal@cihar.com>
1 parent 8e46e02 commit eb958fc

8 files changed

Lines changed: 15 additions & 15 deletions

File tree

gammu/src/convertors/bitmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ PyObject *BitmapToPython(GSM_Bitmap * bitmap)
316316
PyObject *xpmval;
317317
PyObject *s;
318318
char *t;
319-
Py_UNICODE *txt;
320-
Py_UNICODE *sendr;
319+
wchar_t *txt;
320+
wchar_t *sendr;
321321
PyObject *val;
322322

323323
xpmval = PyList_New(0);

gammu/src/convertors/calendar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ PyObject *CalendarToPython(const GSM_CalendarEntry * entry)
199199
PyObject *r;
200200
PyObject *d;
201201
int i;
202-
Py_UNICODE *s;
202+
wchar_t *s;
203203
char *t;
204204
GSM_DateTime dt;
205205
int ignore;

gammu/src/convertors/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ PyObject *MemoryEntryToPython(const GSM_MemoryEntry * entry)
7272
PyObject *l;
7373
int i;
7474
int j;
75-
Py_UNICODE *s;
75+
wchar_t *s;
7676
char *t;
7777
const GSM_BinaryPicture *bitmap;
7878
const char *bmptype;

gammu/src/convertors/sms.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ GSM_SMSFormat StringToSMSFormat(char *s)
223223
PyObject *SMSCToPython(GSM_SMSC * smsc)
224224
{
225225
PyObject *ret;
226-
Py_UNICODE *name, *number, *defaultn;
226+
wchar_t *name, *number, *defaultn;
227227
char *val, *fmt;
228228

229229
name = strGammuToPython(smsc->Name);
@@ -911,8 +911,8 @@ PyObject *SMSToPython(GSM_SMSMessage * sms)
911911
PyObject *udh;
912912
PyObject *smsc;
913913
char *mt;
914-
Py_UNICODE *name;
915-
Py_UNICODE *number;
914+
wchar_t *name;
915+
wchar_t *number;
916916
PyObject *text;
917917
char *type;
918918
char *coding;
@@ -2026,7 +2026,7 @@ int SMSInfoFromPython(PyObject * dict, GSM_MultiPartSMSInfo * entry)
20262026

20272027
PyObject *SMSFolderToPython(GSM_OneSMSFolder * folder)
20282028
{
2029-
Py_UNICODE *name;
2029+
wchar_t *name;
20302030
char *mt;
20312031
PyObject *result;
20322032

gammu/src/convertors/todo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ PyObject *TodoToPython(const GSM_ToDoEntry * entry)
7777
PyObject *r;
7878
PyObject *d;
7979
int i;
80-
Py_UNICODE *s;
80+
wchar_t *s;
8181
char *p;
8282
char *t;
8383

gammu/src/convertors/wap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ int MMSIndicatorFromPython(PyObject * dict, GSM_MMSIndicator * mms)
157157
PyObject *WAPBookmarkToPython(GSM_WAPBookmark * wap)
158158
{
159159
PyObject *ret;
160-
Py_UNICODE *title, *address;
160+
wchar_t *title, *address;
161161

162162
title = strGammuToPython(wap->Title);
163163
if (title == NULL)

gammu/src/gammu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ StateMachine_GetAlarm(StateMachineObject *self, PyObject *args, PyObject *kwds)
12331233
GSM_Error error;
12341234
GSM_Alarm gsm_alarm;
12351235
PyObject *dt;
1236-
Py_UNICODE *s;
1236+
wchar_t *s;
12371237
PyObject *result;
12381238
static char *kwlist[] = {"Location", NULL};
12391239

@@ -1891,7 +1891,7 @@ StateMachine_GetCategory(StateMachineObject *self, PyObject *args, PyObject *kwd
18911891
GSM_Category Category;
18921892
static char *kwlist[] = {"Type", "Location", NULL};
18931893
char *s;
1894-
Py_UNICODE *u;
1894+
wchar_t *u;
18951895
PyObject *o;
18961896

18971897
if (!PyArg_ParseTupleAndKeywords(args, kwds, "si", kwlist,

include/convertors.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ int BuildGSMTime(PyObject * pydt, GSM_DateTime * dt);
8080
/**
8181
* Convert Python unicode string to Gammu unicode string.
8282
*/
83-
unsigned char *strPythonToGammu(const Py_UNICODE * src, const size_t len);
83+
unsigned char *strPythonToGammu(const wchar_t * src, const size_t len);
8484

8585
/**
8686
* Converts either object to unicode and returns its value.
@@ -90,12 +90,12 @@ unsigned char *StringPythonToGammu(PyObject * o);
9090
/**
9191
* Convert Gammu unicode string to unicode string that can be read by Python.
9292
*/
93-
Py_UNICODE *strGammuToPython(const unsigned char *src);
93+
wchar_t *strGammuToPython(const unsigned char *src);
9494

9595
/**
9696
* Convert Gammu unicode string with defined length to unicode string that can be read by Python.
9797
*/
98-
Py_UNICODE *strGammuToPythonL(const unsigned char *src, const int len, size_t *out_len);
98+
wchar_t *strGammuToPythonL(const unsigned char *src, const int len, size_t *out_len);
9999

100100
/**
101101
* Convert Gammu unicode string to python unicode object.

0 commit comments

Comments
 (0)