That seems to fix it!
This commit is contained in:
parent
eb49ca4e2d
commit
86319fd1c3
|
@ -260,11 +260,11 @@ int index_of( char c, char *s ) {
|
|||
char *trim( char *s ) {
|
||||
int i;
|
||||
|
||||
for ( i = strlen( s ); ( isblank( s[i] ) || iscntrl( s[i] ) ) && i > -1;
|
||||
for ( i = strlen( s ); ( isblank( s[i] ) || iscntrl( s[i] ) ) && i >= 0;
|
||||
i-- ) {
|
||||
s[i] = ( char ) 0;
|
||||
}
|
||||
for ( i = 0; isblank( s[i] ) && s[i] != 0; i++ );
|
||||
for ( i = 0; ( isblank( s[i] ) || iscntrl( s[i] ) ) && s[i] != 0; i++ );
|
||||
|
||||
return ( char * ) &s[i];
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ static size_t write_meta_callback( char *string, size_t size, size_t nmemb,
|
|||
|
||||
if ( offset != -1 ) {
|
||||
s[offset] = ( char ) 0;
|
||||
char *name = s;
|
||||
char *name = trim( s );
|
||||
char *value = trim( &s[++offset] );
|
||||
wchar_t *wname = calloc( strlen( name ), sizeof( wchar_t ) );
|
||||
wchar_t *wvalue = calloc( strlen( value ), sizeof( wchar_t ) );
|
||||
|
|
|
@ -323,19 +323,18 @@ struct cons_pointer make_write_stream( URL_FILE * output,
|
|||
}
|
||||
|
||||
/**
|
||||
* Return a lisp keyword representation of this wide character string.
|
||||
* Return a lisp keyword representation of this wide character string. In keywords,
|
||||
* I am accepting only lower case characters and numbers.
|
||||
*/
|
||||
struct cons_pointer c_string_to_lisp_keyword( wchar_t *symbol ) {
|
||||
struct cons_pointer result = NIL;
|
||||
|
||||
for (int i = 0; symbol[i] != '\0'; i++) {
|
||||
if(iswalpha(symbol[i] && !iswlower(symbol[i]))) {
|
||||
symbol[i] = towlower(symbol[i]);
|
||||
}
|
||||
}
|
||||
for ( int i = wcslen( symbol ) -1; i >= 0; i-- ) {
|
||||
wchar_t c = towlower(symbol[i]);
|
||||
|
||||
for ( int i = wcslen( symbol ); i > 0; i-- ) {
|
||||
result = make_keyword( symbol[i - 1], result );
|
||||
if (iswalnum(c) || c == L'-') {
|
||||
result = make_keyword( c, result );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -347,8 +346,10 @@ struct cons_pointer c_string_to_lisp_keyword( wchar_t *symbol ) {
|
|||
struct cons_pointer c_string_to_lisp_string( wchar_t *string ) {
|
||||
struct cons_pointer result = NIL;
|
||||
|
||||
for ( int i = wcslen( string ); i > 0; i-- ) {
|
||||
result = make_string( string[i - 1], result );
|
||||
for ( int i = wcslen( string ) - 1; i >= 0; i-- ) {
|
||||
if (iswprint(string[i]) && string[i] != '"') {
|
||||
result = make_string( string[i], result );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue