aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN.N. <matju@users.sourceforge.net>2009-04-25 04:19:31 +0000
committerN.N. <matju@users.sourceforge.net>2009-04-25 04:19:31 +0000
commit6adea0f5033ae78cac8cfc4377a68b62c8f9984b (patch)
treeff155dc9b6b16c110b1b877ae1678b9af00414e6
parente435b418bad00558d02805889008d983c0a105b5 (diff)
add t_symbol.==(const char*); remove gcc 4.2 warning in binbuf_read,binbuf_read_via_path,binbuf_write
svn path=/trunk/; revision=11135
-rw-r--r--desiredata/src/kernel.c6
-rw-r--r--desiredata/src/m_pd.h12
2 files changed, 11 insertions, 7 deletions
diff --git a/desiredata/src/kernel.c b/desiredata/src/kernel.c
index 69ce456c..95f3d7b4 100644
--- a/desiredata/src/kernel.c
+++ b/desiredata/src/kernel.c
@@ -1988,7 +1988,7 @@ static FILE *binbuf_dofopen(const char *s, const char *mode) {
return fopen(namebuf, mode);
}
-int binbuf_read(t_binbuf *b, const char *filename, char *dirname, int flags) {
+int binbuf_read(t_binbuf *b, const char *filename, const char *dirname, int flags) {
long length;
char *buf;
char *namebuf=0;
@@ -2023,7 +2023,7 @@ int binbuf_read_via_canvas(t_binbuf *b, const char *filename, t_canvas *canvas,
}
/* old version */
-int binbuf_read_via_path(t_binbuf *b, char const *filename, char *dirname, int flags) {
+int binbuf_read_via_path(t_binbuf *b, char const *filename, const char *dirname, int flags) {
char *buf, *bufptr;
int fd = open_via_path2(dirname, filename, "", &buf, &bufptr, 0);
if (fd<0) {error("%s: can't open", filename); return 1;}
@@ -2037,7 +2037,7 @@ int binbuf_read_via_path(t_binbuf *b, char const *filename, char *dirname, int f
static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd);
/* write a binbuf to a text file. If "crflag" is set we suppress semicolons. */
-int binbuf_write(t_binbuf *x, const char *filename, char *dir, int crflag) {
+int binbuf_write(t_binbuf *x, const char *filename, const char *dir, int crflag) {
char sbuf[WBUFSIZE];
ostringstream fbuf;
char *bp = sbuf, *ep = sbuf + WBUFSIZE;
diff --git a/desiredata/src/m_pd.h b/desiredata/src/m_pd.h
index 8b9d7235..17b6a061 100644
--- a/desiredata/src/m_pd.h
+++ b/desiredata/src/m_pd.h
@@ -158,6 +158,10 @@ typedef struct _symbol {
struct _symbol *next; /* brochette of all symbols (only for permanent symbols) */
size_t refcount; /* refcount<0 means that the symbol is permanent */
size_t n; /* size of name (support for NUL characters) */
+#ifdef PD_PLUSPLUS_FACE
+ bool operator == (const char *s) const {return strcmp(this->name,s)==0;}
+ bool operator != (const char *s) const {return strcmp(this->name,s);}
+#endif
} t_symbol;
#define s_name name
#define s_thing thing
@@ -457,10 +461,10 @@ EXTERN void binbuf_print(t_binbuf *x);
EXTERN int binbuf_getnatom(t_binbuf *x);
EXTERN t_atom *binbuf_getvec(t_binbuf *x);
EXTERN void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv);
-EXTERN int binbuf_read( t_binbuf *b, const char *filename, char *dirname, int flags);
-EXTERN int binbuf_read_via_canvas(t_binbuf *b, const char *filename, t_canvas *canvas, int flags);
-EXTERN int binbuf_read_via_path( t_binbuf *b, const char *filename, char *dirname, int flags);
-EXTERN int binbuf_write( t_binbuf *x, const char *filename, char *dir, int flags);
+EXTERN int binbuf_read( t_binbuf *b, const char *filename, const char *dirname, int flags);
+EXTERN int binbuf_read_via_canvas(t_binbuf *b, const char *filename, t_canvas *canvas, int flags);
+EXTERN int binbuf_read_via_path( t_binbuf *b, const char *filename, const char *dirname, int flags);
+EXTERN int binbuf_write( t_binbuf *x, const char *filename, const char *dir, int flags);
EXTERN void binbuf_evalfile(t_symbol *name, t_symbol *dir);
EXTERN t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, int tonew);