mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 04:51:19 +00:00
- some GCC fixed by Edward-san.
This commit is contained in:
parent
1effaa4c8e
commit
7b6b473ec4
10 changed files with 33 additions and 15 deletions
|
@ -37,6 +37,7 @@
|
|||
|
||||
#define REGMARKER(x) (x)
|
||||
typedef void * const REGINFO;
|
||||
typedef void * NCREGINFO;
|
||||
|
||||
// List of Action functons
|
||||
extern REGINFO ARegHead;
|
||||
|
@ -72,7 +73,7 @@ class FAutoSegIterator
|
|||
}
|
||||
Probe = Head;
|
||||
}
|
||||
REGINFO operator*() const
|
||||
NCREGINFO operator*() const
|
||||
{
|
||||
return *Probe;
|
||||
}
|
||||
|
|
|
@ -792,7 +792,7 @@ void SetDehParams(FState *state, int codepointer)
|
|||
sym = dyn_cast<PFunction>(RUNTIME_CLASS(AInventory)->Symbols.FindSymbol(FName(MBFCodePointers[codepointer].name), true));
|
||||
if (sym == NULL) return;
|
||||
|
||||
if (codepointer < 0 || codepointer >= countof(MBFCodePointerFactories))
|
||||
if (codepointer < 0 || (unsigned)codepointer >= countof(MBFCodePointerFactories))
|
||||
{
|
||||
// This simply should not happen.
|
||||
Printf("Unmanaged dehacked codepointer alias num %i\n", codepointer);
|
||||
|
|
|
@ -723,7 +723,7 @@ void D_WriteUserInfoStrings (int pnum, BYTE **stream, bool compact)
|
|||
|
||||
case NAME_PlayerClass:
|
||||
*stream += sprintf(*((char **)stream), "\\%s", info->GetPlayerClassNum() == -1 ? "Random" :
|
||||
D_EscapeUserInfo(info->GetPlayerClassType()->DisplayName.GetChars()));
|
||||
D_EscapeUserInfo(info->GetPlayerClassType()->DisplayName.GetChars()).GetChars());
|
||||
break;
|
||||
|
||||
case NAME_Skin:
|
||||
|
|
|
@ -101,7 +101,7 @@ void DumpTypeTable()
|
|||
for (size_t i = 0; i < countof(TypeTable.TypeHash); ++i)
|
||||
{
|
||||
int len = 0;
|
||||
Printf("%4d:", i);
|
||||
Printf("%4zu:", i);
|
||||
for (PType *ty = TypeTable.TypeHash[i]; ty != NULL; ty = ty->HashNext)
|
||||
{
|
||||
Printf(" -> %s", ty->IsKindOf(RUNTIME_CLASS(PNamedType)) ? static_cast<PNamedType*>(ty)->TypeName.GetChars(): ty->GetClass()->TypeName.GetChars());
|
||||
|
@ -122,7 +122,7 @@ void DumpTypeTable()
|
|||
}
|
||||
Printf("\n");
|
||||
}
|
||||
Printf("Used buckets: %d/%u (%.2f%%) for %d entries\n", used, countof(TypeTable.TypeHash), double(used)/countof(TypeTable.TypeHash)*100, all);
|
||||
Printf("Used buckets: %d/%lu (%.2f%%) for %d entries\n", used, countof(TypeTable.TypeHash), double(used)/countof(TypeTable.TypeHash)*100, all);
|
||||
Printf("Min bucket size: %d\n", min);
|
||||
Printf("Max bucket size: %d\n", max);
|
||||
Printf("Avg bucket size: %.2f\n", double(all) / used);
|
||||
|
|
23
src/tarray.h
23
src/tarray.h
|
@ -389,7 +389,7 @@ public:
|
|||
if ((*this)[i] != NULL)
|
||||
delete (*this)[i];
|
||||
}
|
||||
Clear();
|
||||
this->Clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -461,7 +461,12 @@ template<class KT> struct THashTraits
|
|||
{
|
||||
// Returns the hash value for a key.
|
||||
hash_t Hash(const KT key) { return (hash_t)(intptr_t)key; }
|
||||
hash_t Hash(double key) { return ((hash_t *)&key)[0] ^ ((hash_t *)&key)[1]; }
|
||||
hash_t Hash(double key)
|
||||
{
|
||||
hash_t keyhash[2];
|
||||
memcpy(&keyhash, &key, sizeof(keyhash));
|
||||
return keyhash[0] ^ keyhash[1];
|
||||
}
|
||||
|
||||
// Compares two keys, returning zero if they are the same.
|
||||
int Compare(const KT left, const KT right) { return left != right; }
|
||||
|
@ -470,14 +475,24 @@ template<class KT> struct THashTraits
|
|||
template<> struct THashTraits<float>
|
||||
{
|
||||
// Use all bits when hashing singles instead of converting them to ints.
|
||||
hash_t Hash(float key) { return *((hash_t *)&key); }
|
||||
hash_t Hash(float key)
|
||||
{
|
||||
hash_t keyhash;
|
||||
memcpy(&keyhash, &key, sizeof(keyhash));
|
||||
return keyhash;
|
||||
}
|
||||
int Compare(float left, float right) { return left != right; }
|
||||
};
|
||||
|
||||
template<> struct THashTraits<double>
|
||||
{
|
||||
// Use all bits when hashing doubles instead of converting them to ints.
|
||||
hash_t Hash(double key) { return ((hash_t *)&key)[0] ^ ((hash_t *)&key)[1]; }
|
||||
hash_t Hash(double key)
|
||||
{
|
||||
hash_t keyhash[2];
|
||||
memcpy(&keyhash, &key, sizeof(keyhash));
|
||||
return keyhash[0] ^ keyhash[1];
|
||||
}
|
||||
int Compare(double left, double right) { return left != right; }
|
||||
};
|
||||
|
||||
|
|
|
@ -4350,8 +4350,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll)
|
|||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_ANGLE (roll);
|
||||
PARAM_INT_OPT (flags); { flags = 0; }
|
||||
PARAM_INT_OPT (ptr); { ptr = AAPTR_DEFAULT; }
|
||||
PARAM_INT_OPT (flags) { flags = 0; }
|
||||
PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; }
|
||||
AActor *ref = COPY_AAPTR(self, ptr);
|
||||
|
||||
if (ref != NULL)
|
||||
|
|
|
@ -3130,7 +3130,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
|
|||
return NULL;
|
||||
}
|
||||
TArray<PType *> &rets = Function->Variants[0].Proto->ReturnTypes;
|
||||
if (rets.Size() == NULL)
|
||||
if (rets.Size() == 0)
|
||||
{
|
||||
ReturnType = TypeVoid;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
NeedSpace = false;
|
||||
if (NestDepth > 0)
|
||||
{
|
||||
Str.AppendFormat("%*s", NestDepth, "");
|
||||
Str.AppendFormat("%*s", (int)NestDepth, "");
|
||||
}
|
||||
if (ConsecOpens > 0)
|
||||
{
|
||||
|
|
|
@ -476,8 +476,8 @@ struct VMValue
|
|||
{
|
||||
Kill();
|
||||
a = v;
|
||||
atag = atag;
|
||||
Type = atag;
|
||||
this->atag = atag;
|
||||
Type = REGT_POINTER;
|
||||
}
|
||||
void SetNil()
|
||||
{
|
||||
|
|
|
@ -663,7 +663,9 @@ static void DtoS(ZCC_ExprConstant *expr, FSharedStringArena &str_arena)
|
|||
// Convert to a string with enough precision such that converting
|
||||
// back to a double will not lose any data.
|
||||
char str[64];
|
||||
IGNORE_FORMAT_PRE
|
||||
int len = mysnprintf(str, countof(str), "%H", expr->DoubleVal);
|
||||
IGNORE_FORMAT_POST
|
||||
expr->StringVal = str_arena.Alloc(str, len);
|
||||
expr->Type = TypeString;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue