From 3cc2fdca7973bcfe004c86fc827a2bdc5ad8e11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 6 Oct 2015 13:00:36 +0000 Subject: use z_wrappers around sys_open/close() svn path=/trunk/externals/zexy/; revision=17573 --- src/msgfile.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/msgfile.c') diff --git a/src/msgfile.c b/src/msgfile.c index c702a6f..1ed6ec8 100644 --- a/src/msgfile.c +++ b/src/msgfile.c @@ -734,12 +734,12 @@ static void msgfile_read2(t_msgfile *x, t_symbol *filename, if (fd < 0) { /* open via path failed, fall back */ - fd=open(filename->s_name, rmode); + fd=z_open(filename->s_name, rmode); if(fd < 0) { pd_error(x, "can't open in %s/%s", dirname, filename->s_name); return; } else { - close(fd); + z_close(fd); sprintf(filnam, "%s", filename->s_name); } } else { @@ -747,7 +747,7 @@ static void msgfile_read2(t_msgfile *x, t_symbol *filename, sprintf(filnam, "%s/%s", buf, bufptr); } - fil=fopen(filnam, "rb"); + fil=z_fopen(filnam, "rb"); if(fil==NULL) { pd_error(x, "could not open '%s'", filnam); return; @@ -759,7 +759,7 @@ static void msgfile_read2(t_msgfile *x, t_symbol *filename, if (!(readbuf = t_getbytes(length))) { pd_error(x, "msgfile_read: could not reserve %ld bytes to read into", length); - fclose(fil); + z_fclose(fil); return; } @@ -792,13 +792,13 @@ static void msgfile_read2(t_msgfile *x, t_symbol *filename, if ((readlength = fread(readbuf, sizeof(char), length, fil)) < length) { pd_error(x, "msgfile_read: unable to read %s: %ld of %ld", filnam, readlength, length); - fclose(fil); + z_fclose(fil); t_freebytes(readbuf, length); return; } /* close */ - fclose(fil); + z_fclose(fil); /* convert separators and eols to what pd expects in a binbuf*/ bufptr=readbuf; @@ -920,7 +920,7 @@ static void msgfile_write(t_msgfile *x, t_symbol *filename, /* open */ sys_bashfilename(filename->s_name, filnam); - if (!(f = fopen(filnam, "w"))) { + if (!(f = z_fopen(filnam, "w"))) { pd_error(x, "msgfile : failed to open %s", filnam); } else { /* write */ @@ -930,7 +930,7 @@ static void msgfile_write(t_msgfile *x, t_symbol *filename, } /* close */ if (f) { - fclose(f); + z_fclose(f); } binbuf_free(bbuf); -- cgit v1.2.1