aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMartin Peach <mrpeach@users.sourceforge.net>2013-02-20 21:01:45 +0000
committerMartin Peach <mrpeach@users.sourceforge.net>2013-02-20 21:01:45 +0000
commita6a23e8f528cf2d76e52ba546738d9794ca12bc0 (patch)
tree62dc0b8bcabfefbb38ecd3c49e79984c343fb3fa /net
parent2e003fbbcfd67e6fadb1f882f3240cd4b542a052 (diff)
fopen and fclose -> sys_fopen and sys_fclose for recent pd
svn path=/trunk/externals/mrpeach/; revision=17048
Diffstat (limited to 'net')
-rw-r--r--net/udpsend.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/udpsend.c b/net/udpsend.c
index 9c84f2b..cbef2f8 100644
--- a/net/udpsend.c
+++ b/net/udpsend.c
@@ -29,6 +29,13 @@
#include <ifaddrs.h> // for getifaddrs
#endif // __APPLE__
+/* support older Pd versions without sys_open(), sys_fopen(), sys_fclose() */
+#if PD_MAJOR_VERSION == 0 && PD_MINOR_VERSION < 44
+#define sys_open open
+#define sys_fopen fopen
+#define sys_fclose fclose
+#endif
+
static t_class *udpsend_class;
typedef struct _udpsend
@@ -482,7 +489,7 @@ static void udpsend_send(t_udpsend *x, t_symbol *s, int argc, t_atom *argv)
#ifdef DEBUG
post ("udpsend fname: %s", fpath);
#endif
- fptr = fopen(fpath, "rb");
+ fptr = sys_fopen(fpath, "rb");
if (fptr == NULL)
{
post("udpsend: unable to open \"%s\"", fpath);
@@ -504,7 +511,7 @@ static void udpsend_send(t_udpsend *x, t_symbol *s, int argc, t_atom *argv)
break;
}
}
- fclose(fptr);
+ sys_fclose(fptr);
fptr = NULL;
post("udpsend: read \"%s\" length %d byte%s", fpath, j, ((d==1)?"":"s"));
}