From 1f0ba6b7f3bec530f23b7e8bcce8dcc070633169 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Fri, 24 Apr 2009 20:21:35 +0000 Subject: remove gcc 4.2 warnings in binbuf_text, binbuf_text_matju, binbuf_text_quoted, binbuf_text_miller, pd_eval_text, pd_eval_text2, canvas_readerror, pd_vscanargs, pd_scanargs, pd_vsaveargs, pd_saveargs. svn path=/trunk/; revision=11126 --- desiredata/src/desire.c | 12 ++++++------ desiredata/src/desire.h | 2 +- desiredata/src/kernel.c | 26 +++++++++++++------------- desiredata/src/m_pd.h | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/desiredata/src/desire.c b/desiredata/src/desire.c index 7867a669..763fba7e 100644 --- a/desiredata/src/desire.c +++ b/desiredata/src/desire.c @@ -1304,7 +1304,7 @@ static t_pd *garray_arraytemplatecanvas; /* create invisible, built-in canvases to determine the templates for floats and float-arrays. */ -void pd_eval_text2(char *s) {pd_eval_text(s,strlen(s));} +void pd_eval_text2(const char *s) {pd_eval_text(s,strlen(s));} extern "C" void garray_init () { hack = 0; /* invisible canvases must be, uh, invisible */ @@ -2368,7 +2368,7 @@ static int canvas_scanbinbuf(int natoms, t_atom *vec, int *p_indexout, int *p_ne return i-indexwas; } static int canvas_readscalar(t_canvas *x, int natoms, t_atom *vec, int *p_nextmsg, int selectit); -static void canvas_readerror(int natoms, t_atom *vec, int message, int nline, char *s) { +static void canvas_readerror(int natoms, t_atom *vec, int message, int nline, const char *s) { error(s); startpost("line was:"); postatom(nline, vec + message); @@ -5738,7 +5738,7 @@ static void iemgui_color(t_iemgui *x, t_symbol *s, int ac, t_atom *av) { } #define NEXT p=va_arg(val,void*); /*printf("p=%p\n",p);*/ -int pd_vscanargs(int argc, t_atom *argv, char *fmt, va_list val) { +int pd_vscanargs(int argc, t_atom *argv, const char *fmt, va_list val) { int optional=0; int i,j=0; for (i=0; fmt[i]; i++) { @@ -5798,7 +5798,7 @@ break2: made declarative, by storing a list of &(0->blah) relative offsets into each struct... */ -int pd_vsaveargs(t_binbuf *b, char *fmt, va_list val) { +int pd_vsaveargs(t_binbuf *b, const char *fmt, va_list val) { t_atom a; int i; for (i=0; ; i++) { @@ -5827,7 +5827,7 @@ err: return 0; } -int pd_scanargs(int argc, t_atom *argv, char *fmt, ...) { +int pd_scanargs(int argc, t_atom *argv, const char *fmt, ...) { int i; va_list val; va_start(val,fmt); @@ -5836,7 +5836,7 @@ int pd_scanargs(int argc, t_atom *argv, char *fmt, ...) { return i; } -int pd_saveargs(t_binbuf *b, char *fmt, ...) { +int pd_saveargs(t_binbuf *b, const char *fmt, ...) { int i; va_list val; va_start(val,fmt); diff --git a/desiredata/src/desire.h b/desiredata/src/desire.h index b8824e62..38624f33 100644 --- a/desiredata/src/desire.h +++ b/desiredata/src/desire.h @@ -264,7 +264,7 @@ EXTERN t_symbol *s_empty; /* from kernel.c */ EXTERN void gobj_save(t_gobj *x, t_binbuf *b); -EXTERN void pd_eval_text(char *t, size_t size); +EXTERN void pd_eval_text(const char *t, size_t size); EXTERN int sys_syntax; /* from desire.c */ diff --git a/desiredata/src/kernel.c b/desiredata/src/kernel.c index fb282c9c..67c59b50 100644 --- a/desiredata/src/kernel.c +++ b/desiredata/src/kernel.c @@ -471,7 +471,7 @@ static void inlet_wrong(t_inlet *x, t_symbol *s) { void inlet_settip(t_inlet* i,t_symbol* s) {i->tip = s;} -char* inlet_tip(t_inlet* i,int num) { +const char *inlet_tip(t_inlet* i,int num) { if (num < 0) return "???"; while (num-- && i) i = i->next; if (i && i->tip) return i->tip->name; @@ -1243,7 +1243,7 @@ void new_anything(void *dummy, t_symbol *s, int argc, t_atom *argv) { } else newest = 0; } -#define MAKESYM(CSYM,S) t_symbol CSYM = {S,0,0,1,0xdeadbeef}; +#define MAKESYM(CSYM,S) t_symbol CSYM = {(char *)(S),0,0,1,0xdeadbeef}; MAKESYM(s_pointer ,"pointer") MAKESYM(s_float ,"float") MAKESYM(s_symbol ,"symbol") @@ -1368,11 +1368,11 @@ void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv) { ENTER(s); pd_typedmess_2(x,s,argc,argv); LEAVE; } -void pd_vmess(t_pd *x, t_symbol *sel, char *fmt, ...) { +void pd_vmess(t_pd *x, t_symbol *sel, const char *fmt, ...) { va_list ap; t_atom arg[MAXPDARG], *at =arg; int nargs = 0; - char *fp = fmt; + const char *fp = fmt; va_start(ap, fmt); while (1) { if (nargs > MAXPDARG) { @@ -1506,7 +1506,7 @@ void binbuf_clear(t_binbuf *x) { } /* called just after a doublequote in version 1 parsing */ -char *binbuf_text_quoted(t_binbuf *x, char *t, char *end) { +const char *binbuf_text_quoted(t_binbuf *x, const char *t, char *end) { ostringstream buf; while (t!=end) { char c = *t++; @@ -1536,7 +1536,7 @@ char *binbuf_text_quoted(t_binbuf *x, char *t, char *end) { returns pointer to end of atom text */ /* this one is for pd format version 1 */ /* TODO: double-quotes, braces, test backslashes&dollars */ -char *binbuf_text_matju(t_binbuf *x, char *t, char *end) { +const char *binbuf_text_matju(t_binbuf *x, const char *t, const char *end) { int doll=0; while (t!=end && isspace(*t)) t++; if (t==end) return t; @@ -1565,7 +1565,7 @@ char *binbuf_text_matju(t_binbuf *x, char *t, char *end) { } /* this one is for pd format version 0 */ -char *binbuf_text_miller(t_binbuf *x, char *t, char *end) { +const char *binbuf_text_miller(t_binbuf *x, const char *t, const char *end) { ostringstream buf; /* it's an atom other than a comma or semi */ int q = 0, slash = 0, lastslash = 0, dollar = 0; @@ -1612,16 +1612,16 @@ char *binbuf_text_miller(t_binbuf *x, char *t, char *end) { int sys_syntax = 0; -void binbuf_text(t_binbuf *x, char *t, size_t size) { - char *end=t+size; +void binbuf_text(t_binbuf *x, const char *t, size_t size) { + const char *end=t+size; binbuf_clear(x); while (t!=end) t = sys_syntax ? binbuf_text_matju(x,t,end) : binbuf_text_miller(x,t,end); binbuf_capa(x,x->n); } -void pd_eval_text(char *t, size_t size) { +void pd_eval_text(const char *t, size_t size) { t_binbuf *x = binbuf_new(); - char *end = t+size; + const char *end = t+size; while (t!=end) { t = sys_syntax ? binbuf_text_matju(x,t,end) : binbuf_text_miller(x,t,end); if (x->n && x->v[x->n-1].a_type == A_SEMI) { @@ -1684,7 +1684,7 @@ void binbuf_addv(t_binbuf *x, const char *fmt, ...) { va_list ap; t_atom arg[MAXADDMESSV], *at =arg; int nargs = 0; - char *fp = fmt; + const char *fp = fmt; va_start(ap, fmt); while (1) { if (nargs >= MAXADDMESSV) { @@ -1982,7 +1982,7 @@ static int binbuf_doopen(char *s, int mode) { return open(namebuf, mode); } -static FILE *binbuf_dofopen(const char *s, char *mode) { +static FILE *binbuf_dofopen(const char *s, const char *mode) { char namebuf[strlen(s)+1]; sys_bashfilename(s, namebuf); return fopen(namebuf, mode); diff --git a/desiredata/src/m_pd.h b/desiredata/src/m_pd.h index dccf9a11..5ccefd26 100644 --- a/desiredata/src/m_pd.h +++ b/desiredata/src/m_pd.h @@ -444,7 +444,7 @@ EXTERN t_binbuf *binbuf_new(void); EXTERN void binbuf_free(t_binbuf *x); EXTERN t_binbuf *binbuf_duplicate(t_binbuf *y); -EXTERN void binbuf_text(t_binbuf *x, char *text, size_t size); +EXTERN void binbuf_text(t_binbuf *x, const char *text, size_t size); EXTERN void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp); EXTERN char *binbuf_gettext2(t_binbuf *x); EXTERN void binbuf_clear(t_binbuf *x); -- cgit v1.2.1