History

python/ext/py-source.c: copy string uri

Paul Brossier committed 9 years ago

Commit b8cedb61 parent 140b4602 files · +6 −4Browse files

Showing the changes to python (2 of 2 files). Show all

Unified · Split

2 files
  1. python/ext/py-sink.c +3 −2
  2. python/ext/py-source.c +3 −2
python/ext/py-sink.c+3−2
@@ -80,9 +80,10 @@ Py_sink_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) · 79 unmodified lines
8080 return NULL;
8181 }
8282
83− self->uri = "none";
83+ self->uri = NULL;
8484 if (uri != NULL) {
85− self->uri = uri;
85+ self->uri = (char_t *)malloc(sizeof(char_t) * (strnlen(uri, PATH_MAX) + 1));
86+ strncpy(self->uri, uri, strnlen(uri, PATH_MAX) + 1);
8687 }
8788
8889 self->samplerate = Py_aubio_default_samplerate;
python/ext/py-source.c+3−2
@@ -100,9 +100,10 @@ Py_source_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) · 99 unmodified lines
100100 return NULL;
101101 }
102102
103− self->uri = "none";
103+ self->uri = NULL;
104104 if (uri != NULL) {
105− self->uri = uri;
105+ self->uri = (char_t *)malloc(sizeof(char_t) * (strnlen(uri, PATH_MAX) + 1));
106+ strncpy(self->uri, uri, strnlen(uri, PATH_MAX) + 1);
106107 }
107108
108109 self->samplerate = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t