aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2015-10-06 13:00:36 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2015-10-06 13:00:36 +0000
commit3cc2fdca7973bcfe004c86fc827a2bdc5ad8e11f (patch)
treeb06e3e2ef351dc668e723b32aede3e083c5a1c19
parent9f880fa1eca65ed6b1e30624a97f543f2bcfb4a1 (diff)
use z_wrappers around sys_open/close()
svn path=/trunk/externals/zexy/; revision=17573
-rw-r--r--src/freadln.c4
-rw-r--r--src/fwriteln.c4
-rw-r--r--src/lpt.c6
-rw-r--r--src/msgfile.c16
-rw-r--r--src/sfplay.c8
-rw-r--r--src/sfrecord.c8
6 files changed, 23 insertions, 23 deletions
diff --git a/src/freadln.c b/src/freadln.c
index 42ca868..af91114 100644
--- a/src/freadln.c
+++ b/src/freadln.c
@@ -62,7 +62,7 @@ typedef struct freadln {
static void freadln_close (t_freadln *x)
{
if(x->x_file) {
- fclose(x->x_file);
+ z_fclose(x->x_file);
}
x->x_file=0;
if(x->x_filename) {
@@ -120,7 +120,7 @@ static void freadln_open (t_freadln *x, t_symbol *s, t_symbol*type)
strcpy(x->x_filename,filenamebuf);
strcpy(x->x_filename+len,"/");
strcpy(x->x_filename+len+1,filenamebufptr);
- if (!(x->x_file=fopen(x->x_filename, "r"))) {
+ if (!(x->x_file=z_fopen(x->x_filename, "r"))) {
pd_error(x, "freadln: failed to fopen %s",x->x_filename);
return;
}
diff --git a/src/fwriteln.c b/src/fwriteln.c
index 1822631..e630929 100644
--- a/src/fwriteln.c
+++ b/src/fwriteln.c
@@ -53,7 +53,7 @@ typedef struct fwriteln {
static void fwriteln_close (t_fwriteln *x)
{
if(x->x_file) {
- fclose(x->x_file);
+ z_fclose(x->x_file);
}
x->x_file=0;
if(x->x_filename) {
@@ -94,7 +94,7 @@ static void fwriteln_open (t_fwriteln *x, t_symbol *s, t_symbol*type)
strcpy(x->linebreak_chr,";\n");
}
- if (!(x->x_file=fopen(filename, "w"))) {
+ if (!(x->x_file=z_fopen(filename, "w"))) {
pd_error(x, "failed to open %128s",filename);
free(filename);
return;
diff --git a/src/lpt.c b/src/lpt.c
index 26f4468..502ab6d 100644
--- a/src/lpt.c
+++ b/src/lpt.c
@@ -204,14 +204,14 @@ static void *lpt_new(t_symbol *s, int argc, t_atom *argv)
x->port=strtol(devname, 0, 16);
if(0==x->port) {
#ifdef HAVE_LINUX_PPDEV_H
- x->device = open(devname, O_RDWR);
+ x->device = z_open(devname, O_RDWR);
if(x->device<=0) {
error("lpt: bad device %s", devname);
return(x);
} else {
if (ioctl (x->device, PPCLAIM)) {
perror ("PPCLAIM");
- close (x->device);
+ z_close (x->device);
x->device=-1;
}
}
@@ -280,7 +280,7 @@ static void lpt_free(t_lpt *x)
# ifdef HAVE_LINUX_PPDEV_H
if (x->device>0) {
ioctl (x->device, PPRELEASE);
- close(x->device);
+ z_close(x->device);
x->device=0;
} else
# endif
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);
diff --git a/src/sfplay.c b/src/sfplay.c
index d762a5a..a577605 100644
--- a/src/sfplay.c
+++ b/src/sfplay.c
@@ -184,10 +184,10 @@ static void sfplay_open(t_sfplay *x,t_symbol *filename,t_symbol *endian)
#endif
if (x->fp != NULL) {
- fclose(x->fp); /* should not happen */
+ z_fclose(x->fp); /* should not happen */
}
- if (!(x->fp = fopen(x->filename->s_name,BINREADMODE))) {
+ if (!(x->fp = z_fopen(x->filename->s_name,BINREADMODE))) {
error("sfplay: can't open %s", x->filename->s_name);
}
}
@@ -203,7 +203,7 @@ static void sfplay_close(t_sfplay *x)
/* now in state machine
if(x->fp != NULL)
{
- fclose(x->fp);
+ z_fclose(x->fp);
x->fp = NULL;
}
*/
@@ -523,7 +523,7 @@ static t_int *sfplay_perform(t_int *w)
/* avoid openfiles */
if(x->fp) {
- fclose(x->fp);
+ z_fclose(x->fp);
x->fp = NULL;
};
diff --git a/src/sfrecord.c b/src/sfrecord.c
index f215621..0256281 100644
--- a/src/sfrecord.c
+++ b/src/sfrecord.c
@@ -152,10 +152,10 @@ static void sfrecord_open(t_sfrecord *x,t_symbol *filename,
#endif
if (x->fp != NULL) {
- fclose(x->fp); /* should not happen */
+ z_fclose(x->fp); /* should not happen */
}
- if (!(x->fp = fopen(x->filename->s_name,BINWRITEMODE))) {
+ if (!(x->fp = z_fopen(x->filename->s_name,BINWRITEMODE))) {
error("sfrecord: can't open %s", x->filename->s_name);
}
}
@@ -171,7 +171,7 @@ static void sfrecord_close(t_sfrecord *x)
/* now in state machine
if(x->fp != NULL)
{
- fclose(x->fp);
+ z_fclose(x->fp);
x->fp = NULL;
}
*/
@@ -456,7 +456,7 @@ case SFRECORD_CLOSE:
/* avoid openfiles */
if(x->fp) {
- fclose(x->fp);
+ z_fclose(x->fp);
x->fp = NULL;
};