[445] in BarnOwl Developers
[D-O-H] r575 - in trunk: . owl
daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:06:14 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
Date: Mon, 29 Jan 2007 23:02:02 -0500
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU
Author: nelhage
Date: 2007-01-29 23:02:02 -0500 (Mon, 29 Jan 2007)
New Revision: 575
Modified:
trunk/
trunk/owl/text.c
Log:
r18210@phanatique: nelhage | 2007-01-29 23:01:58 -0500
owl_text_quote no longer blows up if the string contains too many
characters that need quoting.
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- bb873fd7-8e23-0410-944a-99ec44c633eb:/branches/owl/filter-rewrite:15925
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/trunk:18208
+ bb873fd7-8e23-0410-944a-99ec44c633eb:/branches/owl/filter-rewrite:15925
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/trunk:18210
Modified: trunk/owl/text.c
===================================================================
--- trunk/owl/text.c 2007-01-30 03:37:47 UTC (rev 574)
+++ trunk/owl/text.c 2007-01-30 04:02:02 UTC (rev 575)
@@ -367,7 +367,7 @@
*/
char *owl_text_quote(char *in, char *toquote, char *quotestr)
{
- int i, x, r, place;
+ int i, x, r, place, escape;
int in_len, toquote_len, quotestr_len;
char *out;
@@ -376,7 +376,13 @@
quotestr_len=strlen(quotestr);
out=owl_malloc((in_len*quotestr_len)+30);
place=0;
+ escape = 0;
for (i=0; i<in_len; i++) {
+ if(strchr(toquote, in[i]) != NULL)
+ escape++;
+ }
+ out = owl_malloc(in_len + quotestr_len*escape+1);
+ for (i=0; i<in_len; i++) {
/* check if it's a character that needs quoting */
for (x=0; x<toquote_len; x++) {