summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWincent Balin <wincent@rockbox.org>2009-08-04 13:52:43 +0000
committerWincent Balin <wincent@rockbox.org>2009-08-04 13:52:43 +0000
commit7996e773340698a6d8c7bcdc465b8a9245f65601 (patch)
tree71d9f0d790cda97f7d9f9e23877007c72c96c4ed
parent28fbb49c0bfe44142eb36b3891d4d28021a1b277 (diff)
downloadrockbox-7996e773340698a6d8c7bcdc465b8a9245f65601.tar.gz
rockbox-7996e773340698a6d8c7bcdc465b8a9245f65601.zip
PDBox: Use correct values of maximal string size for snprintf.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22154 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/pdbox/PDa/src/g_all_guis.c13
-rw-r--r--apps/plugins/pdbox/PDa/src/g_array.c2
-rw-r--r--apps/plugins/pdbox/PDa/src/g_canvas.c10
-rw-r--r--apps/plugins/pdbox/PDa/src/g_editor.c2
-rw-r--r--apps/plugins/pdbox/PDa/src/g_graph.c4
-rw-r--r--apps/plugins/pdbox/PDa/src/g_template.c2
-rw-r--r--apps/plugins/pdbox/PDa/src/g_text.c2
-rw-r--r--apps/plugins/pdbox/PDa/src/m_atom.c4
-rw-r--r--apps/plugins/pdbox/PDa/src/m_binbuf.c12
-rw-r--r--apps/plugins/pdbox/PDa/src/m_fixed.c2
10 files changed, 25 insertions, 28 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_all_guis.c b/apps/plugins/pdbox/PDa/src/g_all_guis.c
index 165c9ac14f..c2002a7a4d 100644
--- a/apps/plugins/pdbox/PDa/src/g_all_guis.c
+++ b/apps/plugins/pdbox/PDa/src/g_all_guis.c
@@ -203,8 +203,8 @@ t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv)
203 { 203 {
204 char str[80]; 204 char str[80];
205#ifdef ROCKBOX 205#ifdef ROCKBOX
206 snprintf(str, sizeof(str)-1, 206 snprintf(str, sizeof(str), "%d",
207 "%d", (int)atom_getintarg(indx, 100000, argv)); 207 (int) atom_getintarg(indx, 100000, argv));
208#else 208#else
209 sprintf(str, "%d", (int)atom_getintarg(indx, 100000, argv)); 209 sprintf(str, "%d", (int)atom_getintarg(indx, 100000, argv));
210#endif 210#endif
@@ -623,8 +623,7 @@ int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv)
623 else if(IS_A_FLOAT(argv,7)) 623 else if(IS_A_FLOAT(argv,7))
624 { 624 {
625#ifdef ROCKBOX 625#ifdef ROCKBOX
626 snprintf(str, sizeof(str)-1, 626 snprintf(str, sizeof(str), "%d", (int) atom_getintarg(7, argc, argv));
627 "%d", (int)atom_getintarg(7, argc, argv));
628#else 627#else
629 sprintf(str, "%d", (int)atom_getintarg(7, argc, argv)); 628 sprintf(str, "%d", (int)atom_getintarg(7, argc, argv));
630#endif 629#endif
@@ -635,8 +634,7 @@ int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv)
635 else if(IS_A_FLOAT(argv,8)) 634 else if(IS_A_FLOAT(argv,8))
636 { 635 {
637#ifdef ROCKBOX 636#ifdef ROCKBOX
638 snprintf(str, sizeof(str)-1, 637 snprintf(str, sizeof(str), "%d", (int) atom_getintarg(8, argc, argv));
639 "%d", (int)atom_getintarg(8, argc, argv));
640#else 638#else
641 sprintf(str, "%d", (int)atom_getintarg(8, argc, argv)); 639 sprintf(str, "%d", (int)atom_getintarg(8, argc, argv));
642#endif 640#endif
@@ -647,8 +645,7 @@ int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv)
647 else if(IS_A_FLOAT(argv,9)) 645 else if(IS_A_FLOAT(argv,9))
648 { 646 {
649#ifdef ROCKBOX 647#ifdef ROCKBOX
650 snprintf(str, sizeof(str)-1, 648 snprintf(str, sizeof(str), "%d", (int) atom_getintarg(9, argc, argv));
651 "%d", (int)atom_getintarg(9, argc, argv));
652#else 649#else
653 sprintf(str, "%d", (int)atom_getintarg(9, argc, argv)); 650 sprintf(str, "%d", (int)atom_getintarg(9, argc, argv));
654#endif 651#endif
diff --git a/apps/plugins/pdbox/PDa/src/g_array.c b/apps/plugins/pdbox/PDa/src/g_array.c
index b6870b6117..c98e640e94 100644
--- a/apps/plugins/pdbox/PDa/src/g_array.c
+++ b/apps/plugins/pdbox/PDa/src/g_array.c
@@ -150,7 +150,7 @@ t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *templatesym,
150 { 150 {
151 char buf[40]; 151 char buf[40];
152#ifdef ROCKBOX 152#ifdef ROCKBOX
153 snprintf(buf, sizeof(buf)-1, "array%d", ++gcount); 153 snprintf(buf, sizeof(buf), "array%d", ++gcount);
154#else 154#else
155 sprintf(buf, "array%d", ++gcount); 155 sprintf(buf, "array%d", ++gcount);
156#endif 156#endif
diff --git a/apps/plugins/pdbox/PDa/src/g_canvas.c b/apps/plugins/pdbox/PDa/src/g_canvas.c
index 19c10474c1..fde19461d0 100644
--- a/apps/plugins/pdbox/PDa/src/g_canvas.c
+++ b/apps/plugins/pdbox/PDa/src/g_canvas.c
@@ -94,8 +94,8 @@ static void glist_doupdatewindowlist(t_glist *gl, char *sbuf)
94 { 94 {
95 char tbuf[1024]; 95 char tbuf[1024];
96#ifdef ROCKBOX 96#ifdef ROCKBOX
97 snprintf(tbuf, sizeof(tbuf)-1, 97 snprintf(tbuf, sizeof(tbuf),
98 "{%s .x%x} ", gl->gl_name->s_name, (t_int)canvas); 98 "{%s .x%x} ", gl->gl_name->s_name, (t_int) canvas);
99#else /* ROCKBOX */ 99#else /* ROCKBOX */
100 sprintf(tbuf, "{%s .x%x} ", gl->gl_name->s_name, (t_int)canvas); 100 sprintf(tbuf, "{%s .x%x} ", gl->gl_name->s_name, (t_int)canvas);
101#endif /* ROCKBOX */ 101#endif /* ROCKBOX */
@@ -483,7 +483,7 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym,
483 { 483 {
484 char buf[40]; 484 char buf[40];
485#ifdef ROCKBOX 485#ifdef ROCKBOX
486 snprintf(buf, sizeof(buf)-1, "graph%d", ++gcount); 486 snprintf(buf, sizeof(buf), "graph%d", ++gcount);
487#else /* ROCKBOX */ 487#else /* ROCKBOX */
488 sprintf(buf, "graph%d", ++gcount); 488 sprintf(buf, "graph%d", ++gcount);
489#endif /* ROCKBOX */ 489#endif /* ROCKBOX */
@@ -712,7 +712,7 @@ static t_editor *editor_new(t_glist *owner)
712 x->e_deleted = binbuf_new(); 712 x->e_deleted = binbuf_new();
713 x->e_glist = owner; 713 x->e_glist = owner;
714#ifdef ROCKBOX 714#ifdef ROCKBOX
715 snprintf(buf, sizeof(buf)-1, ".x%x", (t_int)owner); 715 snprintf(buf, sizeof(buf), ".x%x", (t_int)owner);
716#else /* ROCKBOX */ 716#else /* ROCKBOX */
717 sprintf(buf, ".x%x", (t_int)owner); 717 sprintf(buf, ".x%x", (t_int)owner);
718#endif /* ROCKBOX */ 718#endif /* ROCKBOX */
@@ -1237,7 +1237,7 @@ static void *table_new(t_symbol *s, t_floatarg f)
1237 char tabname[255]; 1237 char tabname[255];
1238 t_symbol *t = gensym("table"); 1238 t_symbol *t = gensym("table");
1239#ifdef ROCKBOX 1239#ifdef ROCKBOX
1240 snprintf(tabname, sizeof(tabname)-1, "%s%d", t->s_name, tabcount++); 1240 snprintf(tabname, sizeof(tabname), "%s%d", t->s_name, tabcount++);
1241#else /* ROCKBOX */ 1241#else /* ROCKBOX */
1242 sprintf(tabname, "%s%d", t->s_name, tabcount++); 1242 sprintf(tabname, "%s%d", t->s_name, tabcount++);
1243#endif /* ROCKBOX */ 1243#endif /* ROCKBOX */
diff --git a/apps/plugins/pdbox/PDa/src/g_editor.c b/apps/plugins/pdbox/PDa/src/g_editor.c
index a5cce20e10..0b3e348c90 100644
--- a/apps/plugins/pdbox/PDa/src/g_editor.c
+++ b/apps/plugins/pdbox/PDa/src/g_editor.c
@@ -1481,7 +1481,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
1481 { 1481 {
1482 char buf[3]; 1482 char buf[3];
1483#ifdef ROCKBOX 1483#ifdef ROCKBOX
1484 snprintf(buf, sizeof(buf)-1, "%c", (int)(av[1].a_w.w_float)); 1484 snprintf(buf, sizeof(buf), "%c", (int) (av[1].a_w.w_float));
1485#else /* ROCKBOX */ 1485#else /* ROCKBOX */
1486 sprintf(buf, "%c", (int)(av[1].a_w.w_float)); 1486 sprintf(buf, "%c", (int)(av[1].a_w.w_float));
1487#endif /* ROCKBOX */ 1487#endif /* ROCKBOX */
diff --git a/apps/plugins/pdbox/PDa/src/g_graph.c b/apps/plugins/pdbox/PDa/src/g_graph.c
index a3d1798733..cccf8823eb 100644
--- a/apps/plugins/pdbox/PDa/src/g_graph.c
+++ b/apps/plugins/pdbox/PDa/src/g_graph.c
@@ -90,7 +90,7 @@ void glist_delete(t_glist *x, t_gobj *y)
90 { 90 {
91 char tag[80]; 91 char tag[80];
92#ifdef ROCKBOX 92#ifdef ROCKBOX
93 snprintf(tag, sizeof(tag)-1, "graph%x", (int)gl); 93 snprintf(tag, sizeof(tag), "graph%x", (int) gl);
94#else /* ROCKBOX */ 94#else /* ROCKBOX */
95 sprintf(tag, "graph%x", (int)gl); 95 sprintf(tag, "graph%x", (int)gl);
96#endif /* ROCKBOX */ 96#endif /* ROCKBOX */
@@ -687,7 +687,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
687 rtext_erase(glist_findrtext(parent_glist, &x->gl_obj)); 687 rtext_erase(glist_findrtext(parent_glist, &x->gl_obj));
688 688
689#ifdef ROCKBOX 689#ifdef ROCKBOX
690 snprintf(tag, sizeof(tag)-1, "graph%x", (int) x); 690 snprintf(tag, sizeof(tag), "graph%x", (int) x);
691#else 691#else
692 sprintf(tag, "graph%x", (int)x); 692 sprintf(tag, "graph%x", (int)x);
693#endif 693#endif
diff --git a/apps/plugins/pdbox/PDa/src/g_template.c b/apps/plugins/pdbox/PDa/src/g_template.c
index deb47c3129..413b7284c1 100644
--- a/apps/plugins/pdbox/PDa/src/g_template.c
+++ b/apps/plugins/pdbox/PDa/src/g_template.c
@@ -929,7 +929,7 @@ static void numbertocolor(int n, char *s)
929 blue = ((n / 10) % 10); 929 blue = ((n / 10) % 10);
930 green = n % 10; 930 green = n % 10;
931#ifdef ROCKBOX 931#ifdef ROCKBOX
932 snprintf(s, 8, "#%2.2x%2.2x%2.2x", 932 snprintf(s, 10, "#%2.2x%2.2x%2.2x",
933 rangecolor(red), rangecolor(blue), rangecolor(green)); 933 rangecolor(red), rangecolor(blue), rangecolor(green));
934#else 934#else
935 sprintf(s, "#%2.2x%2.2x%2.2x", rangecolor(red), rangecolor(blue), 935 sprintf(s, "#%2.2x%2.2x%2.2x", rangecolor(red), rangecolor(blue),
diff --git a/apps/plugins/pdbox/PDa/src/g_text.c b/apps/plugins/pdbox/PDa/src/g_text.c
index 98b3fb74f8..ab9f93d80f 100644
--- a/apps/plugins/pdbox/PDa/src/g_text.c
+++ b/apps/plugins/pdbox/PDa/src/g_text.c
@@ -712,7 +712,7 @@ static void gatom_key(void *z, t_floatarg f)
712redraw: 712redraw:
713 /* LATER figure out how to avoid creating all these symbols! */ 713 /* LATER figure out how to avoid creating all these symbols! */
714#ifdef ROCKBOX 714#ifdef ROCKBOX
715 snprintf(sbuf, sizeof(sbuf)-1, "%s...", x->a_buf); 715 snprintf(sbuf, sizeof(sbuf), "%s...", x->a_buf);
716#else /* ROCKBOX */ 716#else /* ROCKBOX */
717 sprintf(sbuf, "%s...", x->a_buf); 717 sprintf(sbuf, "%s...", x->a_buf);
718#endif 718#endif
diff --git a/apps/plugins/pdbox/PDa/src/m_atom.c b/apps/plugins/pdbox/PDa/src/m_atom.c
index 4d30c1b3de..e49c6ae478 100644
--- a/apps/plugins/pdbox/PDa/src/m_atom.c
+++ b/apps/plugins/pdbox/PDa/src/m_atom.c
@@ -134,10 +134,10 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize)
134 } 134 }
135 break; 135 break;
136 case A_DOLLAR: 136 case A_DOLLAR:
137 snprintf(buf, bufsize-1, "$%d", a->a_w.w_index); 137 snprintf(buf, bufsize, "$%d", a->a_w.w_index);
138 break; 138 break;
139 case A_DOLLSYM: 139 case A_DOLLSYM:
140 snprintf(buf, bufsize-1, "$%s", a->a_w.w_symbol->s_name); 140 snprintf(buf, bufsize, "$%s", a->a_w.w_symbol->s_name);
141 break; 141 break;
142 default: 142 default:
143 bug("atom_string"); 143 bug("atom_string");
diff --git a/apps/plugins/pdbox/PDa/src/m_binbuf.c b/apps/plugins/pdbox/PDa/src/m_binbuf.c
index 224d269559..28620bfd22 100644
--- a/apps/plugins/pdbox/PDa/src/m_binbuf.c
+++ b/apps/plugins/pdbox/PDa/src/m_binbuf.c
@@ -325,7 +325,7 @@ void binbuf_addbinbuf(t_binbuf *x, t_binbuf *y)
325 break; 325 break;
326 case A_DOLLAR: 326 case A_DOLLAR:
327#ifdef ROCKBOX 327#ifdef ROCKBOX
328 snprintf(tbuf, sizeof(tbuf)-1, "$%d", ap->a_w.w_index); 328 snprintf(tbuf, sizeof(tbuf), "$%d", ap->a_w.w_index);
329#else /* ROCKBOX */ 329#else /* ROCKBOX */
330 sprintf(tbuf, "$%d", ap->a_w.w_index); 330 sprintf(tbuf, "$%d", ap->a_w.w_index);
331#endif /* ROCKBOX */ 331#endif /* ROCKBOX */
@@ -333,7 +333,7 @@ void binbuf_addbinbuf(t_binbuf *x, t_binbuf *y)
333 break; 333 break;
334 case A_DOLLSYM: 334 case A_DOLLSYM:
335#ifdef ROCKBOX 335#ifdef ROCKBOX
336 snprintf(tbuf, sizeof(tbuf)-1, "$%s", ap->a_w.w_symbol->s_name); 336 snprintf(tbuf, sizeof(tbuf), "$%s", ap->a_w.w_symbol->s_name);
337#else /* ROCKBOX */ 337#else /* ROCKBOX */
338 sprintf(tbuf, "$%s", ap->a_w.w_symbol->s_name); 338 sprintf(tbuf, "$%s", ap->a_w.w_symbol->s_name);
339#endif /* ROCKBOX */ 339#endif /* ROCKBOX */
@@ -457,14 +457,14 @@ t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, int tonew)
457 if (!tonew) 457 if (!tonew)
458 return (0); 458 return (0);
459#ifdef ROCKBOX 459#ifdef ROCKBOX
460 else snprintf(buf, sizeof(buf)-1, "$%d", argno); 460 else snprintf(buf, sizeof(buf), "$%d", argno);
461#else /* ROCKBOX */ 461#else /* ROCKBOX */
462 else sprintf(buf, "$%d", argno); 462 else sprintf(buf, "$%d", argno);
463#endif /* ROCKBOX */ 463#endif /* ROCKBOX */
464 } 464 }
465 else if (argno == 0) 465 else if (argno == 0)
466#ifdef ROCKBOX 466#ifdef ROCKBOX
467 snprintf(buf, sizeof(buf)-1, "%d", canvas_getdollarzero()); 467 snprintf(buf, sizeof(buf), "%d", canvas_getdollarzero());
468#else /* ROCKBOX */ 468#else /* ROCKBOX */
469 sprintf(buf, "%d", canvas_getdollarzero()); 469 sprintf(buf, "%d", canvas_getdollarzero());
470#endif /* ROCKBOX */ 470#endif /* ROCKBOX */
@@ -908,7 +908,7 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd)
908 { 908 {
909 char buf[100]; 909 char buf[100];
910#ifdef ROCKBOX 910#ifdef ROCKBOX
911 snprintf(buf, sizeof(buf)-1, "$%d", nextmess[i].a_w.w_index); 911 snprintf(buf, sizeof(buf), "$%d", nextmess[i].a_w.w_index);
912#else /* ROCKBOX */ 912#else /* ROCKBOX */
913 sprintf(buf, "$%d", nextmess[i].a_w.w_index); 913 sprintf(buf, "$%d", nextmess[i].a_w.w_index);
914#endif /* ROCKBOX */ 914#endif /* ROCKBOX */
@@ -918,7 +918,7 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd)
918 { 918 {
919 char buf[100]; 919 char buf[100];
920#ifdef ROCKBOX 920#ifdef ROCKBOX
921 snprintf(buf, sizeof(buf)-1, "$%s", nextmess[i].a_w.w_symbol->s_name); 921 snprintf(buf, sizeof(buf), "$%s", nextmess[i].a_w.w_symbol->s_name);
922#else /* ROCKBOX */ 922#else /* ROCKBOX */
923 sprintf(buf, "$%s", nextmess[i].a_w.w_symbol->s_name); 923 sprintf(buf, "$%s", nextmess[i].a_w.w_symbol->s_name);
924#endif /* ROCKBOX */ 924#endif /* ROCKBOX */
diff --git a/apps/plugins/pdbox/PDa/src/m_fixed.c b/apps/plugins/pdbox/PDa/src/m_fixed.c
index 374f92cbca..9e47364bab 100644
--- a/apps/plugins/pdbox/PDa/src/m_fixed.c
+++ b/apps/plugins/pdbox/PDa/src/m_fixed.c
@@ -90,7 +90,7 @@ static void ipod_bang(t_ipod *x)
90{ 90{
91 static char sendme[200]; 91 static char sendme[200];
92#ifdef ROCKBOX 92#ifdef ROCKBOX
93 snprintf(sendme, sizeof(sendme)-1, "%s bang;\n", x->x_what->s_name); 93 snprintf(sendme, sizeof(sendme), "%s bang;\n", x->x_what->s_name);
94 SEND_FROM_CORE(sendme); 94 SEND_FROM_CORE(sendme);
95#else /* ROCKBOX */ 95#else /* ROCKBOX */
96 sprintf(sendme,"%s bang;\n",x->x_what->s_name); 96 sprintf(sendme,"%s bang;\n",x->x_what->s_name);