зеркало из https://github.com/mozilla/gecko-dev.git
Bug 398435 - "PRBool misuse bugs in xpcom/" [p=taras r=bsmedberg a1.9=sayrer]
This commit is contained in:
Родитель
fbef483d10
Коммит
59d2451ae9
|
@ -795,7 +795,7 @@ nsObjectHashtable::RemoveAndDelete(nsHashKey *aKey)
|
|||
{
|
||||
void *value = Remove(aKey);
|
||||
if (value && mDestroyElementFun)
|
||||
return (*mDestroyElementFun)(aKey, value, mDestroyElementClosure);
|
||||
return !!(*mDestroyElementFun)(aKey, value, mDestroyElementClosure);
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
* This function is especially useful for static hashtables.
|
||||
* @return PR_TRUE if the table has been initialized.
|
||||
*/
|
||||
PRBool IsInitialized() const { return this->mTable.entrySize; }
|
||||
PRBool IsInitialized() const { return !!this->mTable.entrySize; }
|
||||
|
||||
/**
|
||||
* Return the number of entries in the table.
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
* Check whether the table has been initialized. This can be useful for static hashtables.
|
||||
* @return the initialization state of the class.
|
||||
*/
|
||||
PRBool IsInitialized() const { return mTable.entrySize; }
|
||||
PRBool IsInitialized() const { return !!mTable.entrySize; }
|
||||
|
||||
/**
|
||||
* KeyType is typedef'ed for ease of use.
|
||||
|
|
|
@ -193,7 +193,7 @@ NS_HasPendingEvents(nsIThread *thread)
|
|||
#ifdef MOZILLA_INTERNAL_API
|
||||
if (!thread) {
|
||||
thread = NS_GetCurrentThread();
|
||||
NS_ENSURE_STATE(thread);
|
||||
NS_ENSURE_TRUE(thread, PR_FALSE);
|
||||
}
|
||||
#else
|
||||
nsCOMPtr<nsIThread> current;
|
||||
|
@ -213,7 +213,7 @@ NS_ProcessNextEvent(nsIThread *thread, PRBool mayWait)
|
|||
#ifdef MOZILLA_INTERNAL_API
|
||||
if (!thread) {
|
||||
thread = NS_GetCurrentThread();
|
||||
NS_ENSURE_STATE(thread);
|
||||
NS_ENSURE_TRUE(thread, PR_FALSE);
|
||||
}
|
||||
#else
|
||||
nsCOMPtr<nsIThread> current;
|
||||
|
|
|
@ -475,7 +475,7 @@ nsBinaryInputStream::ReadBoolean(PRBool* aBoolean)
|
|||
{
|
||||
PRUint8 byteResult;
|
||||
nsresult rv = Read8(&byteResult);
|
||||
*aBoolean = byteResult;
|
||||
*aBoolean = !!byteResult;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -379,11 +379,11 @@ NS_COM PRBool NS_EscapeURL(const char *part,
|
|||
static const char hexChars[] = "0123456789ABCDEF";
|
||||
if (partLen < 0)
|
||||
partLen = strlen(part);
|
||||
PRBool forced = (flags & esc_Forced);
|
||||
PRBool ignoreNonAscii = (flags & esc_OnlyASCII);
|
||||
PRBool ignoreAscii = (flags & esc_OnlyNonASCII);
|
||||
PRBool writing = (flags & esc_AlwaysCopy);
|
||||
PRBool colon = (flags & esc_Colon);
|
||||
PRBool forced = !!(flags & esc_Forced);
|
||||
PRBool ignoreNonAscii = !!(flags & esc_OnlyASCII);
|
||||
PRBool ignoreAscii = !!(flags & esc_OnlyNonASCII);
|
||||
PRBool writing = !!(flags & esc_AlwaysCopy);
|
||||
PRBool colon = !!(flags & esc_Colon);
|
||||
|
||||
register const unsigned char* src = (const unsigned char *) part;
|
||||
|
||||
|
@ -461,10 +461,10 @@ NS_COM PRBool NS_UnescapeURL(const char *str, PRInt32 len, PRUint32 flags, nsACS
|
|||
if (len < 0)
|
||||
len = strlen(str);
|
||||
|
||||
PRBool ignoreNonAscii = (flags & esc_OnlyASCII);
|
||||
PRBool ignoreAscii = (flags & esc_OnlyNonASCII);
|
||||
PRBool writing = (flags & esc_AlwaysCopy);
|
||||
PRBool skipControl = (flags & esc_SkipControl);
|
||||
PRBool ignoreNonAscii = !!(flags & esc_OnlyASCII);
|
||||
PRBool ignoreAscii = !!(flags & esc_OnlyNonASCII);
|
||||
PRBool writing = !!(flags & esc_AlwaysCopy);
|
||||
PRBool skipControl = !!(flags & esc_SkipControl);
|
||||
|
||||
static const char hexChars[] = "0123456789ABCDEFabcdef";
|
||||
|
||||
|
|
|
@ -1041,7 +1041,7 @@ nsPipeOutputStream::OnOutputException(nsresult reason, nsPipeEvents &events)
|
|||
LOG(("nsPipeOutputStream::OnOutputException [this=%x reason=%x]\n",
|
||||
this, reason));
|
||||
|
||||
nsresult result = PR_FALSE;
|
||||
PRBool result = PR_FALSE;
|
||||
|
||||
NS_ASSERTION(NS_FAILED(reason), "huh? successful exception");
|
||||
mWritable = PR_FALSE;
|
||||
|
|
|
@ -213,7 +213,7 @@ nsScriptableInputStream::ReadBoolean(PRBool* aBoolean)
|
|||
{
|
||||
PRUint8 byteResult;
|
||||
nsresult rv = Read8(&byteResult);
|
||||
*aBoolean = byteResult;
|
||||
*aBoolean = !!byteResult;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ nsProxyObjectCallInfo::CopyStrings(PRBool copy)
|
|||
PRBool
|
||||
nsProxyObjectCallInfo::GetCompleted()
|
||||
{
|
||||
return (PRBool)mCompleted;
|
||||
return !!mCompleted;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -244,7 +244,7 @@ public:
|
|||
void SetCallersTarget(nsIEventTarget* target);
|
||||
PRBool IsSync() const
|
||||
{
|
||||
return mOwner->GetProxyType() & NS_PROXY_SYNC;
|
||||
return !!(mOwner->GetProxyType() & NS_PROXY_SYNC);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
}
|
||||
|
||||
PRBool IsArray() const
|
||||
{return (PRBool) TagPart() == T_ARRAY;}
|
||||
{return TagPart() == T_ARRAY;}
|
||||
|
||||
// 'Dependent' means that params of this type are dependent upon other
|
||||
// params. e.g. an T_INTERFACE_IS is dependent upon some other param at
|
||||
|
|
|
@ -102,14 +102,14 @@ xpti_InterfaceWriter(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
|||
|
||||
const xptiTypelib& typelib = entry->GetTypelibRecord();
|
||||
|
||||
PRBool success = PR_fprintf(fd, "%d,%s,%s,%d,%d,%d\n",
|
||||
(int) number,
|
||||
entry->GetTheName(),
|
||||
iidStr,
|
||||
(int) typelib.GetFileIndex(),
|
||||
(int) (typelib.IsZip() ?
|
||||
typelib.GetZipItemIndex() : -1),
|
||||
(int) entry->GetScriptableFlag());
|
||||
PRBool success = !!PR_fprintf(fd, "%d,%s,%s,%d,%d,%d\n",
|
||||
(int) number,
|
||||
entry->GetTheName(),
|
||||
iidStr,
|
||||
(int) typelib.GetFileIndex(),
|
||||
(int) (typelib.IsZip() ?
|
||||
typelib.GetZipItemIndex() : -1),
|
||||
(int) entry->GetScriptableFlag());
|
||||
|
||||
nsCRT::free(iidStr);
|
||||
|
||||
|
|
|
@ -268,8 +268,8 @@ struct XPTInterfaceDescriptor {
|
|||
#define XPT_ID_TAGMASK (~XPT_ID_FLAGMASK)
|
||||
#define XPT_ID_TAG(id) ((id).flags & XPT_ID_TAGMASK)
|
||||
|
||||
#define XPT_ID_IS_SCRIPTABLE(flags) (flags & XPT_ID_SCRIPTABLE)
|
||||
#define XPT_ID_IS_FUNCTION(flags) (flags & XPT_ID_FUNCTION)
|
||||
#define XPT_ID_IS_SCRIPTABLE(flags) (!!(flags & XPT_ID_SCRIPTABLE))
|
||||
#define XPT_ID_IS_FUNCTION(flags) (!!(flags & XPT_ID_FUNCTION))
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_GetInterfaceIndexByName(XPTInterfaceDirectoryEntry *ide_block,
|
||||
|
|
Загрузка…
Ссылка в новой задаче