Bug 794510: Part 2: Use more stdint types instead of protypes.h types; r=ehsan

This commit is contained in:
Isaac Aggrey 2012-10-11 18:38:04 -05:00
Родитель d4a48c15cd
Коммит c984edf823
96 изменённых файлов: 458 добавлений и 464 удалений

Просмотреть файл

@ -123,7 +123,7 @@ nsXTFWeakTearoff::CallMethod(uint16_t methodIndex,
for (int i=0; i<paramCount; ++i) {
const nsXPTParamInfo& paramInfo = info->params[i];
uint8 flags = paramInfo.IsOut() ? nsXPTCVariant::PTR_IS_DATA : 0;
uint8_t flags = paramInfo.IsOut() ? nsXPTCVariant::PTR_IS_DATA : 0;
fullPars[i].Init(params[i], paramInfo.GetType(), flags);
}

Просмотреть файл

@ -287,7 +287,7 @@ nsSHistory::CalcMaxTotalViewers()
if (bytes == 0)
return 0;
// Conversion from unsigned int64 to double doesn't work on all platforms.
// Conversion from unsigned int64_t to double doesn't work on all platforms.
// We need to truncate the value at INT64_MAX to make sure we don't
// overflow.
if (bytes > INT64_MAX)

Просмотреть файл

@ -158,7 +158,7 @@ nsStructuredCloneContainer::GetSerializedNBytes(uint64_t *aSize)
NS_ENSURE_ARG_POINTER(aSize);
// mSize is a size_t, while aSize is a uint64_t. We rely on an implicit cast
// here so that we'll get a compile error if a size_t-to-uint64 cast is
// here so that we'll get a compile error if a size_t-to-uint64_t cast is
// narrowing.
*aSize = mSize;

Просмотреть файл

@ -226,7 +226,7 @@ status_t GonkRecorder::setOutputFile(int fd, int64_t offset, int64_t length) {
return OK;
}
// Attempt to parse an int64 literal optionally surrounded by whitespace,
// Attempt to parse an int64_t literal optionally surrounded by whitespace,
// returns true on success, false otherwise.
static bool safe_strtoi64(const char *s, int64_t *val) {
char *end;
@ -246,7 +246,7 @@ static bool safe_strtoi64(const char *s, int64_t *val) {
}
// For a successful return, the string must contain nothing but a valid
// int64 literal optionally surrounded by whitespace.
// int64_t literal optionally surrounded by whitespace.
return *end == '\0';
}

Просмотреть файл

@ -1034,11 +1034,6 @@ struct ANPSurfaceInterfaceV0 : ANPInterface {
void (*unlock)(JNIEnv* env, jobject surface);
};
typedef int32_t int32;
typedef uint32_t uint32;
typedef int16_t int16;
typedef uint16_t uint16;
/**
* TODO should we not use EGL and GL data types for ABI safety?
*/

Просмотреть файл

@ -2712,8 +2712,8 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HPS aHPS)
NPEvent pluginEvent;
pluginEvent.event = WM_PAINT;
pluginEvent.wParam = (uint32)aHPS;
pluginEvent.lParam = (uint32)&rectl;
pluginEvent.wParam = (uint32_t)aHPS;
pluginEvent.lParam = (uint32_t)&rectl;
mInstance->HandleEvent(&pluginEvent, nullptr);
}
#endif

Просмотреть файл

@ -374,13 +374,13 @@ static bool IsCompatibleArch(nsIFile *file)
executablePath[0] = '\0';
}
uint32 pluginLibArchitectures;
uint32_t pluginLibArchitectures;
nsresult rv = mozilla::ipc::GeckoChildProcessHost::GetArchitecturesForBinary(executablePath, &pluginLibArchitectures);
if (NS_FAILED(rv)) {
return false;
}
uint32 containerArchitectures = mozilla::ipc::GeckoChildProcessHost::GetSupportedArchitecturesForProcessType(GeckoProcessType_Plugin);
uint32_t containerArchitectures = mozilla::ipc::GeckoChildProcessHost::GetSupportedArchitecturesForProcessType(GeckoProcessType_Plugin);
// Consider the plugin architecture valid if there is any overlap in the masks.
isPluginFile = !!(containerArchitectures & pluginLibArchitectures);

Просмотреть файл

