Parse a string and replace the scape characters by their meaning characters. * This parser stops when finds the character '\"'. Then replaces '\"' by '\0'. * @param str Pointer to first character. * @retval Pointer to first non white space after the string. If success. * @retval Null pointer if any error occur. */
| 130 | * @retval Pointer to first non white space after the string. If success. |
| 131 | * @retval Null pointer if any error occur. */ |
| 132 | static char* parseString( char* str ) { |
| 133 | unsigned char* head = (unsigned char*)str; |
| 134 | unsigned char* tail = (unsigned char*)str; |
| 135 | for( ; *head >= ' '; ++head, ++tail ) { |
| 136 | if ( *head == '\"' ) { |
| 137 | *tail = '\0'; |
| 138 | return (char*)++head; |
| 139 | } |
| 140 | if ( *head == '\\' ) { |
| 141 | if ( *++head == 'u' ) { |
| 142 | char const ch = getCharFromUnicode( ++head ); |
| 143 | if ( ch == '\0' ) return 0; |
| 144 | *tail = ch; |
| 145 | head += 3; |
| 146 | } |
| 147 | else { |
| 148 | char const esc = getEscape( *head ); |
| 149 | if ( esc == '\0' ) return 0; |
| 150 | *tail = esc; |
| 151 | } |
| 152 | } |
| 153 | else *tail = *head; |
| 154 | } |
| 155 | return 0; |
| 156 | } |
| 157 | |
| 158 | /** Parse a string to get the name of a property. |
| 159 | * @param str Pointer to first character. |
no test coverage detected