[MPlayer-cvslog] r27118 - trunk/libmenu/menu_filesel.c
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Jun 21 09:41:06 CEST 2008
On Fri, Jun 20, 2008 at 10:36:06PM +0200, ben wrote:
> + if (escape) {
> do {
> - if (*d == '\\' || *d == term)
> + if (*d == '\\')
> l++;
> + else if (*d == '\'') /* ' -> \'\\\'\' */
> + l+=7;
> } while (*d++);
> + }
> r = malloc(l + 1);
> n = r + t1l;
> memcpy(r,title,t1l);
> do {
> - if (*dir == '\\' || *dir == term)
> + if (escape) {
> + if (*dir == '\\')
> *n++ = '\\';
> + else if (*dir == '\'') { /* ' -> \'\\\'\' */
> + *n++ = '\\'; *n++ = '\'';
> + *n++ = '\\'; *n++ = '\\';
> + *n++ = '\\'; *n++ = '\'';
> + *n++ = '\\';
> + }
> + }
> } while ((*n++ = *dir++));
Very confusing and ugly. I would appreciate if you can come up with
something simpler, but if you do not have the time for that at least
use either strcpy or memcpy from a string (depending on whether
the terminating 0 is a problem or not) for the \'\\\'\' part.
Greetings,
Reimar Döffinger
More information about the MPlayer-cvslog
mailing list