Warning Fixes - const correctness in unicode encoding, unused variables in blenlib, and some type conversions
This is from a patch that is in the tracker, but it leaves out a fix of BLI_gzopen which needs more work.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "utfconv.h"
|
||||
|
||||
size_t count_utf_8_from_16(wchar_t * string16)
|
||||
size_t count_utf_8_from_16(const wchar_t * string16)
|
||||
{
|
||||
int i;
|
||||
size_t count = 0;
|
||||
@@ -50,7 +50,7 @@ size_t count_utf_8_from_16(wchar_t * string16)
|
||||
}
|
||||
|
||||
|
||||
size_t count_utf_16_from_8(char * string8)
|
||||
size_t count_utf_16_from_8(const char * string8)
|
||||
{
|
||||
size_t count = 0;
|
||||
char u;
|
||||
@@ -88,7 +88,7 @@ size_t count_utf_16_from_8(char * string8)
|
||||
|
||||
|
||||
|
||||
int conv_utf_16_to_8(wchar_t * in16, char * out8, size_t size8)
|
||||
int conv_utf_16_to_8(const wchar_t * in16, char * out8, size_t size8)
|
||||
{
|
||||
char * out8end = out8+size8;
|
||||
wchar_t u = 0;
|
||||
@@ -139,7 +139,7 @@ int conv_utf_16_to_8(wchar_t * in16, char * out8, size_t size8)
|
||||
}
|
||||
|
||||
|
||||
int conv_utf_8_to_16(char * in8, wchar_t * out16, size_t size16)
|
||||
int conv_utf_8_to_16(const char * in8, wchar_t * out16, size_t size16)
|
||||
{
|
||||
char u;
|
||||
char type = 0;
|
||||
@@ -186,7 +186,7 @@ int conv_utf_8_to_16(char * in8, wchar_t * out16, size_t size16)
|
||||
return err;
|
||||
}
|
||||
|
||||
int is_ascii(char * in8)
|
||||
int is_ascii(const char * in8)
|
||||
{
|
||||
for(in8; *in8; in8++)
|
||||
if(0x80 & *in8) return 0;
|
||||
@@ -210,7 +210,7 @@ void utf_8_cut_end(char * inout8, size_t maxcutpoint)
|
||||
|
||||
|
||||
|
||||
char * alloc_utf_8_from_16(wchar_t * in16, size_t add)
|
||||
char * alloc_utf_8_from_16(const wchar_t * in16, size_t add)
|
||||
{
|
||||
size_t bsize = count_utf_8_from_16(in16);
|
||||
char * out8 = NULL;
|
||||
@@ -220,7 +220,7 @@ char * alloc_utf_8_from_16(wchar_t * in16, size_t add)
|
||||
return out8;
|
||||
}
|
||||
|
||||
wchar_t * alloc_utf16_from_8(char * in8, size_t add)
|
||||
wchar_t * alloc_utf16_from_8(const char * in8, size_t add)
|
||||
{
|
||||
size_t bsize = count_utf_16_from_8(in8);
|
||||
wchar_t * out16 = NULL;
|
||||
|
@@ -38,14 +38,14 @@ extern "C" {
|
||||
* @param string-16 pointer to working utf-16 string
|
||||
* @return How many bytes must be allocated includeng NULL.
|
||||
*/
|
||||
size_t count_utf_8_from_16(wchar_t * string16);
|
||||
size_t count_utf_8_from_16(const wchar_t * string16);
|
||||
|
||||
/**
|
||||
* Counts how many wchar_t (two byte) is requered for for future utf-16 string using utf-8
|
||||
* @param string-8 pointer to working utf-8 string
|
||||
* @return How many bytes must be allocated includeng NULL.
|
||||
*/
|
||||
size_t count_utf_16_from_8(char * string8);
|
||||
size_t count_utf_16_from_8(const char * string8);
|
||||
|
||||
/**
|
||||
* conv_utf_*** errors
|
||||
@@ -62,7 +62,7 @@ size_t count_utf_16_from_8(char * string8);
|
||||
* @params size8 the allocated size in bytes of out8
|
||||
* @return Returns any errors occured during conversion. See the block above,
|
||||
*/
|
||||
int conv_utf_16_to_8(wchar_t * in16, char * out8, size_t size8);
|
||||
int conv_utf_16_to_8(const wchar_t * in16, char * out8, size_t size8);
|
||||
|
||||
/**
|
||||
* Converts utf-8 string to allocated utf-16 string
|
||||
@@ -71,7 +71,7 @@ int conv_utf_16_to_8(wchar_t * in16, char * out8, size_t size8);
|
||||
* @params size16 the allocated size in wchar_t (two byte) of out16
|
||||
* @return Returns any errors occured during conversion. See the block above,
|
||||
*/
|
||||
int conv_utf_8_to_16(char * in8, wchar_t * out16, size_t size16);
|
||||
int conv_utf_8_to_16(const char * in8, wchar_t * out16, size_t size16);
|
||||
|
||||
|
||||
/**
|
||||
@@ -80,7 +80,7 @@ int conv_utf_8_to_16(char * in8, wchar_t * out16, size_t size16);
|
||||
* @params add any additional size which will be allocated for new utf-8 string in bytes
|
||||
* @return New allocated and converted utf-8 string or NULL if in16 is 0.
|
||||
*/
|
||||
char * alloc_utf_8_from_16(wchar_t * in16, size_t add);
|
||||
char * alloc_utf_8_from_16(const wchar_t * in16, size_t add);
|
||||
|
||||
/**
|
||||
* Allocates and converts the utf-16 string from utf-8
|
||||
@@ -88,7 +88,7 @@ char * alloc_utf_8_from_16(wchar_t * in16, size_t add);
|
||||
* @params 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(char * in8, size_t add);
|
||||
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*/
|
||||
#define UTF16_ENCODE(in8str) if(1){\
|
||||
|
Reference in New Issue
Block a user