Commit 88388e21 authored by Pierre Ynard's avatar Pierre Ynard

quartztext: don't mangle const string

Untested
parent 5a1c1472
...@@ -741,7 +741,10 @@ static int ProcessNodes( filter_t *p_filter, ...@@ -741,7 +741,10 @@ static int ProcessNodes( filter_t *p_filter,
int len; int len;
// Turn any multiple-whitespaces into single spaces // Turn any multiple-whitespaces into single spaces
char *s = strpbrk( node, "\t\r\n " ); char *dup = strdup( node );
if( !dup )
break;
char *s = strpbrk( dup, "\t\r\n " );
while( s ) while( s )
{ {
int i_whitespace = strspn( s, "\t\r\n " ); int i_whitespace = strspn( s, "\t\r\n " );
...@@ -757,7 +760,7 @@ static int ProcessNodes( filter_t *p_filter, ...@@ -757,7 +760,7 @@ static int ProcessNodes( filter_t *p_filter,
CFMutableAttributedStringRef p_attrnode = CFAttributedStringCreateMutable(kCFAllocatorDefault, 0); CFMutableAttributedStringRef p_attrnode = CFAttributedStringCreateMutable(kCFAllocatorDefault, 0);
p_cfString = CFStringCreateWithCString( NULL, node, kCFStringEncodingUTF8 ); p_cfString = CFStringCreateWithCString( NULL, dup, kCFStringEncodingUTF8 );
CFAttributedStringReplaceString( p_attrnode, CFRangeMake(0, 0), p_cfString ); CFAttributedStringReplaceString( p_attrnode, CFRangeMake(0, 0), p_cfString );
CFRelease( p_cfString ); CFRelease( p_cfString );
len = CFAttributedStringGetLength( p_attrnode ); len = CFAttributedStringGetLength( p_attrnode );
...@@ -771,6 +774,7 @@ static int ProcessNodes( filter_t *p_filter, ...@@ -771,6 +774,7 @@ static int ProcessNodes( filter_t *p_filter,
p_attrnode); p_attrnode);
CFRelease( p_attrnode ); CFRelease( p_attrnode );
free( dup );
break; break;
} }
} }
......
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