Use `signed char' explicitly where needed. It is important because:

- It is implementation-dependent if plain `char' signed or not.
- C standard defines three *distinct* types: char, signed char,
  and unsigned char.
- Assuming that char is always unsigned or signed can lead to
  compile-time and run-time errors.

You can also use int8_t, but then it would be less obvious for developers
to never assume that char is always unsigned (or always signed).

Conflicts:

	components/esm/loadcell.hpp
actorid
Douglas Mencken 12 years ago committed by Marc Zinnschlag
parent 4da11a96a5
commit df5919f2c5

@ -16,7 +16,7 @@
#include <iostream>
#include <boost/format.hpp>
std::string bodyPartLabel(char idx)
std::string bodyPartLabel(signed char idx)
{
const char *bodyPartLabels[] = {
"Head",
@ -54,7 +54,7 @@ std::string bodyPartLabel(char idx)
return "Invalid";
}
std::string meshPartLabel(char idx)
std::string meshPartLabel(signed char idx)
{
const char *meshPartLabels[] = {
"Head",
@ -80,7 +80,7 @@ std::string meshPartLabel(char idx)
return "Invalid";
}
std::string meshTypeLabel(char idx)
std::string meshTypeLabel(signed char idx)
{
const char *meshTypeLabels[] = {
"Skin",

@ -3,9 +3,9 @@
#include <string>
std::string bodyPartLabel(char idx);
std::string meshPartLabel(char idx);
std::string meshTypeLabel(char idx);
std::string bodyPartLabel(signed char idx);
std::string meshPartLabel(signed char idx);
std::string meshTypeLabel(signed char idx);
std::string clothingTypeLabel(int idx);
std::string armorTypeLabel(int idx);
std::string dialogTypeLabel(int idx);

@ -77,7 +77,7 @@ public:
std::string mKey, mTrap; // Key and trap ID names, if any
// No idea - occurs ONCE in Morrowind.esm, for an activator
char mUnam;
signed char mUnam;
// Track deleted references. 0 - not deleted, 1 - deleted, but respawns, 2 - deleted and does not respawn.
int mDeleted;

@ -30,7 +30,7 @@ struct Dialogue
};
std::string mId;
char mType;
signed char mType;
std::vector<DialInfo> mInfo;
void load(ESMReader &esm);

@ -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 char windows_1250[] =
static signed char windows_1250[] =
{
1, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0,
@ -270,7 +270,7 @@ static char windows_1250[] =
/// Cyrillic alphabet such as Russian, Bulgarian, Serbian Cyrillic
/// and other languages
static char windows_1251[] =
static signed char windows_1251[] =
{
1, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0,
@ -531,7 +531,7 @@ static char windows_1251[] =
};
/// Latin alphabet used by English and some other Western languages
static char windows_1252[] =
static signed char windows_1252[] =
{
1, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0,

@ -216,7 +216,7 @@ void Utf8Encoder::copyFromArray(unsigned char ch, char* &out)
return;
}
const char *in = translationArray + ch*6;
const signed char *in = translationArray + ch*6;
int len = *(in++);
for (int i=0; i<len; i++)
*(out++) = *(in++);

@ -47,7 +47,7 @@ namespace ToUTF8
void copyFromArray2(const char*& chp, char* &out);
std::vector<char> mOutput;
char* translationArray;
signed char* translationArray;
};
}

Loading…
Cancel
Save