diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-26 04:57:08 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-26 04:57:08 (GMT) |
commit | 8abd2e6c6e71135efef87ae4c12a2a3d9d1bf768 (patch) | |
tree | 98b70398b15b063923dbb1bc0b093501698ed2c4 /Modules | |
parent | 3fcbea567b65ca26e25f082259f1493330e32936 (diff) | |
download | cpython-8abd2e6c6e71135efef87ae4c12a2a3d9d1bf768.zip cpython-8abd2e6c6e71135efef87ae4c12a2a3d9d1bf768.tar.gz cpython-8abd2e6c6e71135efef87ae4c12a2a3d9d1bf768.tar.bz2 |
Use unicode
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/ossaudiodev.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c index ebf101a..8cc9462 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -366,10 +366,10 @@ oss_read(oss_audio_t *self, PyObject *args) if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyString_FromStringAndSize(NULL, size); + rv = PyBytes_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - cp = PyString_AS_STRING(rv); + cp = PyBytes_AS_STRING(rv); Py_BEGIN_ALLOW_THREADS count = read(self->fd, cp, size); @@ -381,7 +381,7 @@ oss_read(oss_audio_t *self, PyObject *args) return NULL; } self->icount += count; - _PyString_Resize(&rv, count); + PyBytes_Resize(rv, count); return rv; } @@ -391,7 +391,7 @@ oss_write(oss_audio_t *self, PyObject *args) char *cp; int rv, size; - if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) { + if (!PyArg_ParseTuple(args, "y#:write", &cp, &size)) { return NULL; } @@ -422,7 +422,7 @@ oss_writeall(oss_audio_t *self, PyObject *args) mode, the behaviour of write() and writeall() from Python is indistinguishable. */ - if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) + if (!PyArg_ParseTuple(args, "y#:write", &cp, &size)) return NULL; /* use select to wait for audio device to be available */ @@ -811,20 +811,20 @@ oss_getattr(oss_audio_t *self, char *name) Py_INCREF(rval); } else if (strcmp(name, "name") == 0) { - rval = PyString_FromString(self->devicename); + rval = PyUnicode_FromString(self->devicename); } else if (strcmp(name, "mode") == 0) { /* No need for a "default" in this switch: from newossobject(), self->mode can only be one of these three values. */ switch(self->mode) { case O_RDONLY: - rval = PyString_FromString("r"); + rval = PyUnicode_FromString("r"); break; case O_RDWR: - rval = PyString_FromString("rw"); + rval = PyUnicode_FromString("rw"); break; case O_WRONLY: - rval = PyString_FromString("w"); + rval = PyUnicode_FromString("w"); break; } } @@ -913,12 +913,12 @@ build_namelists (PyObject *module) if (labels == NULL || names == NULL) goto error2; for (i = 0; i < num_controls; i++) { - s = PyString_FromString(control_labels[i]); + s = PyUnicode_FromString(control_labels[i]); if (s == NULL) goto error2; PyList_SET_ITEM(labels, i, s); - s = PyString_FromString(control_names[i]); + s = PyUnicode_FromString(control_names[i]); if (s == NULL) goto error2; PyList_SET_ITEM(names, i, s); |