Re-ran indent on all .c & .h source code files
Like so --
find . -name "*.c" -or -name "*.h" -exec indent -nbfda -npcs -npsl -bli0 --no-tabs {} \;
The `indent` invocation differs from the last one noted in
CHANGES.txt (from 2006!?), in that I've added "--no-tabs",
to ensure indents are all space-based.
This commit is contained in:
parent
09f332367f
commit
cc05925d9e
99 changed files with 31659 additions and 27102 deletions
|
|
@ -30,58 +30,67 @@
|
|||
#include <string.h>
|
||||
|
||||
// This implementation may be simple, but can work fine for all of Android devices
|
||||
size_t mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n){
|
||||
int length = strnlen (s, n);
|
||||
// w is the index of pwcs, s is the index of s
|
||||
int w = 0, c = 0;
|
||||
size_t mbstowcs(wchar_t *__restrict pwcs, const char *__restrict s, size_t n)
|
||||
{
|
||||
int length = strnlen(s, n);
|
||||
// w is the index of pwcs, s is the index of s
|
||||
int w = 0, c = 0;
|
||||
|
||||
while (1) {
|
||||
pwcs[w] = '\0';
|
||||
char first = s[c];
|
||||
int len = 0;
|
||||
if ((first & 0x80) == 0) {
|
||||
pwcs[w] = (wchar_t)s[c];
|
||||
len = 1;
|
||||
}
|
||||
else if ((first & 0xe0) == 0xc0) {
|
||||
pwcs[w] |= first & 0x1f;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c+1] & 0x3f;
|
||||
len = 2;
|
||||
}
|
||||
else if ((first & 0xf0) == 0xe0) {
|
||||
pwcs[w] |= first & 0x0f;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c+1] & 0x3f;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c+2] & 0x3f;
|
||||
len = 3;
|
||||
}
|
||||
else if ((first & 0xf8) == 0xf0) {
|
||||
pwcs[w] |= first & 0x07;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c+1] & 0x3f;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c+2] & 0x3f;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c+3] & 0x3f;
|
||||
len = 4;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
pwcs[w] = '\0';
|
||||
char first = s[c];
|
||||
int len = 0;
|
||||
if ((first & 0x80) == 0)
|
||||
{
|
||||
pwcs[w] = (wchar_t) s[c];
|
||||
len = 1;
|
||||
}
|
||||
else if ((first & 0xe0) == 0xc0)
|
||||
{
|
||||
pwcs[w] |= first & 0x1f;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c + 1] & 0x3f;
|
||||
len = 2;
|
||||
}
|
||||
else if ((first & 0xf0) == 0xe0)
|
||||
{
|
||||
pwcs[w] |= first & 0x0f;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c + 1] & 0x3f;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c + 2] & 0x3f;
|
||||
len = 3;
|
||||
}
|
||||
else if ((first & 0xf8) == 0xf0)
|
||||
{
|
||||
pwcs[w] |= first & 0x07;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c + 1] & 0x3f;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c + 2] & 0x3f;
|
||||
pwcs[w] <<= 6;
|
||||
pwcs[w] |= s[c + 3] & 0x3f;
|
||||
len = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
c += len;
|
||||
w++;
|
||||
c += len;
|
||||
w++;
|
||||
|
||||
if (c > length){
|
||||
pwcs[w] = '\0';
|
||||
return -1;
|
||||
}
|
||||
if (c == length){
|
||||
pwcs[w] = '\0';
|
||||
return w;
|
||||
}
|
||||
}
|
||||
if (c > length)
|
||||
{
|
||||
pwcs[w] = '\0';
|
||||
return -1;
|
||||
}
|
||||
if (c == length)
|
||||
{
|
||||
pwcs[w] = '\0';
|
||||
return w;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue