Sprinkle some const in components/to_utf8

dont-compose-content
jvoisin 4 years ago
parent 00c41e55a4
commit 2c3c603be2

@ -45,7 +45,7 @@ void writeMissing(bool last)
int write_table(const std::string &charset, const std::string &tableName)
{
// Write table header
std::cout << "static signed char " << tableName << "[] =\n{\n";
std::cout << "const static signed char " << tableName << "[] =\n{\n";
// Open conversion system
iconv_t cd = iconv_open ("UTF-8", charset.c_str());

@ -8,7 +8,7 @@ namespace ToUTF8
/// Central European and Eastern European languages that use Latin script,
/// such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian,
/// Serbian (Latin script), Romanian and Albanian.
static signed char windows_1250[] =
const static signed char windows_1250[] =
{
1, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0,
@ -270,7 +270,7 @@ static signed char windows_1250[] =
/// Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic
/// and other languages
static signed char windows_1251[] =
const static signed char windows_1251[] =
{
1, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0,
@ -531,7 +531,7 @@ static signed char windows_1251[] =
};
/// Latin alphabet used by English and some other Western languages
static signed char windows_1252[] =
const static signed char windows_1252[] =
{
1, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0,
@ -790,7 +790,7 @@ static signed char windows_1252[] =
2, -61, -66, 0, 0, 0,
2, -61, -65, 0, 0, 0
};
static signed char cp437[] =
const static signed char cp437[] =
{
1, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0,

@ -182,7 +182,7 @@ void Utf8Encoder::resize(size_t size)
is the case, then the ascii parameter is set to true, and the
caller can optimize for this case.
*/
size_t Utf8Encoder::getLength(const char* input, bool &ascii)
size_t Utf8Encoder::getLength(const char* input, bool &ascii) const
{
ascii = true;
size_t len = 0;
@ -214,7 +214,7 @@ size_t Utf8Encoder::getLength(const char* input, bool &ascii)
// Translate one character 'ch' using the translation array 'arr', and
// advance the output pointer accordingly.
void Utf8Encoder::copyFromArray(unsigned char ch, char* &out)
void Utf8Encoder::copyFromArray(unsigned char ch, char* &out) const
{
// Optimize for ASCII values
if (ch < 128)
@ -229,7 +229,7 @@ void Utf8Encoder::copyFromArray(unsigned char ch, char* &out)
*(out++) = *(in++);
}
size_t Utf8Encoder::getLength2(const char* input, bool &ascii)
size_t Utf8Encoder::getLength2(const char* input, bool &ascii) const
{
ascii = true;
size_t len = 0;
@ -273,7 +273,7 @@ size_t Utf8Encoder::getLength2(const char* input, bool &ascii)
return len;
}
void Utf8Encoder::copyFromArray2(const char*& chp, char* &out)
void Utf8Encoder::copyFromArray2(const char*& chp, char* &out) const
{
unsigned char ch = *(chp++);
// Optimize for ASCII values

@ -42,13 +42,13 @@ namespace ToUTF8
private:
void resize(size_t size);
size_t getLength(const char* input, bool &ascii);
void copyFromArray(unsigned char chp, char* &out);
size_t getLength2(const char* input, bool &ascii);
void copyFromArray2(const char*& chp, char* &out);
size_t getLength(const char* input, bool &ascii) const;
void copyFromArray(unsigned char chp, char* &out) const;
size_t getLength2(const char* input, bool &ascii) const;
void copyFromArray2(const char*& chp, char* &out) const;
std::vector<char> mOutput;
signed char* translationArray;
const signed char* translationArray;
};
}

Loading…
Cancel
Save