@ -576,7 +576,7 @@ nsJSONListener::OnStopRequest(nsIRequest *aRequest, nsISupports *aContext,
JS::StableCharPtr chars(reinterpret_cast<const jschar*>(mBufferedChars.Elements()),
mBufferedChars.Length());
JSBool ok = js::ParseJSONWithReviver(mCx, chars,
(uint32) mBufferedChars.Length(),
(uint32_t) mBufferedChars.Length(),
reviver, &value,
mDecodingMode);

Просмотреть файл

@ -224,7 +224,7 @@ private:
{
JS_ASSERT(JSID_IS_INT(aIdval));
int32 slot = JSID_TO_INT(aIdval);
int32_t slot = JSID_TO_INT(aIdval);
const char*& name = sProperties[slot - SLOT_FIRST].name;
if (!GetInstancePrivate(aCx, aObj, name)) {
@ -517,7 +517,7 @@ private:
{
JS_ASSERT(JSID_IS_INT(aIdval));
int32 slot = JSID_TO_INT(aIdval);
int32_t slot = JSID_TO_INT(aIdval);
JS_ASSERT(slot >= SLOT_data && slot < SLOT_COUNT);
@ -637,7 +637,7 @@ public:
static JSObject*
Create(JSContext* aCx, JSObject* aParent, JSString* aMessage,
JSString* aFilename, uint32 aLineNumber, bool aMainRuntime)
JSString* aFilename, uint32_t aLineNumber, bool aMainRuntime)
{
JSString* type = JS_InternString(aCx, "error");
if (!type) {
@ -697,7 +697,7 @@ private:
InitErrorEventCommon(JSObject* aObj, Event* aEvent, JSString* aType,
JSBool aBubbles, JSBool aCancelable,
JSString* aMessage, JSString* aFilename,
uint32 aLineNumber, bool aIsTrusted)
uint32_t aLineNumber, bool aIsTrusted)
{
Event::InitEventCommon(aObj, aEvent, aType, aBubbles, aCancelable,
aIsTrusted);
@ -726,7 +726,7 @@ private:
{
JS_ASSERT(JSID_IS_INT(aIdval));
int32 slot = JSID_TO_INT(aIdval);
int32_t slot = JSID_TO_INT(aIdval);
JS_ASSERT(slot >= SLOT_message && slot < SLOT_COUNT);
@ -906,7 +906,7 @@ private:
{
JS_ASSERT(JSID_IS_INT(aIdval));
int32 slot = JSID_TO_INT(aIdval);
int32_t slot = JSID_TO_INT(aIdval);
JS_ASSERT(slot >= SLOT_lengthComputable && slot < SLOT_COUNT);
@ -1023,7 +1023,7 @@ CreateMessageEvent(JSContext* aCx, JSAutoStructuredCloneBuffer& aData,
JSObject*
CreateErrorEvent(JSContext* aCx, JSString* aMessage, JSString* aFilename,
uint32 aLineNumber, bool aMainRuntime)
uint32_t aLineNumber, bool aMainRuntime)
{
JSObject* global = JS_GetGlobalForScopeChain(aCx);
return ErrorEvent::Create(aCx, global, aMessage, aFilename, aLineNumber,

Просмотреть файл

@ -28,7 +28,7 @@ CreateMessageEvent(JSContext* aCx, JSAutoStructuredCloneBuffer& aData,
JSObject*
CreateErrorEvent(JSContext* aCx, JSString* aMessage, JSString* aFilename,
uint32 aLineNumber, bool aMainRuntime);
uint32_t aLineNumber, bool aMainRuntime);
JSObject*
CreateProgressEvent(JSContext* aCx, JSString* aType, bool aLengthComputable,

Просмотреть файл

@ -130,7 +130,7 @@ private:
{
JS_ASSERT(JSID_IS_INT(aIdval));
int32 slot = JSID_TO_INT(aIdval);
int32_t slot = JSID_TO_INT(aIdval);
JSClass* classPtr = JS_GetClass(aObj);

Просмотреть файл

@ -3786,7 +3786,7 @@ WorkerPrivate::SetTimeout(JSContext* aCx, unsigned aArgc, jsval* aVp,
}
bool
WorkerPrivate::ClearTimeout(JSContext* aCx, uint32 aId)
WorkerPrivate::ClearTimeout(JSContext* aCx, uint32_t aId)
{
AssertIsOnWorkerThread();

Просмотреть файл

@ -675,7 +675,7 @@ public:
SetTimeout(JSContext* aCx, unsigned aArgc, jsval* aVp, bool aIsInterval);
bool
ClearTimeout(JSContext* aCx, uint32 aId);
ClearTimeout(JSContext* aCx, uint32_t aId);
bool
RunExpiredTimeouts(JSContext* aCx);

Просмотреть файл

@ -110,7 +110,7 @@ protected:
: EventTarget(aCx), mWorker(aWorker)
{
MOZ_COUNT_CTOR(mozilla::dom::workers::WorkerGlobalScope);
for (int32 i = 0; i < SLOT_COUNT; i++) {
for (int32_t i = 0; i < SLOT_COUNT; i++) {
mSlots[i] = JSVAL_VOID;
}
}
@ -123,7 +123,7 @@ protected:
virtual void
_trace(JSTracer* aTrc) MOZ_OVERRIDE
{
for (int32 i = 0; i < SLOT_COUNT; i++) {
for (int32_t i = 0; i < SLOT_COUNT; i++) {
JS_CALL_VALUE_TRACER(aTrc, mSlots[i], "WorkerGlobalScope instance slot");
}
mWorker->TraceInternal(aTrc);

Просмотреть файл

@ -134,7 +134,7 @@ NS_IMETHODIMP nsScriptableRegion::GetRects(JSContext* aCx, JS::Value* aRects)
*aRects = OBJECT_TO_JSVAL(destArray);
uint32 n = 0;
uint32_t n = 0;
nsIntRegionRectIterator iter(mRegion);
const nsIntRect *rect;

Просмотреть файл

@ -206,7 +206,7 @@ struct THEBES_API gfxRGBA {
/**
* Returns this color value as a packed 32-bit integer. This reconstructs
* the int32 based on the given colorType, always in the native byte order.
* the int32_t based on the given colorType, always in the native byte order.
*
* Note: gcc 4.2.3 on at least Ubuntu (x86) does something strange with
* (uint8_t)(c * 255.0) << x, where the result is different than

Просмотреть файл

@ -361,7 +361,7 @@ gfxFontUtils::ReadCMAPTableFormat4(const uint8_t *aBuf, uint32_t aLength,
const uint16_t segCount = segCountX2 / 2;
const uint16_t *endCounts = reinterpret_cast<const uint16_t*>(aBuf + 14);
const uint16_t *startCounts = endCounts + 1 /* skip one uint16 for reservedPad */ + segCount;
const uint16_t *startCounts = endCounts + 1 /* skip one uint16_t for reservedPad */ + segCount;
const uint16_t *idDeltas = startCounts + segCount;
const uint16_t *idRangeOffsets = idDeltas + segCount;
uint16_t prevEndCount = 0;

Просмотреть файл

@ -438,7 +438,7 @@ nsGIFDecoder2::DoLzw(const uint8_t *q)
for (const uint8_t* ch = q; count-- > 0; ch++)
{
/* Feed the next byte into the decoder's 32-bit input buffer. */
datum += ((int32) *ch) << bits;
datum += ((int32_t) *ch) << bits;
bits += 8;
/* Check for underflow of decoder's 32-bit input buffer. */

Просмотреть файл

@ -9,7 +9,7 @@
/*=====================================*/
#define PACK(h,l) (int16)(( (h) << 8) | (l))
#define PACK(h,l) (int16_t)(( (h) << 8) | (l))
#if defined(IS_LITTLE_ENDIAN)
#define ShiftInCell(sub,len,min,max) \

Просмотреть файл

@ -5,27 +5,26 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdio.h>
typedef short int16;
typedef unsigned short uint16;
#include "mozilla/StandardInteger.h"
#define NOMAPPING 0xfffd
typedef struct {
uint16 srcBegin; /* 2 byte */
uint16 srcEnd; /* 2 byte */
uint16 destBegin; /* 2 byte */
uint16_t srcBegin; /* 2 byte */
uint16_t srcEnd; /* 2 byte */
uint16_t destBegin; /* 2 byte */
} uFormat0;
typedef struct {
uint16 srcBegin; /* 2 byte */
uint16 srcEnd; /* 2 byte */
uint16 mappingOffset; /* 2 byte */
uint16_t srcBegin; /* 2 byte */
uint16_t srcEnd; /* 2 byte */
uint16_t mappingOffset; /* 2 byte */
} uFormat1;
typedef struct {
uint16 srcBegin; /* 2 byte */
uint16 srcEnd; /* 2 byte -waste */
uint16 destBegin; /* 2 byte */
uint16_t srcBegin; /* 2 byte */
uint16_t srcEnd; /* 2 byte -waste */
uint16_t destBegin; /* 2 byte */
} uFormat2;
typedef struct {
@ -40,14 +39,14 @@ typedef struct {
uTable
================================================= */
typedef struct {
uint16 itemOfList;
uint16 offsetToFormatArray;
uint16 offsetToMapCellArray;
uint16 offsetToMappingTable;
uint16 data[1];
uint16_t itemOfList;
uint16_t offsetToFormatArray;
uint16_t offsetToMapCellArray;
uint16_t offsetToMappingTable;
uint16_t data[1];
} uTable;
uint16 umap[256][256];
uint16_t umap[256][256];
int bInitFromOrTo = 0;
int bGenerateFromUnicodeTable = 0;
@ -55,8 +54,8 @@ int bGenerateFromUnicodeTable = 0;
static int numOfItem = 0;
uMapCell cell[MAXCELLNUM];
uint16 format[MAXCELLNUM / 4];
uint16 mapping[256*256];
uint16_t format[MAXCELLNUM / 4];
uint16_t mapping[256*256];
static int mappinglen = 0;
static int formatcount[4] = {0,0,0,0};
@ -85,9 +84,9 @@ void SetMapValue(short u,short c)
fprintf(stderr, "warning- duplicate mapping %x map to both %x and %x\n", u, MAPVALUE(u), c);
}
}
void AddFormat2(uint16 srcBegin)
void AddFormat2(uint16_t srcBegin)
{
uint16 destBegin = MAPVALUE(srcBegin);
uint16_t destBegin = MAPVALUE(srcBegin);
printf("Begin of Item %04X\n",numOfItem);
printf(" Format 2\n");
printf(" srcBegin = %04X\n", srcBegin);
@ -101,9 +100,9 @@ void AddFormat2(uint16 srcBegin)
/* Unmark the umap */
MAPVALUE(srcBegin) = NOMAPPING;
}
void AddFormat1(uint16 srcBegin, uint16 srcEnd)
void AddFormat1(uint16_t srcBegin, uint16_t srcEnd)
{
uint16 i;
uint16_t i;
printf("Begin of Item %04X\n",numOfItem);
printf(" Format 1\n");
printf(" srcBegin = %04X\n", srcBegin);
@ -127,10 +126,10 @@ void AddFormat1(uint16 srcBegin, uint16 srcEnd)
printf("End of Item %04X \n\n",numOfItem);
numOfItem++;
}
void AddFormat0(uint16 srcBegin, uint16 srcEnd)
void AddFormat0(uint16_t srcBegin, uint16_t srcEnd)
{
uint16 i;
uint16 destBegin = MAPVALUE(srcBegin);
uint16_t i;
uint16_t destBegin = MAPVALUE(srcBegin);
printf("Begin of Item %04X\n",numOfItem);
printf(" Format 0\n");
printf(" srcBegin = %04X\n", srcBegin);
@ -160,9 +159,9 @@ void gentable()
{
/* OK! For now, we just use format 1 for each row */
/* We need to chage this to use other format to save the space */
uint16 begin,end;
uint16 ss,gs,gp,state,gc;
uint16 diff, lastdiff;
uint16_t begin,end;
uint16_t ss,gs,gp,state,gc;
uint16_t diff, lastdiff;
printnpl();
printf("/*========================================================\n");
@ -283,13 +282,13 @@ void gentable()
}
void writetable()
{
uint16 i;
uint16 off1,off2,off3;
uint16 cur = 0;
uint16 formatitem = (((numOfItem)>>2) + 1);
uint16_t i;
uint16_t off1,off2,off3;
uint16_t cur = 0;
uint16_t formatitem = (((numOfItem)>>2) + 1);
off1 = 4;
off2 = off1 + formatitem ;
off3 = off2 + numOfItem * sizeof(uMapCell) / sizeof(uint16);
off3 = off2 + numOfItem * sizeof(uMapCell) / sizeof(uint16_t);
/* write itemOfList */
printf("/* Offset=0x%04X ItemOfList */\n 0x%04X,\n", cur++, numOfItem);

Просмотреть файл

@ -688,7 +688,7 @@ HashableValue::setValue(JSContext *cx, const Value &v)
double d = v.toDouble();
int32_t i;
if (MOZ_DOUBLE_IS_INT32(d, &i)) {
// Normalize int32-valued doubles to int32 for faster hashing and testing.
// Normalize int32_t-valued doubles to int32_t for faster hashing and testing.
value = Int32Value(i);
} else if (MOZ_DOUBLE_IS_NaN(d)) {
// NaNs with different bits must hash and test identically.

Просмотреть файл

@ -157,7 +157,7 @@ GetLength(JSContext *cx, HandleObject obj, uint32_t *length)
if (obj->isArray() || obj->isArguments())
return GetLengthProperty(cx, obj, length);
// Otherwise check that we don't overflow uint32.
// Otherwise check that we don't overflow uint32_t.
RootedValue value(cx);
if (!JSObject::getProperty(cx, obj, obj, cx->names().length, &value))
return false;

Просмотреть файл

@ -191,7 +191,7 @@ struct FreeSpan
* there as offsets from the arena start.
*/
static size_t encodeOffsets(size_t firstOffset, size_t lastOffset) {
/* Check that we can pack the offsets into uint16. */
/* Check that we can pack the offsets into uint16_t. */
JS_STATIC_ASSERT(ArenaShift < 16);
JS_ASSERT(firstOffset <= ArenaSize);
JS_ASSERT(lastOffset < ArenaSize);

Просмотреть файл

@ -279,7 +279,7 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
* Assign an observed type set to each reachable JOF_TYPESET opcode.
* This may be less than the number of type sets in the script if some
* are unreachable, and may be greater in case the number of type sets
* overflows a uint16. In the latter case a single type set will be
* overflows a uint16_t. In the latter case a single type set will be
* used for the observed types of all ops after the overflow.
*/
if ((js_CodeSpec[op].format & JOF_TYPESET) && cx->typeInferenceEnabled()) {

Просмотреть файл

@ -14,7 +14,7 @@
* &ArrayClass, and can then directly manipulate the slots for efficiency.
*
* We track these pieces of metadata for arrays in dense mode:
* - The array's length property as a uint32, accessible with
* - The array's length property as a uint32_t, accessible with
* getArrayLength(), setArrayLength().
* - The number of element slots (capacity), gettable with
* getDenseArrayCapacity().

Просмотреть файл

@ -384,7 +384,7 @@ JSObject::setArrayLength(JSContext *cx, js::HandleObject obj, uint32_t length)
inline void
JSObject::setDenseArrayLength(uint32_t length)
{
/* Variant of setArrayLength for use on dense arrays where the length cannot overflow int32. */
/* Variant of setArrayLength for use on dense arrays where the length cannot overflow int32_t. */
JS_ASSERT(isDenseArray());
JS_ASSERT(length <= INT32_MAX);
getElementsHeader()->length = length;

Просмотреть файл

@ -208,8 +208,8 @@ struct TypedArray : public BufferView {
TYPE_FLOAT64,
/*
* Special type that's a uint8, but assignments are clamped to 0 .. 255.
* Treat the raw data type as a uint8.
* Special type that's a uint8_t, but assignments are clamped to 0 .. 255.
* Treat the raw data type as a uint8_t.
*/
TYPE_UINT8_CLAMPED,

Просмотреть файл

@ -5091,7 +5091,7 @@ mjit::Compiler::jsop_getprop(PropertyName *name, JSValueType knownType,
/*
* Check if we are accessing the 'length' property of a known dense array.
* Note that if the types are known to indicate dense arrays, their lengths
* must fit in an int32.
* must fit in an int32_t.
*/
if (!types->hasObjectFlags(cx, types::OBJECT_FLAG_NON_DENSE_ARRAY)) {
bool isObject = top->isTypeKnown();
@ -5119,7 +5119,7 @@ mjit::Compiler::jsop_getprop(PropertyName *name, JSValueType knownType,
/*
* Check if we're accessing the 'length' property of a typed array.
* The typed array length always fits in an int32.
* The typed array length always fits in an int32_t.
*/
if (!types->hasObjectFlags(cx, types::OBJECT_FLAG_NON_TYPED_ARRAY)) {
if (top->isConstant()) {

Просмотреть файл

@ -353,7 +353,7 @@ mjit::Compiler::jsop_binary_double(FrameEntry *lhs, FrameEntry *rhs, JSOp op,
types::TypeSet *resultTypes = pushedTypeSet(0);
if (resultTypes && !resultTypes->hasType(types::Type::DoubleType())) {
/*
* Call a stub and try harder to convert to int32, failing that trigger
* Call a stub and try harder to convert to int32_t, failing that trigger
* recompilation of this script.
*/
stubcc.linkExit(masm.jump(), Uses(2));

Просмотреть файл

@ -56,7 +56,7 @@ mjit::Compiler::ensureInteger(FrameEntry *fe, Uses uses)
/*
* Try an OOL path to convert doubles representing integers within 2^32
* of a signed integer, by adding/subtracting 2^32 and then trying to
* convert to int32. This has to be an exact conversion, as otherwise
* convert to int32_t. This has to be an exact conversion, as otherwise
* the truncation works incorrectly on the modified value.
*/
@ -1616,7 +1616,7 @@ mjit::Compiler::jsop_setelem(bool popGuaranteed)
stubcc.linkExit(j, Uses(3));
}
// Guard that the id is int32.
// Guard that the id is int32_t.
if (!id->isTypeKnown()) {
Jump j = frame.testInt32(Assembler::NotEqual, id);
stubcc.linkExit(j, Uses(3));

Просмотреть файл

@ -55,7 +55,7 @@ class FrameEntry
}
#endif
/* For a constant double FrameEntry, truncate to an int32. */
/* For a constant double FrameEntry, truncate to an int32_t. */
void convertConstantDoubleOrBooleanToInt32(JSContext *cx) {
JS_ASSERT(isConstant());
JS_ASSERT(isType(JSVAL_TYPE_DOUBLE) || isType(JSVAL_TYPE_BOOLEAN));

Просмотреть файл

@ -318,7 +318,7 @@ class FrameState
* Pushes a number onto the operation stack.
*
* If asInt32 is set to true, then the FS will attempt to optimize
* syncing the type as int32. Only use this parameter when the fast-path
* syncing the type as int32_t. Only use this parameter when the fast-path
* guaranteed that the stack slot was guarded to be an int32_t originally.
*
* For example, checking LHS and RHS as ints guarantees that if the LHS

2
netwerk/cache/nsCacheService.cpp поставляемый
Просмотреть файл

@ -940,7 +940,7 @@ nsCacheProfilePrefObserver::MemoryCacheCapacity()
if (bytes == 0)
bytes = 32 * 1024 * 1024;
// Conversion from unsigned int64 to double doesn't work on all platforms.
// Conversion from unsigned int64_t to double doesn't work on all platforms.
// We need to truncate the value at INT64_MAX to make sure we don't
// overflow.
if (bytes > INT64_MAX)

Просмотреть файл

@ -903,7 +903,7 @@ nsSOCKSSocketInfo::ReadUint8()
{
uint8_t rv;
NS_ABORT_IF_FALSE(mReadOffset + sizeof(rv) <= mDataLength,
"Not enough space to pop a uint8!");
"Not enough space to pop a uint8_t!");
rv = mData[mReadOffset];
mReadOffset += sizeof(rv);
return rv;
@ -914,7 +914,7 @@ nsSOCKSSocketInfo::ReadUint16()
{
uint16_t rv;
NS_ABORT_IF_FALSE(mReadOffset + sizeof(rv) <= mDataLength,
"Not enough space to pop a uint16!");
"Not enough space to pop a uint16_t!");
memcpy(&rv, mData + mReadOffset, sizeof(rv));
mReadOffset += sizeof(rv);
return rv;
@ -925,7 +925,7 @@ nsSOCKSSocketInfo::ReadUint32()
{
uint32_t rv;
NS_ABORT_IF_FALSE(mReadOffset + sizeof(rv) <= mDataLength,
"Not enough space to pop a uint32!");
"Not enough space to pop a uint32_t!");
memcpy(&rv, mData + mReadOffset, sizeof(rv));
mReadOffset += sizeof(rv);
return rv;

Просмотреть файл

@ -16,7 +16,7 @@
#endif /* IS_LITTLE_ENDIAN */
#if PR_BYTES_PER_INT != 4
#define int int32
#define int int32_t
#endif /* PR_BYTES_PER_INT != 4 */
/* Other Mozilla code relies on memmove already, so we assume it's available */

Просмотреть файл

@ -1163,7 +1163,7 @@ int32_t nsNavHistoryContainerResultNode::SortComparison_AnnotationLess(
&b_type), 0);
}
// We better make the API not support this state, really
// XXXmano: this is actually wrong for double<->int and int64<->int32
// XXXmano: this is actually wrong for double<->int and int64_t<->int32_t
if (a_hasAnno && b_type != annoType)
return 0;
annoType = b_type;

Просмотреть файл

@ -40,7 +40,7 @@ nsresult
ChunkSet::Set(uint32_t aChunk)
{
uint32_t idx = mChunks.BinaryIndexOf(aChunk);
if (idx == nsTArray<uint32>::NoIndex) {
if (idx == nsTArray<uint32_t>::NoIndex) {
mChunks.InsertElementSorted(aChunk);
}
return NS_OK;
@ -57,16 +57,16 @@ ChunkSet::Unset(uint32_t aChunk)
bool
ChunkSet::Has(uint32_t aChunk) const
{
return mChunks.BinaryIndexOf(aChunk) != nsTArray<uint32>::NoIndex;
return mChunks.BinaryIndexOf(aChunk) != nsTArray<uint32_t>::NoIndex;
}
nsresult
ChunkSet::Merge(const ChunkSet& aOther)
{
const uint32 *dupIter = aOther.mChunks.Elements();
const uint32 *end = aOther.mChunks.Elements() + aOther.mChunks.Length();
const uint32_t *dupIter = aOther.mChunks.Elements();
const uint32_t *end = aOther.mChunks.Elements() + aOther.mChunks.Length();
for (const uint32 *iter = dupIter; iter != end; iter++) {
for (const uint32_t *iter = dupIter; iter != end; iter++) {
nsresult rv = Set(*iter);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -77,10 +77,10 @@ ChunkSet::Merge(const ChunkSet& aOther)
nsresult
ChunkSet::Remove(const ChunkSet& aOther)
{
uint32 *addIter = mChunks.Elements();
uint32 *end = mChunks.Elements() + mChunks.Length();
uint32_t *addIter = mChunks.Elements();
uint32_t *end = mChunks.Elements() + mChunks.Length();
for (uint32 *iter = addIter; iter != end; iter++) {
for (uint32_t *iter = addIter; iter != end; iter++) {
if (!aOther.Has(*iter)) {
*addIter = *iter;
addIter++;

Просмотреть файл

@ -15,7 +15,7 @@ namespace mozilla {
namespace safebrowsing {
/**
* Store the chunks as an array of uint32.
* Store the chunks as an array of uint32_t.
* XXX: We should optimize this further to compress the
* many consecutive numbers.
*/
@ -33,7 +33,7 @@ public:
bool Has(uint32_t chunk) const;
uint32 Length() const { return mChunks.Length(); }
uint32_t Length() const { return mChunks.Length(); }
nsresult Write(nsIOutputStream* aOut) {
return WriteTArray(aOut, mChunks);
@ -43,11 +43,11 @@ public:
return ReadTArray(aIn, &mChunks, aNumElements);
}
uint32 *Begin() { return mChunks.Elements(); }
uint32 *End() { return mChunks.Elements() + mChunks.Length(); }
uint32_t *Begin() { return mChunks.Elements(); }
uint32_t *End() { return mChunks.Elements() + mChunks.Length(); }
private:
nsTArray<uint32> mChunks;
nsTArray<uint32_t> mChunks;
};
}

Просмотреть файл

@ -127,7 +127,7 @@ Classifier::SetupPathNames()
// Make sure LookupCaches (which are persistent and survive updates)
// are reading/writing in the right place. We will be moving their
// files "underneath" them during backup/restore.
for (uint32 i = 0; i < mLookupCaches.Length(); i++) {
for (uint32_t i = 0; i < mLookupCaches.Length(); i++) {
mLookupCaches[i]->UpdateDirHandle(mStoreDirectory);
}
@ -240,7 +240,7 @@ Classifier::TableRequest(nsACString& aResult)
{
nsTArray<nsCString> tables;
ActiveTables(tables);
for (uint32 i = 0; i < tables.Length(); i++) {
for (uint32_t i = 0; i < tables.Length(); i++) {
nsAutoPtr<HashStore> store(new HashStore(tables[i], mStoreDirectory));
if (!store)
continue;
@ -376,7 +376,7 @@ Classifier::ApplyUpdates(nsTArray<TableUpdate*>* aUpdates)
LOG(("Applying table updates."));
for (uint32 i = 0; i < aUpdates->Length(); i++) {
for (uint32_t i = 0; i < aUpdates->Length(); i++) {
// Previous ApplyTableUpdates() may have consumed this update..
if ((*aUpdates)[i]) {
// Run all updates for one table
@ -420,7 +420,7 @@ Classifier::ApplyUpdates(nsTArray<TableUpdate*>* aUpdates)
nsresult
Classifier::MarkSpoiled(nsTArray<nsCString>& aTables)
{
for (uint32 i = 0; i < aTables.Length(); i++) {
for (uint32_t i = 0; i < aTables.Length(); i++) {
LOG(("Spoiling table: %s", aTables[i].get()));
// Spoil this table by marking it as no known freshness
mTableFreshness.Remove(aTables[i]);
@ -431,11 +431,11 @@ Classifier::MarkSpoiled(nsTArray<nsCString>& aTables)
void
Classifier::DropStores()
{
for (uint32 i = 0; i < mHashStores.Length(); i++) {
for (uint32_t i = 0; i < mHashStores.Length(); i++) {
delete mHashStores[i];
}
mHashStores.Clear();
for (uint32 i = 0; i < mLookupCaches.Length(); i++) {
for (uint32_t i = 0; i < mLookupCaches.Length(); i++) {
delete mLookupCaches[i];
}
mLookupCaches.Clear();
@ -449,7 +449,7 @@ Classifier::RegenActiveTables()
nsTArray<nsCString> foundTables;
ScanStoreDir(foundTables);
for (uint32 i = 0; i < foundTables.Length(); i++) {
for (uint32_t i = 0; i < foundTables.Length(); i++) {
nsAutoPtr<HashStore> store(new HashStore(nsCString(foundTables[i]), mStoreDirectory));
if (!store)
return NS_ERROR_OUT_OF_MEMORY;
@ -629,9 +629,9 @@ Classifier::ApplyTableUpdates(nsTArray<TableUpdate*>* aUpdates,
// take the quick exit if there is no valid update for us
// (common case)
uint32 validupdates = 0;
uint32_t validupdates = 0;
for (uint32 i = 0; i < aUpdates->Length(); i++) {
for (uint32_t i = 0; i < aUpdates->Length(); i++) {
TableUpdate *update = aUpdates->ElementAt(i);
if (!update || !update->TableName().Equals(store->TableName()))
continue;
@ -664,10 +664,10 @@ Classifier::ApplyTableUpdates(nsTArray<TableUpdate*>* aUpdates,
NS_ENSURE_SUCCESS(rv, rv);
AddPrefixHashes.Clear();
uint32 applied = 0;
uint32_t applied = 0;
bool updateFreshness = false;
for (uint32 i = 0; i < aUpdates->Length(); i++) {
for (uint32_t i = 0; i < aUpdates->Length(); i++) {
TableUpdate *update = aUpdates->ElementAt(i);
if (!update || !update->TableName().Equals(store->TableName()))
continue;
@ -734,7 +734,7 @@ Classifier::ApplyTableUpdates(nsTArray<TableUpdate*>* aUpdates,
LookupCache *
Classifier::GetLookupCache(const nsACString& aTable)
{
for (uint32 i = 0; i < mLookupCaches.Length(); i++) {
for (uint32_t i = 0; i < mLookupCaches.Length(); i++) {
if (mLookupCaches[i]->TableName().Equals(aTable)) {
return mLookupCaches[i];
}

Просмотреть файл

@ -31,12 +31,12 @@ namespace safebrowsing {
#define PREFIX_SIZE 4
#define COMPLETE_SIZE 32
template <uint32 S, class Comparator>
template <uint32_t S, class Comparator>
struct SafebrowsingHash
{
static const uint32 sHashSize = S;
static const uint32_t sHashSize = S;
typedef SafebrowsingHash<S, Comparator> self_type;
uint8 buf[S];
uint8_t buf[S];
nsresult FromPlaintext(const nsACString& aPlainText, nsICryptoHash* aHash) {
// From the protocol doc:
@ -47,7 +47,7 @@ struct SafebrowsingHash
NS_ENSURE_SUCCESS(rv, rv);
rv = aHash->Update
(reinterpret_cast<const uint8*>(aPlainText.BeginReading()),
(reinterpret_cast<const uint8_t*>(aPlainText.BeginReading()),
aPlainText.Length());
NS_ENSURE_SUCCESS(rv, rv);
@ -87,25 +87,25 @@ struct SafebrowsingHash
#ifdef DEBUG
void ToString(nsACString& aStr) const {
uint32 len = ((sHashSize + 2) / 3) * 4;
uint32_t len = ((sHashSize + 2) / 3) * 4;
aStr.SetCapacity(len + 1);
PL_Base64Encode((char*)buf, sHashSize, aStr.BeginWriting());
aStr.BeginWriting()[len] = '\0';
}
#endif
uint32_t ToUint32() const {
return *((uint32*)buf);
return *((uint32_t*)buf);
}
void FromUint32(uint32_t aHash) {
*((uint32*)buf) = aHash;
*((uint32_t*)buf) = aHash;
}
};
class PrefixComparator {
public:
static int Compare(const uint8_t* a, const uint8_t* b) {
uint32 first = *((uint32*)a);
uint32 second = *((uint32*)b);
uint32_t first = *((uint32_t*)a);
uint32_t second = *((uint32_t*)b);
if (first > second) {
return 1;
} else if (first == second) {
@ -129,11 +129,11 @@ typedef nsTArray<Completion> CompletionArray;
struct AddPrefix {
Prefix prefix;
uint32 addChunk;
uint32_t addChunk;
AddPrefix() : addChunk(0) {}
uint32 Chunk() const { return addChunk; }
uint32_t Chunk() const { return addChunk; }
const Prefix &PrefixHash() const { return prefix; }
template<class T>
@ -151,11 +151,11 @@ struct AddComplete {
Prefix prefix;
Completion complete;
} hash;
uint32 addChunk;
uint32_t addChunk;
AddComplete() : addChunk(0) {}
uint32 Chunk() const { return addChunk; }
uint32_t Chunk() const { return addChunk; }
const Prefix &PrefixHash() const { return hash.prefix; }
const Completion &CompleteHash() const { return hash.complete; }
@ -171,13 +171,13 @@ struct AddComplete {
struct SubPrefix {
Prefix prefix;
uint32 addChunk;
uint32 subChunk;
uint32_t addChunk;
uint32_t subChunk;
SubPrefix(): addChunk(0), subChunk(0) {}
uint32 Chunk() const { return subChunk; }
uint32 AddChunk() const { return addChunk; }
uint32_t Chunk() const { return subChunk; }
uint32_t AddChunk() const { return addChunk; }
const Prefix &PrefixHash() const { return prefix; }
template<class T>
@ -204,13 +204,13 @@ struct SubComplete {
Prefix prefix;
Completion complete;
} hash;
uint32 addChunk;
uint32 subChunk;
uint32_t addChunk;
uint32_t subChunk;
SubComplete() : addChunk(0), subChunk(0) {}
uint32 Chunk() const { return subChunk; }
uint32 AddChunk() const { return addChunk; }
uint32_t Chunk() const { return subChunk; }
uint32_t AddChunk() const { return addChunk; }
const Prefix &PrefixHash() const { return hash.prefix; }
const Completion &CompleteHash() const { return hash.complete; }

Просмотреть файл

@ -58,35 +58,35 @@
// LSB uncompressed.
//
// byte sliced (numValues) data format:
// uint32 compressed-size
// uint32_t compressed-size
// compressed-size bytes zlib DEFLATE data
// 0...numValues byte MSB of 4-byte numValues data
// uint32 compressed-size
// uint32_t compressed-size
// compressed-size bytes zlib DEFLATE data
// 0...numValues byte 2nd byte of 4-byte numValues data
// uint32 compressed-size
// uint32_t compressed-size
// compressed-size bytes zlib DEFLATE data
// 0...numValues byte 3rd byte of 4-byte numValues data
// 0...numValues byte LSB of 4-byte numValues data
//
// Store data format:
// uint32 magic
// uint32 version
// uint32 numAddChunks
// uint32 numSubChunks
// uint32 numAddPrefixes
// uint32 numSubPrefixes
// uint32 numAddCompletes
// uint32 numSubCompletes
// 0...numAddChunks uint32 addChunk
// 0...numSubChunks uint32 subChunk
// byte sliced (numAddPrefixes) uint32 add chunk of AddPrefixes
// byte sliced (numSubPrefixes) uint32 add chunk of SubPrefixes
// byte sliced (numSubPrefixes) uint32 sub chunk of SubPrefixes
// byte sliced (numSubPrefixes) uint32 SubPrefixes
// 0...numAddCompletes 32-byte Completions + uint32 addChunk
// 0...numSubCompletes 32-byte Completions + uint32 addChunk
// + uint32 subChunk
// uint32_t magic
// uint32_t version
// uint32_t numAddChunks
// uint32_t numSubChunks
// uint32_t numAddPrefixes
// uint32_t numSubPrefixes
// uint32_t numAddCompletes
// uint32_t numSubCompletes
// 0...numAddChunks uint32_t addChunk
// 0...numSubChunks uint32_t subChunk
// byte sliced (numAddPrefixes) uint32_t add chunk of AddPrefixes
// byte sliced (numSubPrefixes) uint32_t add chunk of SubPrefixes
// byte sliced (numSubPrefixes) uint32_t sub chunk of SubPrefixes
// byte sliced (numSubPrefixes) uint32_t SubPrefixes
// 0...numAddCompletes 32-byte Completions + uint32_t addChunk
// 0...numSubCompletes 32-byte Completions + uint32_t addChunk
// + uint32_t subChunk
// 16-byte MD5 of all preceding data
// Name of the SafeBrowsing store
@ -117,8 +117,8 @@ extern PRLogModuleInfo *gUrlClassifierDbServiceLog;
namespace mozilla {
namespace safebrowsing {
const uint32 STORE_MAGIC = 0x1231af3b;
const uint32 CURRENT_VERSION = 2;
const uint32_t STORE_MAGIC = 0x1231af3b;
const uint32_t CURRENT_VERSION = 2;
void
TableUpdate::NewAddPrefix(uint32_t aAddChunk, const Prefix& aHash)
@ -314,7 +314,7 @@ HashStore::CalculateChecksum(nsAutoCString& aChecksum,
NS_ENSURE_SUCCESS(rv, rv);
// Size of MD5 hash in bytes
const uint32 CHECKSUM_SIZE = 16;
const uint32_t CHECKSUM_SIZE = 16;
rv = hash->Init(nsICryptoHash::MD5);
NS_ENSURE_SUCCESS(rv, rv);
@ -379,8 +379,8 @@ HashStore::ReadHashes()
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mInputStream);
uint32 offset = sizeof(Header);
offset += (mHeader.numAddChunks + mHeader.numSubChunks) * sizeof(uint32);
uint32_t offset = sizeof(Header);
offset += (mHeader.numAddChunks + mHeader.numSubChunks) * sizeof(uint32_t);
nsresult rv = seekable->Seek(nsISeekableStream::NS_SEEK_SET, offset);
rv = ReadAddPrefixes();
@ -673,7 +673,7 @@ ByteSliceRead(nsIInputStream* aInStream, nsTArray<uint32_t>* aData, uint32_t cou
aData->SetCapacity(count);
for (uint32 i = 0; i < count; i++) {
for (uint32_t i = 0; i < count; i++) {
aData->AppendElement((slice1[i] << 24) | (slice2[i] << 16)
| (slice3[i] << 8) | (slice4[i]));
}
@ -718,7 +718,7 @@ HashStore::ReadSubPrefixes()
NS_ENSURE_SUCCESS(rv, rv);
mSubPrefixes.SetCapacity(count);
for (uint32 i = 0; i < count; i++) {
for (uint32_t i = 0; i < count; i++) {
SubPrefix *sub = mSubPrefixes.AppendElement();
sub->addChunk = addchunks[i];
sub->prefix.FromUint32(prefixes[i]);
@ -736,7 +736,7 @@ HashStore::WriteAddPrefixes(nsIOutputStream* aOut)
uint32_t count = mAddPrefixes.Length();
chunks.SetCapacity(count);
for (uint32 i = 0; i < count; i++) {
for (uint32_t i = 0; i < count; i++) {
chunks.AppendElement(mAddPrefixes[i].Chunk());
}
@ -757,7 +757,7 @@ HashStore::WriteSubPrefixes(nsIOutputStream* aOut)
subchunks.SetCapacity(count);
prefixes.SetCapacity(count);
for (uint32 i = 0; i < count; i++) {
for (uint32_t i = 0; i < count; i++) {
addchunks.AppendElement(mSubPrefixes[i].AddChunk());
prefixes.AppendElement(mSubPrefixes[i].PrefixHash().ToUint32());
subchunks.AppendElement(mSubPrefixes[i].Chunk());
@ -828,8 +828,8 @@ template <class T>
static void
Erase(nsTArray<T>* array, T* iterStart, T* iterEnd)
{
uint32 start = iterStart - array->Elements();
uint32 count = iterEnd - iterStart;
uint32_t start = iterStart - array->Elements();
uint32_t count = iterEnd - iterStart;
if (count > 0) {
array->RemoveElementsAt(start, count);
@ -863,7 +863,7 @@ KnockoutSubs(nsTArray<TSub>* aSubs, nsTArray<TAdd>* aAdds)
while (addIter != addEnd && subIter != subEnd) {
// additer compare, so it compares on add chunk
int32 cmp = addIter->Compare(*subIter);
int32_t cmp = addIter->Compare(*subIter);
if (cmp > 0) {
// If |*sub_iter| < |*add_iter|, retain the sub.
*subOut = *subIter;
@ -900,7 +900,7 @@ RemoveMatchingPrefixes(const SubPrefixArray& aSubs, nsTArray<T>* aFullHashes)
SubPrefix const * removeEnd = aSubs.Elements() + aSubs.Length();
while (hashIter != hashEnd && removeIter != removeEnd) {
int32 cmp = removeIter->CompareAlt(*hashIter);
int32_t cmp = removeIter->CompareAlt(*hashIter);
if (cmp > 0) {
// Keep items less than |*removeIter|.
*out = *hashIter;
@ -1006,13 +1006,13 @@ HashStore::ProcessSubs()
nsresult
HashStore::AugmentAdds(const nsTArray<uint32_t>& aPrefixes)
{
uint32 cnt = aPrefixes.Length();
uint32_t cnt = aPrefixes.Length();
if (cnt != mAddPrefixes.Length()) {
LOG(("Amount of prefixes in cache not consistent with store (%d vs %d)",
aPrefixes.Length(), mAddPrefixes.Length()));
return NS_ERROR_FAILURE;
}
for (uint32 i = 0; i < cnt; i++) {
for (uint32_t i = 0; i < cnt; i++) {
mAddPrefixes[i].prefix.FromUint32(aPrefixes[i]);
}
return NS_OK;

Просмотреть файл

@ -131,14 +131,14 @@ private:
nsresult ProcessSubs();
struct Header {
uint32 magic;
uint32 version;
uint32 numAddChunks;
uint32 numSubChunks;
uint32 numAddPrefixes;
uint32 numSubPrefixes;
uint32 numAddCompletes;
uint32 numSubCompletes;
uint32_t magic;
uint32_t version;
uint32_t numAddChunks;
uint32_t numSubChunks;
uint32_t numAddPrefixes;
uint32_t numSubPrefixes;
uint32_t numAddCompletes;
uint32_t numSubCompletes;
};
Header mHeader;

Просмотреть файл

@ -21,9 +21,9 @@
// PrefixSet.
// Data format for the ".cache" files:
// uint32 magic Identify the file type
// uint32 version Version identifier for file format
// uint32 numCompletions Amount of completions stored
// uint32_t magic Identify the file type
// uint32_t version Version identifier for file format
// uint32_t numCompletions Amount of completions stored
// 0...numCompletions 256-bit Completions
// Name of the lookupcomplete cache
@ -45,8 +45,8 @@ extern PRLogModuleInfo *gUrlClassifierDbServiceLog;
namespace mozilla {
namespace safebrowsing {
const uint32 LOOKUPCACHE_MAGIC = 0x1231af3e;
const uint32 CURRENT_VERSION = 1;
const uint32_t LOOKUPCACHE_MAGIC = 0x1231af3e;
const uint32_t CURRENT_VERSION = 1;
LookupCache::LookupCache(const nsACString& aTableName, nsIFile* aStoreDir,
bool aPerClientRandomize)
@ -159,7 +159,7 @@ LookupCache::Build(AddPrefixArray& aAddPrefixes,
mCompletions.Clear();
mCompletions.SetCapacity(aAddCompletes.Length());
for (uint32 i = 0; i < aAddCompletes.Length(); i++) {
for (uint32_t i = 0; i < aAddCompletes.Length(); i++) {
mCompletions.AppendElement(aAddCompletes[i].CompleteHash());
}
aAddCompletes.Clear();
@ -182,7 +182,7 @@ LookupCache::Dump()
if (!LOG_ENABLED())
return;
for (uint32 i = 0; i < mCompletions.Length(); i++) {
for (uint32_t i = 0; i < mCompletions.Length(); i++) {
nsAutoCString str;
mCompletions[i].ToString(str);
LOG(("Completion: %s", str.get()));
@ -681,7 +681,7 @@ LookupCache::ConstructPrefixSet(AddPrefixArray& aAddPrefixes)
nsTArray<uint32_t> array;
array.SetCapacity(aAddPrefixes.Length());
for (uint32 i = 0; i < aAddPrefixes.Length(); i++) {
for (uint32_t i = 0; i < aAddPrefixes.Length(); i++) {
array.AppendElement(aAddPrefixes[i].PrefixHash().ToUint32());
}
aAddPrefixes.Clear();

Просмотреть файл

@ -139,9 +139,9 @@ private:
nsresult ConstructPrefixSet(AddPrefixArray& aAddPrefixes);
struct Header {
uint32 magic;
uint32 version;
uint32 numCompletions;
uint32_t magic;
uint32_t version;
uint32_t numCompletions;
};
Header mHeader;

Просмотреть файл

@ -27,9 +27,9 @@ namespace mozilla {
namespace safebrowsing {
// Updates will fail if fed chunks larger than this
const uint32 MAX_CHUNK_SIZE = (1024 * 1024);
const uint32_t MAX_CHUNK_SIZE = (1024 * 1024);
const uint32 DOMAIN_SIZE = 4;
const uint32_t DOMAIN_SIZE = 4;
// Parse one stringified range of chunks of the form "n" or "n-m" from a
// comma-separated list of chunks. Upon return, 'begin' will point to the
@ -431,7 +431,7 @@ ProtocolParser::ProcessPlaintextChunk(const nsACString& aChunk)
ParseString(PromiseFlatCString(aChunk), '\n', lines);
// non-hashed tables need to be hashed
for (uint32 i = 0; i < lines.Length(); i++) {
for (uint32_t i = 0; i < lines.Length(); i++) {
nsCString& line = lines[i];
if (mChunkState.type == CHUNK_ADD) {
@ -459,7 +459,7 @@ ProtocolParser::ProcessPlaintextChunk(const nsACString& aChunk)
line.BeginReading(begin);
line.EndReading(end);
iter = begin;
uint32 addChunk;
uint32_t addChunk;
if (!FindCharInReadable(':', iter, end) ||
PR_sscanf(lines[i].get(), "%d:", &addChunk) != 1) {
NS_WARNING("Received sub chunk without associated add chunk.");
@ -507,7 +507,7 @@ ProtocolParser::ProcessShaChunk(const nsACString& aChunk)
start += DOMAIN_SIZE;
// Then a count of entries.
uint8 numEntries = static_cast<uint8>(aChunk[start]);
uint8_t numEntries = static_cast<uint8_t>(aChunk[start]);
start++;
nsresult rv;
@ -557,7 +557,7 @@ ProtocolParser::ProcessHostAdd(const Prefix& aDomain, uint8_t aNumEntries,
return NS_ERROR_FAILURE;
}
for (uint8 i = 0; i < aNumEntries; i++) {
for (uint8_t i = 0; i < aNumEntries; i++) {
Prefix hash;
hash.Assign(Substring(aChunk, *aStart, PREFIX_SIZE));
nsresult rv = LookupCache::KeyedHash(hash.ToUint32(), domHash, mHashKey, &codedHash,
@ -591,7 +591,7 @@ ProtocolParser::ProcessHostSub(const Prefix& aDomain, uint8_t aNumEntries,
const nsCSubstring& addChunkStr = Substring(aChunk, *aStart, 4);
*aStart += 4;
uint32 addChunk;
uint32_t addChunk;
memcpy(&addChunk, addChunkStr.BeginReading(), 4);
addChunk = PR_ntohl(addChunk);
@ -614,11 +614,11 @@ ProtocolParser::ProcessHostSub(const Prefix& aDomain, uint8_t aNumEntries,
return NS_ERROR_FAILURE;
}
for (uint8 i = 0; i < aNumEntries; i++) {
for (uint8_t i = 0; i < aNumEntries; i++) {
const nsCSubstring& addChunkStr = Substring(aChunk, *aStart, 4);
*aStart += 4;
uint32 addChunk;
uint32_t addChunk;
memcpy(&addChunk, addChunkStr.BeginReading(), 4);
addChunk = PR_ntohl(addChunk);
@ -660,7 +660,7 @@ ProtocolParser::ProcessHostAddComplete(uint8_t aNumEntries,
return NS_ERROR_FAILURE;
}
for (uint8 i = 0; i < aNumEntries; i++) {
for (uint8_t i = 0; i < aNumEntries; i++) {
Completion hash;
hash.Assign(Substring(aChunk, *aStart, COMPLETE_SIZE));
mTableUpdate->NewAddComplete(mChunkState.num, hash);
@ -696,7 +696,7 @@ ProtocolParser::ProcessHostSubComplete(uint8_t aNumEntries,
const nsCSubstring& addChunkStr = Substring(aChunk, *aStart, 4);
*aStart += 4;
uint32 addChunk;
uint32_t addChunk;
memcpy(&addChunk, addChunkStr.BeginReading(), 4);
addChunk = PR_ntohl(addChunk);
@ -709,7 +709,7 @@ ProtocolParser::ProcessHostSubComplete(uint8_t aNumEntries,
bool
ProtocolParser::NextLine(nsACString& line)
{
int32 newline = mPending.FindChar('\n');
int32_t newline = mPending.FindChar('\n');
if (newline == kNotFound) {
return false;
}
@ -721,7 +721,7 @@ ProtocolParser::NextLine(nsACString& line)
void
ProtocolParser::CleanupUpdates()
{
for (uint32 i = 0; i < mTableUpdates.Length(); i++) {
for (uint32_t i = 0; i < mTableUpdates.Length(); i++) {
delete mTableUpdates[i];
}
mTableUpdates.Clear();
@ -730,7 +730,7 @@ ProtocolParser::CleanupUpdates()
TableUpdate *
ProtocolParser::GetTableUpdate(const nsACString& aTable)
{
for (uint32 i = 0; i < mTableUpdates.Length(); i++) {
for (uint32_t i = 0; i < mTableUpdates.Length(); i++) {
if (aTable.Equals(mTableUpdates[i]->TableName())) {
return mTableUpdates[i];
}

Просмотреть файл

@ -47,7 +47,7 @@ public:
// Update information.
const nsTArray<ForwardedUpdate> &Forwards() const { return mForwards; }
int32 UpdateWait() { return mUpdateWait; }
int32_t UpdateWait() { return mUpdateWait; }
bool ResetRequested() { return mResetRequested; }
bool RekeyRequested() { return mRekeyRequested; }
@ -86,9 +86,9 @@ private:
struct ChunkState {
ChunkType type;
uint32 num;
uint32 hashSize;
uint32 length;
uint32_t num;
uint32_t hashSize;
uint32_t length;
void Clear() { num = 0; hashSize = 0; length = 0; }
};
ChunkState mChunkState;
@ -103,7 +103,7 @@ private:
nsCOMPtr<nsICryptoHMAC> mHMAC;
nsCString mServerMAC;
uint32 mUpdateWait;
uint32_t mUpdateWait;
bool mResetRequested;
bool mRekeyRequested;

Просмотреть файл

@ -50,7 +50,7 @@ nsCheckSummedOutputStream::Finish()
NS_IMETHODIMP
nsCheckSummedOutputStream::Write(const char *buf, uint32_t count, uint32_t *result)
{
nsresult rv = mHash->Update(reinterpret_cast<const uint8*>(buf), count);
nsresult rv = mHash->Update(reinterpret_cast<const uint8_t*>(buf), count);
NS_ENSURE_SUCCESS(rv, rv);
return nsSafeFileOutputStream::Write(buf, count, result);

Просмотреть файл

@ -570,7 +570,7 @@ nsUrlClassifierDBServiceWorker::FinishStream()
// XXX: Only allow forwards from the initial update?
const nsTArray<ProtocolParser::ForwardedUpdate> &forwards =
mProtocolParser->Forwards();
for (uint32 i = 0; i < forwards.Length(); i++) {
for (uint32_t i = 0; i < forwards.Length(); i++) {
const ProtocolParser::ForwardedUpdate &forward = forwards[i];
mUpdateObserver->UpdateUrlRequested(forward.url, forward.table, forward.mac);
}
@ -983,7 +983,7 @@ nsUrlClassifierLookupCallback::HandleResults()
// until the next update.
nsAutoPtr<PrefixArray> cacheMisses(new PrefixArray());
if (cacheMisses) {
for (uint32 i = 0; i < mResults->Length(); i++) {
for (uint32_t i = 0; i < mResults->Length(); i++) {
LookupResult &result = mResults->ElementAt(i);
if (!result.Confirmed()) {
cacheMisses->AppendElement(result.PrefixHash());

Просмотреть файл

@ -71,7 +71,7 @@ typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action,
void *);
/* The C++ ABI requires exception_class, private_1, and private_2 to
be of type uint64 and the entire structure to be
be of type uint64_t and the entire structure to be
double-word-aligned. Please note that exception_class stays 64-bit
even on 32-bit machines for gcc compatibility. */
struct _Unwind_Exception

Просмотреть файл

@ -36,7 +36,7 @@ static int js_mode = 0;
static int do_tree_dump = 0;
static int unified_output = 0;
static char *function_dump = NULL;
static uint32 min_subtotal = 0;
static uint32_t min_subtotal = 0;
static void compute_callsite_totals(tmcallsite *site)
{
@ -205,7 +205,7 @@ static int tabulate_node(PLHashEntry *he, int i, void *arg)
static int node_table_compare(const void *p1, const void *p2)
{
const tmgraphnode *node1, *node2;
uint32 key1, key2;
uint32_t key1, key2;
node1 = *(const tmgraphnode**) p1;
node2 = *(const tmgraphnode**) p2;
@ -239,7 +239,7 @@ static int mean_size_compare(const void *p1, const void *p2)
return 0;
}
static const char *prettybig(uint32 num, char *buf, size_t limit)
static const char *prettybig(uint32_t num, char *buf, size_t limit)
{
if (num >= 1000000000)
PR_snprintf(buf, limit, "%1.2fG", (double) num / 1e9);
@ -252,7 +252,7 @@ static const char *prettybig(uint32 num, char *buf, size_t limit)
return buf;
}
static double percent(uint32 num, uint32 total)
static double percent(uint32_t num, uint32_t total)
{
if (num == 0)
return 0.0;
@ -311,7 +311,7 @@ static void dump_graphlink_list(tmgraphlink *list, int which, const char *name,
static void dump_graph(tmreader *tmr, PLHashTable *hashtbl, const char *varname,
const char *title, FILE *fp)
{
uint32 i, count;
uint32_t i, count;
tmgraphnode **table, *node;
char *name;
size_t namelen;
@ -461,8 +461,8 @@ static void dump_graph(tmreader *tmr, PLHashTable *hashtbl, const char *varname,
"</tr>\n",
(namelen > 65) ? 45 : (int)namelen, name,
(namelen > 65) ? "<i>...</i>" : "",
prettybig((uint32)mean, buf1, sizeof buf1),
prettybig((uint32)sigma, buf2, sizeof buf2),
prettybig((uint32_t)mean, buf1, sizeof buf1),
prettybig((uint32_t)sigma, buf2, sizeof buf2),
prettybig(node->allocs.calls.direct, buf3, sizeof buf3));
}
fputs("</table>\n", fp);

Просмотреть файл

@ -25,12 +25,12 @@ int optind=1;
static char *program;
typedef struct handler_data {
uint32 current_heapsize;
uint32 max_heapsize;
uint32 bytes_allocated;
uint32 current_allocations;
uint32 total_allocations;
uint32 unmatched_frees;
uint32_t current_heapsize;
uint32_t max_heapsize;
uint32_t bytes_allocated;
uint32_t current_allocations;
uint32_t total_allocations;
uint32_t unmatched_frees;
int finished;
} handler_data;

Просмотреть файл

@ -224,7 +224,7 @@ DHWImportHooker::PatchOneModule(HMODULE aModule, const char* name)
// do the fun stuff...
PIMAGE_IMPORT_DESCRIPTOR desc;
uint32 size;
uint32_t size;
desc = (PIMAGE_IMPORT_DESCRIPTOR)
dhwImageDirectoryEntryToData(aModule, true,

Просмотреть файл

@ -96,8 +96,8 @@ struct logfile {
char *buf;
int bufsize;
int pos;
uint32 size;
uint32 simsize;
uint32_t size;
uint32_t simsize;
logfile *next;
logfile **prevp;
};
@ -125,12 +125,12 @@ static char sdlogname[PATH_MAX] = ""; /* filename for shutdown leak log */
* It must default to zero, since it can be tested by the Linux malloc
* hooks before NS_TraceMallocStartup sets it.
*/
static uint32 tracing_enabled = 0;
static uint32_t tracing_enabled = 0;
/*
* Control whether we should log stacks
*/
static uint32 stacks_enabled = 1;
static uint32_t stacks_enabled = 1;
/*
* This lock must be held while manipulating the calltree, the
@ -268,13 +268,13 @@ tm_get_thread(void)
}
/* We don't want more than 32 logfiles open at once, ok? */
typedef uint32 lfd_set;
typedef uint32_t lfd_set;
#define LFD_SET_STATIC_INITIALIZER 0
#define LFD_SET_SIZE 32
#define LFD_ZERO(s) (*(s) = 0)
#define LFD_BIT(i) ((uint32)1 << (i))
#define LFD_BIT(i) ((uint32_t)1 << (i))
#define LFD_TEST(i,s) (LFD_BIT(i) & *(s))
#define LFD_SET(i,s) (*(s) |= LFD_BIT(i))
#define LFD_CLR(i,s) (*(s) &= ~LFD_BIT(i))
@ -382,7 +382,7 @@ static void log_filename(logfile* fp, const char* filename)
log_string(fp, filename);
}
static void log_uint32(logfile *fp, uint32 ival)
static void log_uint32(logfile *fp, uint32_t ival)
{
if (ival < 0x80) {
/* 0xxx xxxx */
@ -412,57 +412,57 @@ static void log_uint32(logfile *fp, uint32 ival)
}
}
static void log_event1(logfile *fp, char event, uint32 serial)
static void log_event1(logfile *fp, char event, uint32_t serial)
{
log_byte(fp, event);
log_uint32(fp, (uint32) serial);
log_uint32(fp, (uint32_t) serial);
}
static void log_event2(logfile *fp, char event, uint32 serial, size_t size)
static void log_event2(logfile *fp, char event, uint32_t serial, size_t size)
{
log_event1(fp, event, serial);
log_uint32(fp, (uint32) size);
log_uint32(fp, (uint32_t) size);
}
static void log_event3(logfile *fp, char event, uint32 serial, size_t oldsize,
static void log_event3(logfile *fp, char event, uint32_t serial, size_t oldsize,
size_t size)
{
log_event2(fp, event, serial, oldsize);
log_uint32(fp, (uint32) size);
log_uint32(fp, (uint32_t) size);
}
static void log_event4(logfile *fp, char event, uint32 serial, uint32 ui2,
uint32 ui3, uint32 ui4)
static void log_event4(logfile *fp, char event, uint32_t serial, uint32_t ui2,
uint32_t ui3, uint32_t ui4)
{
log_event3(fp, event, serial, ui2, ui3);
log_uint32(fp, ui4);
}
static void log_event5(logfile *fp, char event, uint32 serial, uint32 ui2,
uint32 ui3, uint32 ui4, uint32 ui5)
static void log_event5(logfile *fp, char event, uint32_t serial, uint32_t ui2,
uint32_t ui3, uint32_t ui4, uint32_t ui5)
{
log_event4(fp, event, serial, ui2, ui3, ui4);
log_uint32(fp, ui5);
}
static void log_event6(logfile *fp, char event, uint32 serial, uint32 ui2,
uint32 ui3, uint32 ui4, uint32 ui5, uint32 ui6)
static void log_event6(logfile *fp, char event, uint32_t serial, uint32_t ui2,
uint32_t ui3, uint32_t ui4, uint32_t ui5, uint32_t ui6)
{
log_event5(fp, event, serial, ui2, ui3, ui4, ui5);
log_uint32(fp, ui6);
}
static void log_event7(logfile *fp, char event, uint32 serial, uint32 ui2,
uint32 ui3, uint32 ui4, uint32 ui5, uint32 ui6,
uint32 ui7)
static void log_event7(logfile *fp, char event, uint32_t serial, uint32_t ui2,
uint32_t ui3, uint32_t ui4, uint32_t ui5, uint32_t ui6,
uint32_t ui7)
{
log_event6(fp, event, serial, ui2, ui3, ui4, ui5, ui6);
log_uint32(fp, ui7);
}
static void log_event8(logfile *fp, char event, uint32 serial, uint32 ui2,
uint32 ui3, uint32 ui4, uint32 ui5, uint32 ui6,
uint32 ui7, uint32 ui8)
static void log_event8(logfile *fp, char event, uint32_t serial, uint32_t ui2,
uint32_t ui3, uint32_t ui4, uint32_t ui5, uint32_t ui6,
uint32_t ui7, uint32_t ui8)
{
log_event7(fp, event, serial, ui2, ui3, ui4, ui5, ui6, ui7);
log_uint32(fp, ui8);
@ -472,7 +472,7 @@ typedef struct callsite callsite;
struct callsite {
void* pc;
uint32 serial;
uint32_t serial;
lfd_set lfdset;
const char *name; /* pointer to string owned by methods table */
const char *library; /* pointer to string owned by libraries table */
@ -483,11 +483,11 @@ struct callsite {
};
/* NB: these counters are incremented and decremented only within tmlock. */
static uint32 library_serial_generator = 0;
static uint32 method_serial_generator = 0;
static uint32 callsite_serial_generator = 0;
static uint32 tmstats_serial_generator = 0;
static uint32 filename_serial_generator = 0;
static uint32_t library_serial_generator = 0;
static uint32_t method_serial_generator = 0;
static uint32_t callsite_serial_generator = 0;
static uint32_t tmstats_serial_generator = 0;
static uint32_t filename_serial_generator = 0;
/* Root of the tree of callsites, the sum of all (cycle-compressed) stacks. */
static callsite calltree_root =
@ -593,10 +593,10 @@ calltree(void **stack, size_t num_stack_entries, tm_thread *t)
{
logfile *fp = logfp;
void *pc;
uint32 nkids;
uint32_t nkids;
callsite *parent, *site, **csp, *tmp;
int maxstack;
uint32 library_serial, method_serial, filename_serial;
uint32_t library_serial, method_serial, filename_serial;
const char *library, *method, *filename;
char *slash;
PLHashNumber hash;
@ -718,7 +718,7 @@ calltree(void **stack, size_t num_stack_entries, tm_thread *t)
he = *hep;
if (he) {
library = (char*) he->key;
library_serial = (uint32) NS_PTR_TO_INT32(he->value);
library_serial = (uint32_t) NS_PTR_TO_INT32(he->value);
le = (lfdset_entry *) he;
if (LFD_TEST(fp->lfd, &le->lfdset)) {
/* We already logged an event on fp for this library. */
@ -765,7 +765,7 @@ calltree(void **stack, size_t num_stack_entries, tm_thread *t)
he = *hep;
if (he) {
filename = (char*) he->key;
filename_serial = (uint32) NS_PTR_TO_INT32(he->value);
filename_serial = (uint32_t) NS_PTR_TO_INT32(he->value);
le = (lfdset_entry *) he;
if (LFD_TEST(fp->lfd, &le->lfdset)) {
/* We already logged an event on fp for this filename. */
@ -812,7 +812,7 @@ calltree(void **stack, size_t num_stack_entries, tm_thread *t)
he = *hep;
if (he) {
method = (char*) he->key;
method_serial = (uint32) NS_PTR_TO_INT32(he->value);
method_serial = (uint32_t) NS_PTR_TO_INT32(he->value);
le = (lfdset_entry *) he;
if (LFD_TEST(fp->lfd, &le->lfdset)) {
/* We already logged an event on fp for this method. */
@ -1315,7 +1315,7 @@ static const char magic[] = NS_TRACE_MALLOC_MAGIC;
static void
log_header(int logfd)
{
uint32 ticksPerSec = PR_htonl(PR_TicksPerSecond());
uint32_t ticksPerSec = PR_htonl(PR_TicksPerSecond());
(void) write(logfd, magic, NS_TRACE_MALLOC_MAGIC_SIZE);
(void) write(logfd, &ticksPerSec, sizeof ticksPerSec);
}
@ -1557,7 +1557,7 @@ NS_TraceMallocDisable(void)
{
tm_thread *t = tm_get_thread();
logfile *fp;
uint32 sample;
uint32_t sample;
/* Robustify in case of duplicate call. */
PR_ASSERT(tracing_enabled);
@ -1577,7 +1577,7 @@ PR_IMPLEMENT(void)
NS_TraceMallocEnable(void)
{
tm_thread *t = tm_get_thread();
uint32 sample;
uint32_t sample;
TM_SUPPRESS_TRACING_AND_ENTER_LOCK(t);
sample = ++tracing_enabled;
@ -1691,13 +1691,13 @@ NS_TraceMallocLogTimestamp(const char *caption)
#ifdef XP_UNIX
gettimeofday(&tv, NULL);
log_uint32(fp, (uint32) tv.tv_sec);
log_uint32(fp, (uint32) tv.tv_usec);
log_uint32(fp, (uint32_t) tv.tv_sec);
log_uint32(fp, (uint32_t) tv.tv_usec);
#endif
#ifdef XP_WIN32
_ftime(&tb);
log_uint32(fp, (uint32) tb.time);
log_uint32(fp, (uint32) tb.millitm);
log_uint32(fp, (uint32_t) tb.time);
log_uint32(fp, (uint32_t) tb.millitm);
#endif
log_string(fp, caption);
@ -1848,7 +1848,7 @@ MallocCallback(void *ptr, size_t size, uint32_t start, uint32_t end, tm_thread *
if (site) {
log_event5(logfp, TM_EVENT_MALLOC,
site->serial, start, end - start,
(uint32)NS_PTR_TO_INT32(ptr), size);
(uint32_t)NS_PTR_TO_INT32(ptr), size);
}
if (get_allocations()) {
he = PL_HashTableAdd(allocations, ptr, site);
@ -1886,7 +1886,7 @@ CallocCallback(void *ptr, size_t count, size_t size, uint32_t start, uint32_t en
if (site) {
log_event5(logfp, TM_EVENT_CALLOC,
site->serial, start, end - start,
(uint32)NS_PTR_TO_INT32(ptr), size);
(uint32_t)NS_PTR_TO_INT32(ptr), size);
}
if (get_allocations()) {
he = PL_HashTableAdd(allocations, ptr, site);
@ -1953,9 +1953,9 @@ ReallocCallback(void * oldptr, void *ptr, size_t size,
if (site) {
log_event8(logfp, TM_EVENT_REALLOC,
site->serial, start, end - start,
(uint32)NS_PTR_TO_INT32(ptr), size,
(uint32_t)NS_PTR_TO_INT32(ptr), size,
oldsite ? oldsite->serial : 0,
(uint32)NS_PTR_TO_INT32(oldptr), oldsize);
(uint32_t)NS_PTR_TO_INT32(oldptr), oldsize);
}
if (ptr && allocations) {
if (ptr != oldptr) {
@ -2021,7 +2021,7 @@ FreeCallback(void * ptr, uint32_t start, uint32_t end, tm_thread *t)
}
log_event5(logfp, TM_EVENT_FREE,
site->serial, start, end - start,
(uint32)NS_PTR_TO_INT32(ptr), alloc->size);
(uint32_t)NS_PTR_TO_INT32(ptr), alloc->size);
}
PL_HashTableRawRemove(allocations, hep, he);
}

Просмотреть файл

@ -28,7 +28,7 @@ struct tm_thread {
* This counter suppresses tracing, in case any tracing code needs
* to malloc.
*/
uint32 suppress_tracing;
uint32_t suppress_tracing;
/* buffer for backtrace, below */
stack_buffer_info backtrace_buf;

Просмотреть файл

@ -24,7 +24,7 @@
#undef DEBUG_tmreader
static int accum_byte(FILE *fp, uint32 *uip)
static int accum_byte(FILE *fp, uint32_t *uip)
{
int c = getc(fp);
if (c == EOF)
@ -33,10 +33,10 @@ static int accum_byte(FILE *fp, uint32 *uip)
return 1;
}
static int get_uint32(FILE *fp, uint32 *uip)
static int get_uint32(FILE *fp, uint32_t *uip)
{
int c;
uint32 ui;
uint32_t ui;
c = getc(fp);
if (c == EOF)
@ -52,22 +52,22 @@ static int get_uint32(FILE *fp, uint32 *uip)
if (!accum_byte(fp, &ui))
return 0;
} else {
ui = (uint32) c;
ui = (uint32_t) c;
}
if (!accum_byte(fp, &ui))
return 0;
} else {
ui = (uint32) c;
ui = (uint32_t) c;
}
if (!accum_byte(fp, &ui))
return 0;
} else {
ui = (uint32) c;
ui = (uint32_t) c;
}
if (!accum_byte(fp, &ui))
return 0;
} else {
ui = (uint32) c;
ui = (uint32_t) c;
}
*uip = ui;
return 1;
@ -700,7 +700,7 @@ int tmreader_eventloop(tmreader *tmr, const char *filename,
case TM_EVENT_CALLOC:
case TM_EVENT_REALLOC: {
tmcallsite *site;
uint32 size, oldsize;
uint32_t size, oldsize;
double delta, sqdelta, sqszdelta = 0;
tmgraphnode *comp, *lib;
tmmethodnode *meth;
@ -756,7 +756,7 @@ int tmreader_eventloop(tmreader *tmr, const char *filename,
case TM_EVENT_FREE: {
tmcallsite *site;
uint32 size;
uint32_t size;
tmgraphnode *comp, *lib;
tmmethodnode *meth;
@ -797,7 +797,7 @@ int tmreader_eventloop(tmreader *tmr, const char *filename,
return 1;
}
tmgraphnode *tmreader_library(tmreader *tmr, uint32 serial)
tmgraphnode *tmreader_library(tmreader *tmr, uint32_t serial)
{
const void *key;
PLHashNumber hash;
@ -807,7 +807,7 @@ tmgraphnode *tmreader_library(tmreader *tmr, uint32 serial)
return (tmgraphnode*) *PL_HashTableRawLookup(tmr->libraries, hash, key);
}
tmgraphnode *tmreader_filename(tmreader *tmr, uint32 serial)
tmgraphnode *tmreader_filename(tmreader *tmr, uint32_t serial)
{
const void *key;
PLHashNumber hash;
@ -825,7 +825,7 @@ tmgraphnode *tmreader_component(tmreader *tmr, const char *name)
return (tmgraphnode*) *PL_HashTableRawLookup(tmr->components, hash, name);
}
tmmethodnode *tmreader_method(tmreader *tmr, uint32 serial)
tmmethodnode *tmreader_method(tmreader *tmr, uint32_t serial)
{
const void *key;
PLHashNumber hash;
@ -835,7 +835,7 @@ tmmethodnode *tmreader_method(tmreader *tmr, uint32 serial)
return (tmmethodnode*) *PL_HashTableRawLookup(tmr->methods, hash, key);
}
tmcallsite *tmreader_callsite(tmreader *tmr, uint32 serial)
tmcallsite *tmreader_callsite(tmreader *tmr, uint32_t serial)
{
const void *key;
PLHashNumber hash;

Просмотреть файл

@ -27,41 +27,41 @@ typedef struct tmmethodnode tmmethodnode;
struct tmevent {
char type;
uint32 serial;
uint32_t serial;
union {
char *libname;
char *srcname;
struct {
uint32 library;
uint32 filename;
uint32 linenumber;
uint32_t library;
uint32_t filename;
uint32_t linenumber;
char *name;
} method;
struct {
uint32 parent;
uint32 method;
uint32 offset;
uint32_t parent;
uint32_t method;
uint32_t offset;
} site;
struct {
uint32 interval; /* in ticks */
uint32 ptr;
uint32 size;
uint32 oldserial;
uint32 oldptr;
uint32 oldsize;
uint32 cost; /* in ticks */
uint32_t interval; /* in ticks */
uint32_t ptr;
uint32_t size;
uint32_t oldserial;
uint32_t oldptr;
uint32_t oldsize;
uint32_t cost; /* in ticks */
} alloc;
struct {
nsTMStats tmstats;
uint32 calltree_maxkids_parent;
uint32 calltree_maxstack_top;
uint32_t calltree_maxkids_parent;
uint32_t calltree_maxstack_top;
} stats;
} u;
};
struct tmcounts {
uint32 direct; /* things allocated by this node's code */
uint32 total; /* direct + things from all descendents */
uint32_t direct; /* things allocated by this node's code */
uint32_t total; /* direct + things from all descendents */
};
struct tmallcounts {
@ -86,13 +86,13 @@ struct tmgraphnode {
struct tmmethodnode {
tmgraphnode graphnode;
char *sourcefile;
uint32 linenumber;
uint32_t linenumber;
};
#define tmgraphnode_name(node) ((char*) (node)->entry.value)
#define tmmethodnode_name(node) ((char*) (node)->graphnode.entry.value)
#define tmlibrary_serial(lib) ((uint32) (lib)->entry.key)
#define tmlibrary_serial(lib) ((uint32_t) (lib)->entry.key)
#define tmcomponent_name(comp) ((const char*) (comp)->entry.key)
#define filename_name(hashentry) ((char*)hashentry->value)
@ -126,7 +126,7 @@ struct tmcallsite {
tmcallsite *siblings; /* other sites reached from parent */
tmcallsite *kids; /* sites reached from here */
tmmethodnode *method; /* method node in tmr->methods graph */
uint32 offset; /* pc offset from start of method */
uint32_t offset; /* pc offset from start of method */
tmallcounts allocs;
tmallcounts frees;
void *data; /* tmreader clients can stick arbitrary
@ -144,7 +144,7 @@ struct tmreader {
PLHashTable *callsites;
PLArenaPool arena;
tmcallsite calltree_root;
uint32 ticksPerSec;
uint32_t ticksPerSec;
};
typedef void (*tmeventhandler)(tmreader *tmr, tmevent *event);
@ -161,11 +161,11 @@ extern int tmreader_eventloop(tmreader *tmr, const char *filename,
tmeventhandler eventhandler);
/* Map serial number or name to graphnode or callsite. */
extern tmgraphnode *tmreader_library(tmreader *tmr, uint32 serial);
extern tmgraphnode *tmreader_filename(tmreader *tmr, uint32 serial);
extern tmgraphnode *tmreader_library(tmreader *tmr, uint32_t serial);
extern tmgraphnode *tmreader_filename(tmreader *tmr, uint32_t serial);
extern tmgraphnode *tmreader_component(tmreader *tmr, const char *name);
extern tmmethodnode *tmreader_method(tmreader *tmr, uint32 serial);
extern tmcallsite *tmreader_callsite(tmreader *tmr, uint32 serial);
extern tmmethodnode *tmreader_method(tmreader *tmr, uint32_t serial);
extern tmcallsite *tmreader_callsite(tmreader *tmr, uint32_t serial);
/*
* Connect node 'from' to node 'to' with an edge, if there isn't one already

Просмотреть файл

@ -12,7 +12,7 @@
extern "C" {
static nsresult ATTRIBUTE_USED
__attribute__ ((regparm (3)))
PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, uint32_t* args)
PrepareAndDispatch(uint32_t methodIndex, nsXPTCStubBase* self, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -24,7 +24,7 @@ invoke_count_words(uint32_t paramCount, nsXPTCVariant * s,
nr_stack = 0;
/* Compute number of eightbytes of class MEMORY. */
for (uint32 i = 0; i < paramCount; i++, s++) {
for (uint32_t i = 0; i < paramCount; i++, s++) {
if (!s->IsPtrData()
&& (s->type == nsXPTType::T_FLOAT || s->type == nsXPTType::T_DOUBLE)) {
if (nr_fpr < FPR_COUNT)
@ -49,7 +49,7 @@ invoke_copy_to_stack(uint64_t * d, uint32_t paramCount, nsXPTCVariant * s,
uint32_t nr_fpr = 0;
uint64_t value;
for (uint32 i = 0; i < paramCount; i++, s++) {
for (uint32_t i = 0; i < paramCount; i++, s++) {
if (s->IsPtrData())
value = (uint64_t) s->ptr;
else {

Просмотреть файл

@ -13,7 +13,7 @@
#include "mozilla/StandardInteger.h"
extern "C" uint32
extern "C" uint32_t
invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
{
// Count a word for a0 even though it's never stored or loaded

Просмотреть файл

@ -11,7 +11,7 @@
#error "This code is for MIPS N32 only"
#endif
extern "C" uint32
extern "C" uint32_t
invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
{
return paramCount;

Просмотреть файл

@ -98,7 +98,7 @@ XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
__asm__ __volatile__(
/* Make space for parameters to be passed to the method. Assume worst case
8 bytes per parameter. Also leave space for 3 longs and 8 floats that
will be put into registers. The worst case is all int64 parameters
will be put into registers. The worst case is all int64_t parameters
and even in this case 8 bytes are passed in registers so we can
deduct this from our allocation.
*/

Просмотреть файл

@ -95,8 +95,8 @@ invoke_copy_to_stack(uint32_t* d,
--dest;
++regwords;
}
*((uint32*) dest) = ((DU *) source)->lo;
*((uint32*) --dest) = ((DU *) source)->hi;
*((uint32_t*) dest) = ((DU *) source)->lo;
*((uint32_t*) --dest) = ((DU *) source)->hi;
/* big endian - hi word in low addr */
regwords += 2;
continue;
@ -112,8 +112,8 @@ invoke_copy_to_stack(uint32_t* d,
case 2:
floatflags |= 1;
}
*((uint32*) dest) = ((DU *) source)->lo;
*((uint32*) --dest) = ((DU *) source)->hi;
*((uint32_t*) dest) = ((DU *) source)->lo;
*((uint32_t*) --dest) = ((DU *) source)->hi;
/* big endian - hi word in low addr */
regwords += 2;
continue;

Просмотреть файл

@ -41,7 +41,7 @@ invoke_copy_to_stack(uint64_t* gpregs,
{
uint64_t tempu64;
for(uint32 i = 0; i < paramCount; i++, s++) {
for(uint32_t i = 0; i < paramCount; i++, s++) {
if(s->IsPtrData())
tempu64 = (uint64_t) s->ptr;
else {

Просмотреть файл

@ -25,12 +25,12 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s, double
double *l_fprData = fprData;
typedef struct {
uint32 hi;
uint32 lo;
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since
// stack slots are not guaranteed 16 byte aligned
for(uint32 i = 0; i < l_paramCount; i++, l_d++, l_s++)
for(uint32_t i = 0; i < l_paramCount; i++, l_d++, l_s++)
{
if(l_s->IsPtrData())
{
@ -39,31 +39,31 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s, double
}
switch(l_s->type)
{
case nsXPTType::T_I8 : *((int32*) l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int32*) l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int32*) l_d) = l_s->val.i32; break;
case nsXPTType::T_I8 : *((int32_t*) l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int32_t*) l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int32_t*) l_d) = l_s->val.i32; break;
case nsXPTType::T_I64 :
case nsXPTType::T_U64 :
*((uint32*) l_d++) = ((DU *)l_s)->hi;
*((uint32*) l_d) = ((DU *)l_s)->lo;
*((uint32_t*) l_d++) = ((DU *)l_s)->hi;
*((uint32_t*) l_d) = ((DU *)l_s)->lo;
break;
case nsXPTType::T_DOUBLE :
*((uint32*) l_d++) = ((DU *)l_s)->hi;
*((uint32*) l_d) = ((DU *)l_s)->lo;
*((uint32_t*) l_d++) = ((DU *)l_s)->hi;
*((uint32_t*) l_d) = ((DU *)l_s)->lo;
if(fpCount < 13)
l_fprData[fpCount++] = l_s->val.d;
break;
case nsXPTType::T_U8 : *((uint32*) l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint32*) l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint32*) l_d) = l_s->val.u32; break;
case nsXPTType::T_U8 : *((uint32_t*) l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint32_t*) l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint32_t*) l_d) = l_s->val.u32; break;
case nsXPTType::T_FLOAT :
*((float*) l_d) = l_s->val.f;
if(fpCount < 13)
l_fprData[fpCount++] = l_s->val.f;
break;
case nsXPTType::T_BOOL : *((uint32*) l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint32*) l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int32*) l_d) = l_s->val.wc; break;
case nsXPTType::T_BOOL : *((uint32_t*) l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint32_t*) l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int32_t*) l_d) = l_s->val.wc; break;
default:
// all the others are plain pointer types
*((void**)l_d) = l_s->val.p;

Просмотреть файл

@ -44,7 +44,7 @@ invoke_copy_to_stack(uint32_t* d,
uint32_t tempu32;
uint64_t tempu64;
for(uint32 i = 0; i < paramCount; i++, s++) {
for(uint32_t i = 0; i < paramCount; i++, s++) {
if(s->IsPtrData())
tempu32 = (uint32_t) s->ptr;
else {

Просмотреть файл

@ -40,7 +40,7 @@ invoke_copy_to_stack(uint32_t* d,
uint32_t tempu32;
uint64_t tempu64;
for(uint32 i = 0; i < paramCount; i++, s++) {
for(uint32_t i = 0; i < paramCount; i++, s++) {
if(s->IsPtrData())
tempu32 = (uint32_t) s->ptr;
else {

Просмотреть файл

@ -40,7 +40,7 @@ invoke_copy_to_stack(uint32_t* d,
uint32_t tempu32;
uint64_t tempu64;
for(uint32 i = 0; i < paramCount; i++, s++) {
for(uint32_t i = 0; i < paramCount; i++, s++) {
if(s->IsPtrData())
tempu32 = (uint32_t) s->ptr;
else {

Просмотреть файл

@ -7,7 +7,7 @@
#include "xptcprivate.h"
extern "C" uint32
extern "C" uint32_t
invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
{
uint32_t result = 0;

Просмотреть файл

@ -76,18 +76,18 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s)
from there since the parameters occupy the same stack space as the stack
we're trying to populate.
*/
uint32 *l_d = d;
uint32_t *l_d = d;
nsXPTCVariant *l_s = s;
uint32 l_paramCount = paramCount;
uint32 regCount = 0; // return the number of registers to load from the stack
uint32_t l_paramCount = paramCount;
uint32_t regCount = 0; // return the number of registers to load from the stack
typedef struct {
uint32 hi;
uint32 lo;
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since
// stack slots are not guaranteed 16 byte aligned
for(uint32 i = 0; i < l_paramCount; i++, l_d++, l_s++)
for(uint32_t i = 0; i < l_paramCount; i++, l_d++, l_s++)
{
if (regCount < 5) regCount++;
if(l_s->IsPtrData())
@ -97,22 +97,22 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s)
}
switch(l_s->type)
{
case nsXPTType::T_I8 : *((int32*) l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int32*) l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int32*) l_d) = l_s->val.i32; break;
case nsXPTType::T_I8 : *((int32_t*) l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int32_t*) l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int32_t*) l_d) = l_s->val.i32; break;
case nsXPTType::T_I64 :
case nsXPTType::T_U64 :
case nsXPTType::T_DOUBLE : *((uint32*) l_d++) = ((DU *)l_s)->hi;
case nsXPTType::T_DOUBLE : *((uint32_t*) l_d++) = ((DU *)l_s)->hi;
if (regCount < 5) regCount++;
*((uint32*) l_d) = ((DU *)l_s)->lo;
*((uint32_t*) l_d) = ((DU *)l_s)->lo;
break;
case nsXPTType::T_U8 : *((uint32*) l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint32*) l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint32*) l_d) = l_s->val.u32; break;
case nsXPTType::T_U8 : *((uint32_t*) l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint32_t*) l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint32_t*) l_d) = l_s->val.u32; break;
case nsXPTType::T_FLOAT : *((float*) l_d) = l_s->val.f; break;
case nsXPTType::T_BOOL : *((uint32*) l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint32*) l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int32*) l_d) = l_s->val.wc; break;
case nsXPTType::T_BOOL : *((uint32_t*) l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint32_t*) l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int32_t*) l_d) = l_s->val.wc; break;
default:
// all the others are plain pointer types
*((void**)l_d) = l_s->val.p;

Просмотреть файл

@ -73,18 +73,18 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s)
from there since the parameters occupy the same stack space as the stack
we're trying to populate.
*/
uint32 *l_d = d;
uint32_t *l_d = d;
nsXPTCVariant *l_s = s;
uint32 l_paramCount = paramCount;
uint32 regCount = 0; // return the number of registers to load from the stack
uint32_t l_paramCount = paramCount;
uint32_t regCount = 0; // return the number of registers to load from the stack
typedef struct {
uint32 hi;
uint32 lo;
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since
// stack slots are not guaranteed 16 byte aligned
for(uint32 i = 0; i < l_paramCount; i++, l_d++, l_s++)
for(uint32_t i = 0; i < l_paramCount; i++, l_d++, l_s++)
{
if (regCount < 5) regCount++;
if(l_s->IsPtrData())
@ -94,22 +94,22 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s)
}
switch(l_s->type)
{
case nsXPTType::T_I8 : *((int32*) l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int32*) l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int32*) l_d) = l_s->val.i32; break;
case nsXPTType::T_I8 : *((int32_t*) l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int32_t*) l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int32_t*) l_d) = l_s->val.i32; break;
case nsXPTType::T_I64 :
case nsXPTType::T_U64 :
case nsXPTType::T_DOUBLE : *((uint32*) l_d++) = ((DU *)l_s)->hi;
case nsXPTType::T_DOUBLE : *((uint32_t*) l_d++) = ((DU *)l_s)->hi;
if (regCount < 5) regCount++;
*((uint32*) l_d) = ((DU *)l_s)->lo;
*((uint32_t*) l_d) = ((DU *)l_s)->lo;
break;
case nsXPTType::T_U8 : *((uint32*) l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint32*) l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint32*) l_d) = l_s->val.u32; break;
case nsXPTType::T_U8 : *((uint32_t*) l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint32_t*) l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint32_t*) l_d) = l_s->val.u32; break;
case nsXPTType::T_FLOAT : *((float*) l_d) = l_s->val.f; break;
case nsXPTType::T_BOOL : *((uint32*) l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint32*) l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int32*) l_d) = l_s->val.wc; break;
case nsXPTType::T_BOOL : *((uint32_t*) l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint32_t*) l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int32_t*) l_d) = l_s->val.wc; break;
default:
// all the others are plain pointer types
*((void**)l_d) = l_s->val.p;

Просмотреть файл

@ -76,18 +76,18 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s)
from there since the parameters occupy the same stack space as the stack
we're trying to populate.
*/
uint32 *l_d = d;
uint32_t *l_d = d;
nsXPTCVariant *l_s = s;
uint32 l_paramCount = paramCount;
uint32 regCount = 0; // return the number of registers to load from the stack
uint32_t l_paramCount = paramCount;
uint32_t regCount = 0; // return the number of registers to load from the stack
typedef struct {
uint32 hi;
uint32 lo;
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since
// stack slots are not guaranteed 16 byte aligned
for(uint32 i = 0; i < l_paramCount; i++, l_d++, l_s++)
for(uint32_t i = 0; i < l_paramCount; i++, l_d++, l_s++)
{
if (regCount < 5) regCount++;
if(l_s->IsPtrData())
@ -97,22 +97,22 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s)
}
switch(l_s->type)
{
case nsXPTType::T_I8 : *((int32*) l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int32*) l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int32*) l_d) = l_s->val.i32; break;
case nsXPTType::T_I8 : *((int32_t*) l_d) = l_s->val.i8; break;
case nsXPTType::T_I16 : *((int32_t*) l_d) = l_s->val.i16; break;
case nsXPTType::T_I32 : *((int32_t*) l_d) = l_s->val.i32; break;
case nsXPTType::T_I64 :
case nsXPTType::T_U64 :
case nsXPTType::T_DOUBLE : *((uint32*) l_d++) = ((DU *)l_s)->hi;
case nsXPTType::T_DOUBLE : *((uint32_t*) l_d++) = ((DU *)l_s)->hi;
if (regCount < 5) regCount++;
*((uint32*) l_d) = ((DU *)l_s)->lo;
*((uint32_t*) l_d) = ((DU *)l_s)->lo;
break;
case nsXPTType::T_U8 : *((uint32*) l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint32*) l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint32*) l_d) = l_s->val.u32; break;
case nsXPTType::T_U8 : *((uint32_t*) l_d) = l_s->val.u8; break;
case nsXPTType::T_U16 : *((uint32_t*) l_d) = l_s->val.u16; break;
case nsXPTType::T_U32 : *((uint32_t*) l_d) = l_s->val.u32; break;
case nsXPTType::T_FLOAT : *((float*) l_d) = l_s->val.f; break;
case nsXPTType::T_BOOL : *((uint32*) l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint32*) l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int32*) l_d) = l_s->val.wc; break;
case nsXPTType::T_BOOL : *((uint32_t*) l_d) = l_s->val.b; break;
case nsXPTType::T_CHAR : *((uint32_t*) l_d) = l_s->val.c; break;
case nsXPTType::T_WCHAR : *((int32_t*) l_d) = l_s->val.wc; break;
default:
// all the others are plain pointer types
*((void**)l_d) = l_s->val.p;

Просмотреть файл

@ -25,7 +25,7 @@ invoke_count_words(uint32_t paramCount, nsXPTCVariant * s,
nr_stack = 0;
/* Compute number of eightbytes of class MEMORY. */
for (uint32 i = 0; i < paramCount; i++, s++) {
for (uint32_t i = 0; i < paramCount; i++, s++) {
if (!s->IsPtrData()
&& (s->type == nsXPTType::T_FLOAT || s->type == nsXPTType::T_DOUBLE)) {
if (nr_fpr < FPR_COUNT)
@ -50,7 +50,7 @@ invoke_copy_to_stack(uint64_t * d, uint32_t paramCount, nsXPTCVariant * s,
uint32_t nr_fpr = 0;
uint64_t value;
for (uint32 i = 0; i < paramCount; i++, s++) {
for (uint32_t i = 0; i < paramCount; i++, s++) {
if (s->IsPtrData())
value = (uint64_t) s->ptr;
else {

Просмотреть файл

@ -26,7 +26,7 @@ invoke_count_words(uint32_t paramCount, nsXPTCVariant * s,
nr_stack = 0;
/* Compute number of eightbytes of class MEMORY. */
for (uint32 i = 0; i < paramCount; i++, s++) {
for (uint32_t i = 0; i < paramCount; i++, s++) {
if (!s->IsPtrData()
&& (s->type == nsXPTType::T_FLOAT || s->type == nsXPTType::T_DOUBLE)) {
if (nr_fpr < FPR_COUNT)
@ -51,7 +51,7 @@ invoke_copy_to_stack(uint64_t * d, uint32_t paramCount, nsXPTCVariant * s,
uint32_t nr_fpr = 0;
uint64_t value;
for (uint32 i = 0; i < paramCount; i++, s++) {
for (uint32_t i = 0; i < paramCount; i++, s++) {
if (s->IsPtrData())
value = (uint64_t) s->ptr;
else {

Просмотреть файл

@ -10,11 +10,11 @@
/* Prototype specifies unmangled function name and disables unused warning */
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint64_t* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args)
__asm__("PrepareAndDispatch") __attribute__((used));
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint64_t* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args)
{
const uint8_t PARAM_BUFFER_COUNT = 16;
const uint8_t NUM_ARG_REGS = 6-1; // -1 for "this" pointer

Просмотреть файл

@ -25,7 +25,7 @@
#endif
/* Specify explicitly a symbol for this function, don't try to guess the c++ mangled symbol. */
static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32_t* args) asm("_PrepareAndDispatch")
static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args) asm("_PrepareAndDispatch")
DONT_DROP_OR_WARN;
#ifdef __ARM_EABI__
@ -42,7 +42,7 @@ DONT_DROP_OR_WARN;
#endif
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32_t* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -8,7 +8,7 @@
#include "xptcprivate.h"
nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32_t* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -21,11 +21,11 @@
#endif
/* Specify explicitly a symbol for this function, don't try to guess the c++ mangled symbol. */
static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32_t* args) asm("_PrepareAndDispatch")
static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args) asm("_PrepareAndDispatch")
DONT_DROP_OR_WARN;
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32_t* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -12,7 +12,7 @@
extern "C" {
static nsresult ATTRIBUTE_USED
__attribute__ ((regparm (3)))
PrepareAndDispatch(uint32 methodIndex, nsXPTCStubBase* self, uint32_t* args)
PrepareAndDispatch(uint32_t methodIndex, nsXPTCStubBase* self, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -10,11 +10,11 @@
/* Prototype specifies unmangled function name and disables unused warning */
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint64_t* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args)
__asm__("PrepareAndDispatch") __attribute__((used));
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint64_t* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args)
{
const uint8_t PARAM_BUFFER_COUNT = 16;
const uint8_t NUM_ARG_REGS = 6-1; // -1 for "this" pointer

Просмотреть файл

@ -10,7 +10,7 @@
extern "C" {
nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16
@ -85,7 +85,7 @@ extern "C" {
nsresult nsXPTCStubBase::Stub##n() \
{ \
void *frame = __builtin_frame_address(0); \
return PrepareAndDispatch(this, n, (uint32*)frame + 3); \
return PrepareAndDispatch(this, n, (uint32_t*)frame + 3); \
}
#define SENTINEL_ENTRY(n) \

Просмотреть файл

@ -10,7 +10,7 @@
#include "xptiprivate.h"
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex,
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex,
uint32_t* a_gpr, uint64_t *a_fpr, uint32_t *a_ov)
{
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -10,7 +10,7 @@
#include "xptiprivate.h"
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex,
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex,
uint64_t* a_gpr, uint64_t *a_fpr, uint64_t *a_ov)
{
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -13,7 +13,7 @@
extern "C" {
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -12,10 +12,10 @@
#endif
/* Specify explicitly a symbol for this function, don't try to guess the c++ mangled symbol. */
static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32_t* args) asm("_PrepareAndDispatch");
static nsresult PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args) asm("_PrepareAndDispatch");
static nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32_t* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -20,8 +20,8 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex,
{
typedef struct {
uint32 hi;
uint32 lo;
uint32_t hi;
uint32_t lo;
} DU;
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -20,8 +20,8 @@ extern "C" nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args, uint32_t *gprData, double *fprData)
{
typedef struct {
uint32 hi;
uint32 lo; // have to move 64 bit entities as 32 bit halves since
uint32_t hi;
uint32_t lo; // have to move 64 bit entities as 32 bit halves since
} DU; // stack slots are not guaranteed 16 byte aligned
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -10,12 +10,12 @@
#if defined(sparc) || defined(__sparc__)
extern "C" nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
typedef struct {
uint32 hi;
uint32 lo;
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since
// stack slots are not guaranteed 16 byte aligned

Просмотреть файл

@ -10,12 +10,12 @@
#if defined(sparc) || defined(__sparc__)
extern "C" nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
typedef struct {
uint32 hi;
uint32 lo;
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since
// stack slots are not guaranteed 16 byte aligned

Просмотреть файл

@ -11,12 +11,12 @@
#if defined(sparc) || defined(__sparc__)
extern "C" nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
typedef struct {
uint32 hi;
uint32 lo;
uint32_t hi;
uint32_t lo;
} DU; // have to move 64 bit entities as 32 bit halves since
// stack slots are not guaranteed 16 byte aligned

Просмотреть файл

@ -10,7 +10,7 @@
#include "xptiprivate.h"
nsresult
PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, uint32_t* args)
PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
{
#define PARAM_BUFFER_COUNT 16

Просмотреть файл

@ -157,7 +157,7 @@ xptiInterfaceEntry::IsFunction(bool* result)
}
nsresult
xptiInterfaceEntry::GetMethodCount(uint16* count)
xptiInterfaceEntry::GetMethodCount(uint16_t* count)
{
if(!EnsureResolved())
return NS_ERROR_UNEXPECTED;
@ -168,7 +168,7 @@ xptiInterfaceEntry::GetMethodCount(uint16* count)
}
nsresult
xptiInterfaceEntry::GetConstantCount(uint16* count)
xptiInterfaceEntry::GetConstantCount(uint16_t* count)
{
if(!EnsureResolved())
return NS_ERROR_UNEXPECTED;
@ -179,7 +179,7 @@ xptiInterfaceEntry::GetConstantCount(uint16* count)
}
nsresult
xptiInterfaceEntry::GetMethodInfo(uint16 index, const nsXPTMethodInfo** info)
xptiInterfaceEntry::GetMethodInfo(uint16_t index, const nsXPTMethodInfo** info)
{
if(!EnsureResolved())
return NS_ERROR_UNEXPECTED;
@ -202,14 +202,14 @@ xptiInterfaceEntry::GetMethodInfo(uint16 index, const nsXPTMethodInfo** info)
}
nsresult
xptiInterfaceEntry::GetMethodInfoForName(const char* methodName, uint16 *index,
xptiInterfaceEntry::GetMethodInfoForName(const char* methodName, uint16_t *index,
const nsXPTMethodInfo** result)
{
if(!EnsureResolved())
return NS_ERROR_UNEXPECTED;
// This is a slow algorithm, but this is not expected to be called much.
for(uint16 i = 0; i < mDescriptor->num_methods; ++i)
for(uint16_t i = 0; i < mDescriptor->num_methods; ++i)
{
const nsXPTMethodInfo* info;
info = reinterpret_cast<nsXPTMethodInfo*>
@ -233,7 +233,7 @@ xptiInterfaceEntry::GetMethodInfoForName(const char* methodName, uint16 *index,
}
nsresult
xptiInterfaceEntry::GetConstant(uint16 index, const nsXPTConstant** constant)
xptiInterfaceEntry::GetConstant(uint16_t index, const nsXPTConstant** constant)
{
if(!EnsureResolved())
return NS_ERROR_UNEXPECTED;
@ -305,7 +305,7 @@ xptiInterfaceEntry::GetEntryForParam(uint16_t methodIndex,
}
nsresult
xptiInterfaceEntry::GetInfoForParam(uint16 methodIndex,
xptiInterfaceEntry::GetInfoForParam(uint16_t methodIndex,
const nsXPTParamInfo *param,
nsIInterfaceInfo** info)
{
@ -324,7 +324,7 @@ xptiInterfaceEntry::GetInfoForParam(uint16 methodIndex,
}
nsresult
xptiInterfaceEntry::GetIIDForParam(uint16 methodIndex,
xptiInterfaceEntry::GetIIDForParam(uint16_t methodIndex,
const nsXPTParamInfo* param, nsIID** iid)
{
xptiInterfaceEntry* entry;
@ -350,7 +350,7 @@ xptiInterfaceEntry::GetIIDForParamNoAlloc(uint16_t methodIndex,
// this is a private helper
nsresult
xptiInterfaceEntry::GetTypeInArray(const nsXPTParamInfo* param,
uint16 dimension,
uint16_t dimension,
const XPTTypeDescriptor** type)
{
NS_ASSERTION(IsFullyResolved(), "bad state");
@ -359,7 +359,7 @@ xptiInterfaceEntry::GetTypeInArray(const nsXPTParamInfo* param,
const XPTTypeDescriptor *additional_types =
mDescriptor->additional_types;
for (uint16 i = 0; i < dimension; i++) {
for (uint16_t i = 0; i < dimension; i++) {
if(XPT_TDP_TAG(td->prefix) != TD_ARRAY) {
NS_ERROR("bad dimension");
return NS_ERROR_INVALID_ARG;
@ -372,9 +372,9 @@ xptiInterfaceEntry::GetTypeInArray(const nsXPTParamInfo* param,
}
nsresult
xptiInterfaceEntry::GetTypeForParam(uint16 methodIndex,
xptiInterfaceEntry::GetTypeForParam(uint16_t methodIndex,
const nsXPTParamInfo* param,
uint16 dimension,
uint16_t dimension,
nsXPTType* type)
{
if(!EnsureResolved())
@ -406,10 +406,10 @@ xptiInterfaceEntry::GetTypeForParam(uint16 methodIndex,
}
nsresult
xptiInterfaceEntry::GetSizeIsArgNumberForParam(uint16 methodIndex,
xptiInterfaceEntry::GetSizeIsArgNumberForParam(uint16_t methodIndex,
const nsXPTParamInfo* param,
uint16 dimension,
uint8* argnum)
uint16_t dimension,
uint8_t* argnum)
{
if(!EnsureResolved())
return NS_ERROR_UNEXPECTED;
@ -451,9 +451,9 @@ xptiInterfaceEntry::GetSizeIsArgNumberForParam(uint16 methodIndex,
}
nsresult
xptiInterfaceEntry::GetInterfaceIsArgNumberForParam(uint16 methodIndex,
xptiInterfaceEntry::GetInterfaceIsArgNumberForParam(uint16_t methodIndex,
const nsXPTParamInfo* param,
uint8* argnum)
uint8_t* argnum)
{
if(!EnsureResolved())
return NS_ERROR_UNEXPECTED;

Просмотреть файл

@ -76,7 +76,7 @@ int main (int argc, char **argv) {
return 1;
}
uint16 methodcount;
uint16_t methodcount;
info5->GetMethodCount(&methodcount);
const nsXPTMethodInfo *mi;
for (i = 0; i < methodcount; i++) {
@ -105,7 +105,7 @@ int main (int argc, char **argv) {
// Not returning an error, because this could legitamately change
}
// lets see what arg this refers to
uint8 argnum;
uint8_t argnum;
info5->GetInterfaceIsArgNumberForParam(6, &param3, &argnum);
fprintf(stderr, "param 3 referrs to param %d of method 6 - createInstanceByContractID\n", (uint32_t)argnum);
// Get the type of the parameter referred to

Просмотреть файл

@ -37,9 +37,9 @@ LossyConvertEncoding16to8::write_sse2(const PRUnichar* aSource,
source4 = _mm_and_si128(source4, vectmask);
// Pack the source data. SSE2 views this as a saturating uint16 to
// uint8 conversion, but since we masked off the high-order byte of every
// uint16, we're really just grabbing the low-order bytes of source1 and
// Pack the source data. SSE2 views this as a saturating uint16_t to
// uint8_t conversion, but since we masked off the high-order byte of every
// uint16_t, we're really just grabbing the low-order bytes of source1 and
// source2.
__m128i packed1 = _mm_packus_epi16(source1, source2);
__m128i packed2 = _mm_packus_epi16(source3, source4);

Просмотреть файл

@ -376,12 +376,12 @@ struct XPTTypeDescriptor {
* The types of the method parameter are restricted to the following subset
* of TypeDescriptors:
*
* int8, uint8, int16, uint16, int32, uint32,
* int64, uint64, wchar_t, char, string
* int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
* int64_t, uint64_t, wchar_t, char, string
*
* The type (and thus the size) of the value record is determined by the
* contents of the associated TypeDescriptor record. For instance, if type
* corresponds to int16, then value is a two-byte record consisting of a
* corresponds to int16_t, then value is a two-byte record consisting of a
* 16-bit signed integer. For a ConstDescriptor type of string, the value
* record is of type String*, i.e. an offset within the data pool to a
* String record containing the constant string.

Просмотреть файл

@ -29,9 +29,9 @@
XPTString in_str = { 4, "bazz" };
struct TestData {
uint32 bit32;
uint16 bit16;
uint8 bit8[2];
uint32_t bit32;
uint16_t bit16;
uint8_t bit8[2];
char *cstr;
XPTString *str;
} input = { 0xdeadbeef, 0xcafe, {0xba, 0xbe}, "foobar", &in_str},
@ -64,7 +64,7 @@ main(int argc, char **argv)
XPTState *state;
XPTCursor curs, *cursor = &curs;
char *header, *data, *whole;
uint32 hlen, dlen, i;
uint32_t hlen, dlen, i;
TRY("XPT_NewArena", (arena = XPT_NewArena(1024, sizeof(double), "main")));
@ -84,7 +84,7 @@ main(int argc, char **argv)
fprintf(stderr, "XDR header %d bytes at %p:",
hlen, header);
for (i = 0; i < hlen; i++)
fprintf(stderr, "%c%02x", i ? ',' : ' ', (uint8)header[i]);
fprintf(stderr, "%c%02x", i ? ',' : ' ', (uint8_t)header[i]);
fprintf(stderr, "\n");
XPT_GetXDRData(state, XPT_DATA, &data, &dlen);
@ -92,8 +92,8 @@ main(int argc, char **argv)
fprintf(stderr, "XDR data %d bytes at %p:",
dlen, data);
for (i = 0; i < dlen; i++)
fprintf(stderr, "%c%02x/%c", i ? ',' : ' ', (uint8)data[i],
(uint8)data[i]);
fprintf(stderr, "%c%02x/%c", i ? ',' : ' ', (uint8_t)data[i],
(uint8_t)data[i]);
fprintf(stderr, "\n");
whole = malloc(dlen + hlen);

Просмотреть файл

@ -48,7 +48,7 @@ main(int argc, char **argv)
XPTCursor curs, *cursor = &curs;
char *data, *head;
FILE *out;
uint32 len, header_sz;
uint32_t len, header_sz;
PRBool ok;
@ -91,7 +91,7 @@ main(int argc, char **argv)
meth->result->flags = 0;
meth->result->type.prefix.flags = TD_VOID;
/* wstring method2(in uint32, in bool) */
/* wstring method2(in uint32_t, in bool) */
meth = &id->method_descriptors[1];
ok = XPT_FillMethodDescriptor(arena, meth, 0, "method2", 2);
TRY("FillMethodDescriptor", ok);