void-packages/srcpkgs/pilot-link/patches/fix-swig_const_char_ptr.patch
Đoàn Trần Công Danh 49cb564d14 srcpkgs/p*: convert patches to -Np1
* par is kept at -Np0

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

74 lines
2.5 KiB
Diff

--- a/bindings/Python/src/pisock_wrap.c 2006-03-24 21:07:52.000000000 +0100
+++ b/bindings/Python/src/pisock_wrap.c 2016-12-20 15:03:35.066297623 +0100
@@ -1211,7 +1211,7 @@
obj = pyobj;
if (PyCFunction_Check(obj)) {
/* here we get the method pointer for callbacks */
- char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
+ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
c = doc ? strstr(doc, "swig_ptr: ") : 0;
if (c) {
c = ty ? SWIG_UnpackVoidPtr(c + 10, &vptr, ty->name) : 0;
@@ -5827,18 +5827,16 @@
static PyObject *_wrap_delete_PilotUser(PyObject *self, PyObject *args) {
PyObject *resultobj = NULL;
- struct PilotUser *arg1 = (struct PilotUser *) 0 ;
- struct PilotUser temp1 ;
-
-
- arg1 = &temp1;
+ struct PilotUser *arg1 = (struct PilotUser *) malloc(sizeof(struct PilotUser));
+
+ if(!arg1) goto fail;
if(!PyArg_ParseTuple(args,(char *)":delete_PilotUser")) goto fail;
- free((char *) arg1);
Py_INCREF(Py_None); resultobj = Py_None;
if (arg1) resultobj = t_output_helper(resultobj, PyObjectFromPilotUser(arg1));
+ free(arg1);
return resultobj;
fail:
@@ -6337,18 +6335,16 @@
static PyObject *_wrap_delete_SysInfo(PyObject *self, PyObject *args) {
PyObject *resultobj = NULL;
- struct SysInfo *arg1 = (struct SysInfo *) 0 ;
- struct SysInfo temp1 ;
+ struct SysInfo *arg1 = (struct SysInfo *) malloc(sizeof(struct SysInfo));
-
- arg1 = &temp1;
+ if(!arg1) goto fail;
if(!PyArg_ParseTuple(args,(char *)":delete_SysInfo")) goto fail;
- free((char *) arg1);
Py_INCREF(Py_None); resultobj = Py_None;
if (arg1) resultobj = t_output_helper(resultobj, PyObjectFromSysInfo(arg1));
+ free(arg1);
return resultobj;
fail:
@@ -12905,7 +12905,7 @@
swig_type_info **types_initial) {
size_t i;
for (i = 0; methods[i].ml_name; ++i) {
- char *c = methods[i].ml_doc;
+ const char *c = methods[i].ml_doc;
if (c && (c = strstr(c, "swig_ptr: "))) {
int j;
swig_const_info *ci = 0;
@@ -12909,7 +12909,7 @@
if (c && (c = strstr(c, "swig_ptr: "))) {
int j;
swig_const_info *ci = 0;
- char *name = c + 10;
+ const char *name = c + 10;
for (j = 0; const_table[j].type; ++j) {
if (strncmp(const_table[j].name, name,
strlen(const_table[j].name)) == 0) {