From 1bf4d7f1c1b96c965d32da5b8337e585b2f312f4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 17 Aug 2016 02:07:38 +0200 Subject: NUL-termination MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libcoopgamma_native.pyx.gpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/libcoopgamma_native.pyx.gpp b/src/libcoopgamma_native.pyx.gpp index e9cd890..1947981 100644 --- a/src/libcoopgamma_native.pyx.gpp +++ b/src/libcoopgamma_native.pyx.gpp @@ -841,12 +841,12 @@ def libcoopgamma_native_get_method_and_site(method : str, site : str): cdef bytes rbssite try: if method is not None: - buf = method.encode('utf-8') + buf = method.encode('utf-8') + bytes([0]) cmethod = malloc(len(buf) * sizeof(char)) for i in range(len(buf)): cmethod[i] = (buf[i]) if site is not None: - buf = site.encode('utf-8') + buf = site.encode('utf-8') + bytes([0]) csite = malloc(len(buf) * sizeof(char)) for i in range(len(buf)): csite[i] = (buf[i]) @@ -884,12 +884,12 @@ def libcoopgamma_native_get_pid_file(method : str, site : str): cdef bytes bs try: if method is not None: - buf = method.encode('utf-8') + buf = method.encode('utf-8') + bytes([0]) cmethod = malloc(len(buf) * sizeof(char)) for i in range(len(buf)): cmethod[i] = (buf[i]) if site is not None: - buf = site.encode('utf-8') + buf = site.encode('utf-8') + bytes([0]) csite = malloc(len(buf) * sizeof(char)) for i in range(len(buf)): csite[i] = (buf[i]) @@ -923,12 +923,12 @@ def libcoopgamma_native_get_socket_file(method : str, site : str): cdef bytes bs try: if method is not None: - buf = method.encode('utf-8') + buf = method.encode('utf-8') + bytes([0]) cmethod = malloc(len(buf) * sizeof(char)) for i in range(len(buf)): cmethod[i] = (buf[i]) if site is not None: - buf = site.encode('utf-8') + buf = site.encode('utf-8') + bytes([0]) csite = malloc(len(buf) * sizeof(char)) for i in range(len(buf)): csite[i] = (buf[i]) @@ -1310,7 +1310,7 @@ def libcoopgamma_native_get_gamma_info_send(crtc : str, address : int, async : i cdef libcoopgamma_async_context_t* actx = async cdef char* ccrtc = NULL try: - bs = crtc.encode('utf-8') + bs = crtc.encode('utf-8') + bytes([0]) ccrtc = malloc(len(bs) * sizeof(char)) if ccrtc is NULL: return int(errno) @@ -1380,7 +1380,7 @@ def libcoopgamma_native_get_gamma_info_sync(crtc : str, address : int): try: if libcoopgamma_crtc_info_initialise(&info) < 0: return int(errno) - bscrtc = crtc.encode('utf-8') + bscrtc = crtc.encode('utf-8') + bytes([0]) ccrtc = malloc(len(bscrtc) * sizeof(bscrtc)) for i in range(len(bscrtc)): ccrtc[i] = (bscrtc[i]) -- cgit v1.2.3-70-g09d2