return -1;
}
+
+COS_String
+cos_read_string (unsigned char *str, size_t len, size_t start, size_t* endp)
+{
+ size_t i = start;
+ int c;
+
+ if ( (len >= start + 2) && (str[i++] == '"') )
+ {
+ while ( ( i < len )
+ && ( (c = cos_read_utf8 (str, len, i, &i)) >= 0 )
+ )
+ {
+ if ( c == '"' )
+ {
+ return cos_make_string ((char*)&str[1], i - 2);
+ }
+ else if ( c == '\\' )
+ {
+ i++;
+ if ( cos_read_utf8 (str, len, i, &i) < 0 )
+ return NULL;
+ }
+ }
+ }
+ return NULL;
+}