forked from bartvdbraak/blender
Cleanup: comments (long lines) in utfconv
This commit is contained in:
parent
5b1fcf8833
commit
59fb13c2b1
@ -2,7 +2,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ -15,7 +15,7 @@
|
||||
*
|
||||
* The Original Code is Copyright (C) 2012 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __UTF_WINFUNC_H__
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ -15,7 +15,7 @@
|
||||
*
|
||||
* The Original Code is Copyright (C) 2012 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "utfconv.h"
|
||||
@ -83,22 +83,22 @@ size_t count_utf_16_from_8(const char *string8)
|
||||
count++;
|
||||
u32 = 0;
|
||||
continue;
|
||||
} //1 utf-8 char
|
||||
} // 1 utf-8 char
|
||||
if ((u & 0x07 << 5) == 0xC0) {
|
||||
type = 1;
|
||||
u32 = u & 0x1F;
|
||||
continue;
|
||||
} //2 utf-8 char
|
||||
} // 2 utf-8 char
|
||||
if ((u & 0x0F << 4) == 0xE0) {
|
||||
type = 2;
|
||||
u32 = u & 0x0F;
|
||||
continue;
|
||||
} //3 utf-8 char
|
||||
} // 3 utf-8 char
|
||||
if ((u & 0x1F << 3) == 0xF0) {
|
||||
type = 3;
|
||||
u32 = u & 0x07;
|
||||
continue;
|
||||
} //4 utf-8 char
|
||||
} // 4 utf-8 char
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
@ -204,22 +204,22 @@ int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16)
|
||||
out16++;
|
||||
u32 = 0;
|
||||
continue;
|
||||
} //1 utf-8 char
|
||||
} // 1 utf-8 char
|
||||
if ((u & 0x07 << 5) == 0xC0) {
|
||||
type = 1;
|
||||
u32 = u & 0x1F;
|
||||
continue;
|
||||
} //2 utf-8 char
|
||||
} // 2 utf-8 char
|
||||
if ((u & 0x0F << 4) == 0xE0) {
|
||||
type = 2;
|
||||
u32 = u & 0x0F;
|
||||
continue;
|
||||
} //3 utf-8 char
|
||||
} // 3 utf-8 char
|
||||
if ((u & 0x1F << 3) == 0xF0) {
|
||||
type = 3;
|
||||
u32 = u & 0x07;
|
||||
continue;
|
||||
} //4 utf-8 char
|
||||
} // 4 utf-8 char
|
||||
err |= UTF_ERROR_ILLCHAR;
|
||||
continue;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ -15,7 +15,7 @@
|
||||
*
|
||||
* The Original Code is Copyright (C) 2012 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __UTFCONV_H__
|
||||
@ -81,12 +81,14 @@ char *alloc_utf_8_from_16(const wchar_t *in16, size_t add);
|
||||
/**
|
||||
* Allocates and converts the utf-16 string from utf-8
|
||||
* @param in8 utf-8 string to convert
|
||||
* @param add any additional size which will be allocated for new utf-16 string in wchar_t (two bytes)
|
||||
* @param add any additional size which will be allocated for new utf-16 string
|
||||
* in wchar_t (two bytes)
|
||||
* @return New allocated and converted utf-16 string or NULL if in8 is 0.
|
||||
*/
|
||||
wchar_t *alloc_utf16_from_8(const char *in8, size_t add);
|
||||
|
||||
/* Easy allocation and conversion of new utf-16 string. New string has _16 suffix. Must be deallocated with UTF16_UN_ENCODE in right order*/
|
||||
/* Easy allocation and conversion of new utf-16 string. New string has _16 suffix.
|
||||
* Must be deallocated with UTF16_UN_ENCODE in right order. */
|
||||
#define UTF16_ENCODE(in8str) \
|
||||
if (1) { \
|
||||
wchar_t *in8str##_16 = alloc_utf16_from_8((const char *)in8str, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user