Bug 851828 - Type safety improvements for the profiler in Win64 builds. r=benwa

This commit is contained in:
Ehsan Akhgari 2013-03-26 13:32:09 -04:00
parent a9f8f01553
commit 7af472416c
4 changed files with 8 additions and 8 deletions

View File

@ -87,7 +87,7 @@ void EscapeToStream(std::ostream& stream, const char* str) {
} else if (ucs4Char > 0xFF) {
PRUnichar chr[2];
ConvertUTF8toUTF16 encoder(chr);
encoder.write(utf8CharStart, str-utf8CharStart);
encoder.write(utf8CharStart, uint32_t(str-utf8CharStart));
char escChar[13];
snprintf(escChar, mozilla::ArrayLength(escChar), "\\u%04X\\u%04X", chr[0], chr[1]);
stream << escChar;
@ -210,7 +210,7 @@ operator<<(std::ostream& stream, JSCustomArray* entry)
{
bool needsComma = false;
stream << "[";
for (size_t i = 0; i < entry->mValues.Length(); i++) {
for (uint32_t i = 0; i < entry->mValues.Length(); i++) {
if (needsComma) {
stream << ",";
}

View File

@ -194,7 +194,7 @@ public:
}
uint32_t stackSize() const
{
return std::min<uint32_t>(mStackPointer, mozilla::ArrayLength(mStack));
return std::min<uint32_t>(mStackPointer, mozilla::sig_safe_t(mozilla::ArrayLength(mStack)));
}
void sampleRuntime(JSRuntime *runtime) {
@ -208,7 +208,7 @@ public:
js::SetRuntimeProfilingStack(runtime,
(js::ProfileEntry*) mStack,
(uint32_t*) &mStackPointer,
mozilla::ArrayLength(mStack));
uint32_t(mozilla::ArrayLength(mStack)));
if (mStartJSSampling)
enableJSSampling();
}

View File

@ -196,7 +196,7 @@ void addDynamicTag(ThreadProfile &aProfile, char aTagName, const char *aStr)
for (size_t j = 0; j < strLen;) {
// Store as many characters in the void* as the platform allows
char text[sizeof(void*)];
int len = sizeof(void*)/sizeof(char);
size_t len = sizeof(void*)/sizeof(char);
if (j+len >= strLen) {
len = strLen - j;
}
@ -300,7 +300,7 @@ void TableTicker::doNativeBacktrace(ThreadProfile &aProfile, TickSample* aSample
// Start with the current function.
StackWalkCallback(aSample->pc, aSample->sp, &array);
uint32_t maxFrames = array.size - array.count;
uint32_t maxFrames = uint32_t(array.size - array.count);
#ifdef XP_MACOSX
pthread_t pt = GetProfiledThread(platform_data());
void *stackEnd = reinterpret_cast<void*>(-1);

View File

@ -103,7 +103,7 @@ nsProfiler::GetProfile(char **aProfile)
{
char *profile = profiler_get_profile();
if (profile) {
uint32_t len = strlen(profile);
size_t len = strlen(profile);
char *profileStr = static_cast<char *>
(nsMemory::Clone(profile, (len + 1) * sizeof(char)));
profileStr[len] = '\0';
@ -233,7 +233,7 @@ nsProfiler::GetFeatures(uint32_t *aCount, char ***aFeatures)
(nsMemory::Alloc(len * sizeof(char*)));
for (size_t i = 0; i < len; i++) {
uint32_t strLen = strlen(features[i]);
size_t strLen = strlen(features[i]);
featureList[i] = static_cast<char *>
(nsMemory::Clone(features[i], (strLen + 1) * sizeof(char)));
}