SkAutoAsciiToLC::SkAutoAsciiToLC(constchar str[], size_t len)
{ // see if we need to compute the length if ((long)len < 0) {
len = strlen(str);
}
fLength = len;
// assign lc to our preallocated storage if len is small enough, or allocate // it on the heap char* lc; if (len <= STORAGE) {
lc = fStorage;
} else {
lc = (char*)sk_malloc_throw(len + 1);
}
fLC = lc;
// convert any asii to lower-case. we let non-ascii (utf8) chars pass // through unchanged for (int i = (int)(len - 1); i >= 0; --i) { int c = str[i]; if ((c & 0x80) == 0) { // is just ascii
c = tolower(c);
}
lc[i] = c;
}
lc[len] = 0;
}
SkAutoAsciiToLC::~SkAutoAsciiToLC()
{ if (fLC != fStorage) {
sk_free(fLC);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.