want = 1; while (count >= want) { /* Copy some UTF-8 piece from userland */
bytes = min(count, sizeof(buf)); if (copy_from_user(buf, ptr, bytes)) return -EFAULT;
/* Convert to u16 */ for (in = 0, out = 0; in < bytes; in += consumed) {
s32 value;
value = synth_utf8_get(buf + in, bytes - in, &consumed, &want); if (value == -1) { /* Invalid or incomplete */
if (want > bytes - in) /* We don't have it all yet, stop here * and wait for the rest
*/
bytes = in;
continue;
}
if (value < 0x10000)
ubuf[out++] = value;
}
count -= bytes;
ptr += bytes;
/* And speak this up */ if (out) {
spin_lock_irqsave(&speakup_info.spinlock, flags); for (in = 0; in < out; in++)
synth_buffer_add(ubuf[in]);
synth_start();
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
}
}
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.