Changeset 5482:ba865ae62928 in roaraudio


Ignore:
Timestamp:
04/25/12 09:46:25 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

support quoted strings

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5481 r5482  
    1616        * Work around bugs in win32 while using stdvios (pr0). 
    1717        * Added support to load plugins on win32 (pr0). 
     18        * Added support for quotes strings to kv split and 
     19          roardl para argument splitting (pr0). 
    1820 
    1921v. 1.0beta0 - Fri Mar 16 2012 19:39 CET 
  • libroar/keyval.c

    r5381 r5482  
    6565} 
    6666 
     67static inline void skip_char(char * str) { 
     68 memmove(str, str+1, roar_mm_strlen(str)); 
     69} 
     70 
    6771ssize_t              roar_keyval_split  (struct roar_keyval ** kv, char * str, const char * fdel, const char * kdel, int quotes) { 
    6872 struct roar_keyval * kvs; 
     
    7579 if ( kv == NULL || str == NULL ) { 
    7680  roar_err_set(ROAR_ERROR_FAULT); 
    77   return -1; 
    78  } 
    79  
    80  // we currently do not support quotes 
    81  if ( quotes ) { 
    82   roar_err_set(ROAR_ERROR_NOTSUP); 
    8381  return -1; 
    8482 } 
     
    9593   if ( *sp == quote ) 
    9694    quote = 0; 
     95  } else if ( quotes && (*sp == '\'' || *sp == '\"') ) { 
     96   quote = *sp; 
    9797  } else { 
    9898   if ( last_was_seg ) { 
     
    122122 
    123123 for (sp = str; *sp != 0; sp++) { 
     124  if ( quote ) { 
     125   if ( *sp == quote ) { 
     126    skip_char(sp); 
     127    quote = 0; 
     128   } else { 
     129    continue; 
     130   } 
     131  } else if ( quotes && (*sp == '\'' || *sp == '\"') ) { 
     132   quote = *sp; 
     133   skip_char(sp); 
     134   continue; 
     135  } 
     136 
    124137  if ( last_was_seg ) { 
    125138   if ( is_in(*sp, fdel) ) { 
     
    128141   } else { 
    129142    last_was_seg = 1; 
    130     if ( is_in(*sp, kdel) ) { 
     143    if ( kvs[pos].value == NULL && is_in(*sp, kdel) ) { 
    131144     *sp = 0; 
    132145     kvs[pos].value = sp+1; 
  • libroar/roardl.c

    r5481 r5482  
    9595  } 
    9696 
    97   argc = roar_keyval_split(&(ret->argv), ret->args_store, NULL, NULL, 0); 
     97  argc = roar_keyval_split(&(ret->argv), ret->args_store, NULL, NULL, 1); 
    9898  if ( argc == -1 ) { 
    9999   err = roar_error; 
  • roard/hwmixer.c

    r5381 r5482  
    132132 
    133133 if ( subnames != NULL ) { 
    134   subnamekvlen = roar_keyval_split(&subnamekv, subnames, ",;", "=:", 0); 
     134  subnamekvlen = roar_keyval_split(&subnamekv, subnames, ",;", NULL, 1); 
    135135 } 
    136136 
Note: See TracChangeset for help on using the changeset viewer.