mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 06:45:33 +00:00
Bug 648735 - On OpenBSD/64 bits we need a typedef for unsigned long long, and reuse the unsigned long template on 32/64 bits; r=cjones
This commit is contained in:
parent
44bf114e8f
commit
d11dac2b65
@ -168,8 +168,34 @@ struct ParamTraits<unsigned long> {
|
||||
l->append(StringPrintf(L"%ul", p));
|
||||
}
|
||||
};
|
||||
#if (defined(OS_OPENBSD) && defined(ARCH_CPU_64_BITS))
|
||||
// On OpenBSD, uint64_t is unsigned long long
|
||||
// see https://bugzilla.mozilla.org/show_bug.cgi?id=648735#c27
|
||||
template <>
|
||||
struct ParamTraits<unsigned long long> {
|
||||
typedef unsigned long long param_type;
|
||||
static void Write(Message* m, const param_type& p) {
|
||||
m->WriteData(reinterpret_cast<const char*>(&p), sizeof(param_type));
|
||||
}
|
||||
static bool Read(const Message* m, void** iter, param_type* r) {
|
||||
const char *data;
|
||||
int data_size = 0;
|
||||
bool result = m->ReadData(iter, &data, &data_size);
|
||||
if (result && data_size == sizeof(param_type)) {
|
||||
memcpy(r, data, sizeof(param_type));
|
||||
} else {
|
||||
result = false;
|
||||
NOTREACHED();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%ull", p));
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !(defined(OS_MACOSX) || defined(OS_WIN) || (defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)))
|
||||
#if !(defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_WIN) || (defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)))
|
||||
// There size_t is a synonym for |unsigned long| ...
|
||||
template <>
|
||||
struct ParamTraits<size_t> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user