Commit 7e096509 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

double size of buffer used in stopgap function "escape_double_quotes"

add note in todo about potential loss of data when > 4096 bytes of data
are entered into a message box and sent to Pd
parent 03a2afc4
...@@ -291,6 +291,21 @@ Everything else: (A [x] means we've fixed it) ...@@ -291,6 +291,21 @@ Everything else: (A [x] means we've fixed it)
[ ] Figure out what pdtk_ping does [ ] Figure out what pdtk_ping does
[ ] Instead of hardcoded gui_post colors, set a class (warning, error, etc.) [ ] Instead of hardcoded gui_post colors, set a class (warning, error, etc.)
[x] make pdsend able to take an arbitrary number of arguments [x] make pdsend able to take an arbitrary number of arguments
[ ] revisit the function for escaping double-quotes inside s_inter.c, see
if there's a cleaner way to do it
[ ] the socket reader has a buffer capped at 4096. This is plenty for most
purposes, but it may choke if the user tries to enter a humongous amount
of text inside, say, a message box. Pd Vanilla handles this by sending
every single character that's typed into the box as a separate message
(which of course causes other problems, like copy/paste potentially flood-
ing the socket and freezing Pd.) Here, I am sending as a single message
"stringforobj" with the msg/obj box contents as the arguments. If that
message ends up being bigger than 4096 Pd will truncate the message.
A solution would be to send the box contents in smaller chunks-- bigger
than single chars but smaller than 4096. This will complicate the
interface, but the chunks should get sent in sequence so it might not
be too bad.
Crashers Crashers
-------- --------
......
...@@ -753,9 +753,9 @@ void sys_gui(const char *s) ...@@ -753,9 +753,9 @@ void sys_gui(const char *s)
} }
char *escape_double_quotes(const char *src) { char *escape_double_quotes(const char *src) {
static char ret[MAXPDSTRING*2+1]; static char ret[MAXPDSTRING*4+1];
char *escaped = ret; char *escaped = ret;
int i, len = MAXPDSTRING*2; int i, len = MAXPDSTRING*4;
for (i = 0; i < len-1 && src[i] != 0; i++) for (i = 0; i < len-1 && src[i] != 0; i++)
{ {
if (src[i] == '\"') if (src[i] == '\"')
...@@ -767,7 +767,7 @@ char *escape_double_quotes(const char *src) { ...@@ -767,7 +767,7 @@ char *escape_double_quotes(const char *src) {
"in a lazy attempt to escape double-quotes for the gui. " "in a lazy attempt to escape double-quotes for the gui. "
"Please call me out publicly for this regression, and/or revise this " "Please call me out publicly for this regression, and/or revise this "
"so it doesn't arbitrarily limit the size of the strings " "so it doesn't arbitrarily limit the size of the strings "
"we can send to the gui."); "we can send to the gui.\n");
return ret; return ret;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment