Bug 348748 - Replace all instances of NS_STATIC_CAST and friends with C++ casts (and simultaneously bitrot nearly every patch in existence). r=bsmedberg on the script that did this. Tune in next time for Macro Wars: Episode II: Attack on the LL_* Macros.

This commit is contained in:
jwalden@mit.edu 2007-07-08 00:08:04 -07:00
Родитель 1df32e680d
Коммит 6d7584839a
934 изменённых файлов: 5429 добавлений и 5468 удалений

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

@ -376,8 +376,8 @@ NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
GType type = GetMaiAtkType(CreateMaiInterfaces());
NS_ENSURE_TRUE(type, NS_ERROR_FAILURE);
mAtkObject =
NS_REINTERPRET_CAST(AtkObject *,
g_object_new(type, NULL));
reinterpret_cast<AtkObject *>
(g_object_new(type, NULL));
NS_ENSURE_TRUE(mAtkObject, NS_ERROR_OUT_OF_MEMORY);
atk_object_initialize(mAtkObject, this);
@ -394,7 +394,7 @@ nsAccessibleWrap::GetAtkObject(void)
{
void *atkObj = nsnull;
GetNativeInterface(&atkObj);
return NS_STATIC_CAST(AtkObject *, atkObj);
return static_cast<AtkObject *>(atkObj);
}
// Get AtkObject from nsIAccessible interface
@ -690,7 +690,7 @@ initializeCB(AtkObject *aAtkObj, gpointer aData)
/* initialize object */
MAI_ATK_OBJECT(aAtkObj)->accWrap =
NS_STATIC_CAST(nsAccessibleWrap*, aData);
static_cast<nsAccessibleWrap*>(aData);
#ifdef MAI_LOGGING
++sMaiAtkObjCreated;
@ -782,7 +782,7 @@ getRoleCB(AtkObject *aAtkObj)
atkRole = atkRoleMap[accRole]; // map to the actual value
NS_ASSERTION(atkRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY] ==
kROLE_ATK_LAST_ENTRY, "ATK role map skewed");
aAtkObj->role = NS_STATIC_CAST(AtkRole, atkRole);
aAtkObj->role = static_cast<AtkRole>(atkRole);
}
return aAtkObj->role;
}
@ -967,7 +967,7 @@ getIndexInParentCB(AtkObject *aAtkObj)
PRInt32 currentIndex = 0;
while (sibling != NS_STATIC_CAST(nsIAccessible*, accWrap)) {
while (sibling != static_cast<nsIAccessible*>(accWrap)) {
NS_ASSERTION(sibling, "Never ran into the same child that we started from");
if (!sibling) {
@ -1060,7 +1060,7 @@ refRelationSetCB(AtkObject *aAtkObj)
};
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(relationType); i++) {
relation = atk_relation_set_get_relation_by_type(relation_set, NS_STATIC_CAST(AtkRelationType, relationType[i]));
relation = atk_relation_set_get_relation_by_type(relation_set, static_cast<AtkRelationType>(relationType[i]));
if (relation) {
atk_relation_set_remove(relation_set, relation);
}
@ -1070,7 +1070,7 @@ refRelationSetCB(AtkObject *aAtkObj)
if (NS_SUCCEEDED(rv) && accRelated) {
accessible_array[0] = nsAccessibleWrap::GetAtkObject(accRelated);
relation = atk_relation_new(accessible_array, 1,
NS_STATIC_CAST(AtkRelationType, relationType[i]));
static_cast<AtkRelationType>(relationType[i]));
atk_relation_set_add(relation_set, relation);
g_object_unref(relation);
}
@ -1096,7 +1096,7 @@ nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
nsRefPtr<nsApplicationAccessibleWrap> appAccWrap =
nsAccessNode::GetApplicationAccessible();
nsAccessibleWrap* tmpAppAccWrap =
NS_STATIC_CAST(nsAccessibleWrap*, appAccWrap.get());
static_cast<nsAccessibleWrap*>(appAccWrap.get());
if (tmpAppAccWrap != tmpAccWrap && !tmpAccWrap->IsValidObject())
return nsnull;
@ -1118,7 +1118,7 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
rv = aEvent->GetEventType(&type);
NS_ENSURE_SUCCESS(rv, rv);
nsAccEvent *event = NS_REINTERPRET_CAST(nsAccEvent*, aEvent);
nsAccEvent *event = reinterpret_cast<nsAccEvent*>(aEvent);
void *eventData = event->mEventData;
AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accessible);
@ -1215,7 +1215,7 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
if (!eventData)
break;
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, eventData);
pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
g_signal_emit_by_name(atkObj,
"row_inserted",
@ -1231,7 +1231,7 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
if (!eventData)
break;
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, eventData);
pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
g_signal_emit_by_name(atkObj,
"row_deleted",
@ -1252,7 +1252,7 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
if (!eventData)
break;
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, eventData);
pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
g_signal_emit_by_name(atkObj,
"column_inserted",
@ -1268,7 +1268,7 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
if (!eventData)
break;
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, eventData);
pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
g_signal_emit_by_name(atkObj,
"column_deleted",
@ -1321,7 +1321,7 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_ACTIVATED\n"));
nsDocAccessibleWrap *accDocWrap =
NS_STATIC_CAST(nsDocAccessibleWrap *, accessible.get());
static_cast<nsDocAccessibleWrap *>(accessible.get());
accDocWrap->mActivated = PR_TRUE;
guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
@ -1331,7 +1331,7 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_DEACTIVATED\n"));
nsDocAccessibleWrap *accDocWrap =
NS_STATIC_CAST(nsDocAccessibleWrap *, accessible.get());
static_cast<nsDocAccessibleWrap *>(accessible.get());
accDocWrap->mActivated = PR_FALSE;
guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
@ -1457,9 +1457,9 @@ nsAccessibleWrap::FireAtkPropChangedEvent(nsIAccessibleEvent *aEvent,
AtkPropertyValues values = { NULL };
nsAccessibleWrap *oldAccWrap = nsnull, *newAccWrap = nsnull;
nsAccEvent *event = NS_REINTERPRET_CAST(nsAccEvent*, aEvent);
nsAccEvent *event = reinterpret_cast<nsAccEvent*>(aEvent);
pAtkPropChange = NS_REINTERPRET_CAST(AtkPropertyChange *, event->mEventData);
pAtkPropChange = reinterpret_cast<AtkPropertyChange *>(event->mEventData);
values.property_name = sAtkPropertyNameArray[pAtkPropChange->type];
NS_ASSERTION(pAtkPropChange, "Event needs event data");
@ -1474,12 +1474,12 @@ nsAccessibleWrap::FireAtkPropChangedEvent(nsIAccessibleEvent *aEvent,
case PROP_TABLE_SUMMARY:
if (pAtkPropChange->oldvalue)
oldAccWrap = NS_REINTERPRET_CAST(nsAccessibleWrap *,
pAtkPropChange->oldvalue);
oldAccWrap = reinterpret_cast<nsAccessibleWrap *>
(pAtkPropChange->oldvalue);
if (pAtkPropChange->newvalue)
newAccWrap = NS_REINTERPRET_CAST(nsAccessibleWrap *,
pAtkPropChange->newvalue);
newAccWrap = reinterpret_cast<nsAccessibleWrap *>
(pAtkPropChange->newvalue);
if (oldAccWrap && newAccWrap) {
g_value_init(&values.old_value, G_TYPE_POINTER);
@ -1497,8 +1497,8 @@ nsAccessibleWrap::FireAtkPropChangedEvent(nsIAccessibleEvent *aEvent,
case PROP_TABLE_ROW_DESCRIPTION:
g_value_init(&values.new_value, G_TYPE_INT);
g_value_set_int(&values.new_value,
*NS_REINTERPRET_CAST(gint *,
pAtkPropChange->newvalue));
*reinterpret_cast<gint *>
(pAtkPropChange->newvalue));
break;
//Perhaps need more cases in the future

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

@ -569,8 +569,8 @@ nsApplicationAccessibleWrap::GetNativeInterface(void **aOutAccessible)
if (!mAtkObject) {
mAtkObject =
NS_REINTERPRET_CAST(AtkObject *,
g_object_new(MAI_TYPE_ATK_OBJECT, NULL));
reinterpret_cast<AtkObject *>
(g_object_new(MAI_TYPE_ATK_OBJECT, NULL));
NS_ENSURE_TRUE(mAtkObject, NS_ERROR_OUT_OF_MEMORY);
atk_object_initialize(mAtkObject, this);

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

@ -150,8 +150,8 @@ MaiHyperlink::GetAtkHyperlink(void)
return nsnull;
mMaiAtkHyperlink =
NS_REINTERPRET_CAST(AtkHyperlink *,
g_object_new(mai_atk_hyperlink_get_type(), NULL));
reinterpret_cast<AtkHyperlink *>
(g_object_new(mai_atk_hyperlink_get_type(), NULL));
NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
NS_ENSURE_TRUE(mMaiAtkHyperlink, nsnull);
@ -260,7 +260,7 @@ getEndIndexCB(AtkHyperlink *aLink)
PRInt32 endIndex = -1;
nsresult rv = accHyperlink->GetEndIndex(&endIndex);
return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, endIndex);
return (NS_FAILED(rv)) ? -1 : static_cast<gint>(endIndex);
}
gint
@ -272,7 +272,7 @@ getStartIndexCB(AtkHyperlink *aLink)
PRInt32 startIndex = -1;
nsresult rv = accHyperlink->GetStartIndex(&startIndex);
return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, startIndex);
return (NS_FAILED(rv)) ? -1 : static_cast<gint>(startIndex);
}
gboolean
@ -283,7 +283,7 @@ isValidCB(AtkHyperlink *aLink)
PRBool isValid = PR_FALSE;
nsresult rv = accHyperlink->IsValid(&isValid);
return (NS_FAILED(rv)) ? FALSE : NS_STATIC_CAST(gboolean, isValid);
return (NS_FAILED(rv)) ? FALSE : static_cast<gboolean>(isValid);
}
gint
@ -294,7 +294,7 @@ getAnchorCountCB(AtkHyperlink *aLink)
PRInt32 count = -1;
nsresult rv = accHyperlink->GetAnchors(&count);
return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, count);
return (NS_FAILED(rv)) ? -1 : static_cast<gint>(count);
}
// Check if aHyperlink is a valid MaiHyperlink, and return the

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

@ -75,7 +75,7 @@ getActionCountCB(AtkAction *aAction)
PRUint8 num = 0;
nsresult rv = accWrap->GetNumActions(&num);
return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gint, num);
return (NS_FAILED(rv)) ? 0 : static_cast<gint>(num);
}
const gchar *

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

@ -108,7 +108,7 @@ getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn)
nsresult rv = accTable->GetIndexAt(aRow, aColumn, &index);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, index);
return static_cast<gint>(index);
}
gint
@ -127,7 +127,7 @@ getColumnAtIndexCB(AtkTable *aTable, gint aIndex)
nsresult rv = accTable->GetColumnAtIndex(aIndex, &col);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, col);
return static_cast<gint>(col);
}
gint
@ -146,7 +146,7 @@ getRowAtIndexCB(AtkTable *aTable, gint aIndex)
nsresult rv = accTable->GetRowAtIndex(aIndex, &row);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, row);
return static_cast<gint>(row);
}
gint
@ -165,7 +165,7 @@ getColumnCountCB(AtkTable *aTable)
nsresult rv = accTable->GetColumns(&count);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, count);
return static_cast<gint>(count);
}
gint
@ -184,7 +184,7 @@ getRowCountCB(AtkTable *aTable)
nsresult rv = accTable->GetRows(&count);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, count);
return static_cast<gint>(count);
}
gint
@ -204,7 +204,7 @@ getColumnExtentAtCB(AtkTable *aTable,
nsresult rv = accTable->GetColumnExtentAt(aRow, aColumn, &extent);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, extent);
return static_cast<gint>(extent);
}
gint
@ -224,7 +224,7 @@ getRowExtentAtCB(AtkTable *aTable,
nsresult rv = accTable->GetRowExtentAt(aRow, aColumn, &extent);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, extent);
return static_cast<gint>(extent);
}
AtkObject*
@ -375,7 +375,7 @@ getSelectedColumnsCB(AtkTable *aTable, gint **aSelected)
//copy
for (PRUint32 index = 0; index < size; ++index)
atkColumns[index] = NS_STATIC_CAST(gint, columns[index]);
atkColumns[index] = static_cast<gint>(columns[index]);
nsMemory::Free(columns);
*aSelected = atkColumns;
@ -410,7 +410,7 @@ getSelectedRowsCB(AtkTable *aTable, gint **aSelected)
//copy
for (PRUint32 index = 0; index < size; ++index)
atkRows[index] = NS_STATIC_CAST(gint, rows[index]);
atkRows[index] = static_cast<gint>(rows[index]);
nsMemory::Free(rows);
*aSelected = atkRows;
@ -431,7 +431,7 @@ isColumnSelectedCB(AtkTable *aTable, gint aColumn)
PRBool outValue;
nsresult rv = accTable->IsColumnSelected(aColumn, &outValue);
return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
}
gboolean
@ -448,7 +448,7 @@ isRowSelectedCB(AtkTable *aTable, gint aRow)
PRBool outValue;
nsresult rv = accTable->IsRowSelected(aRow, &outValue);
return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
}
gboolean
@ -465,5 +465,5 @@ isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn)
PRBool outValue;
nsresult rv = accTable->IsCellSelected(aRow, aColumn, &outValue);
return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
}

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

@ -79,7 +79,7 @@ void ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
// convert each char to "*" when it's "password text"
PRUint32 accRole;
accWrap->GetRole(&accRole);
if (NS_STATIC_CAST(AtkRole, accRole) == ATK_ROLE_PASSWORD_TEXT) {
if (static_cast<AtkRole>(accRole) == ATK_ROLE_PASSWORD_TEXT) {
for (PRUint32 i = 0; i < aString.Length(); i++)
aString.Replace(i, 1, NS_LITERAL_STRING("*"));
}
@ -187,11 +187,11 @@ getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
// convert char to "*" when it's "password text"
PRUint32 accRole;
accWrap->GetRole(&accRole);
if (NS_STATIC_CAST(AtkRole, accRole) == ATK_ROLE_PASSWORD_TEXT) {
if (static_cast<AtkRole>(accRole) == ATK_ROLE_PASSWORD_TEXT) {
uniChar = '*';
}
return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gunichar, uniChar);
return (NS_FAILED(rv)) ? 0 : static_cast<gunichar>(uniChar);
}
gchar *
@ -237,7 +237,7 @@ getCaretOffsetCB(AtkText *aText)
PRInt32 offset;
nsresult rv = accText->GetCaretOffset(&offset);
return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gint, offset);
return (NS_FAILED(rv)) ? 0 : static_cast<gint>(offset);
}
AtkAttributeSet *
@ -358,7 +358,7 @@ getCharacterCountCB(AtkText *aText)
PRInt32 count = 0;
nsresult rv = accText->GetCharacterCount(&count);
return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gint, count);
return (NS_FAILED(rv)) ? 0 : static_cast<gint>(count);
}
gint
@ -383,7 +383,7 @@ getOffsetAtPointCB(AtkText *aText,
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE;
accText->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset);
return NS_STATIC_CAST(gint, offset);
return static_cast<gint>(offset);
}
gint

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

@ -198,7 +198,7 @@ NS_IMETHODIMP nsAccessNode::Shutdown()
NS_IMETHODIMP nsAccessNode::GetUniqueID(void **aUniqueID)
{
*aUniqueID = NS_STATIC_CAST(void*, mDOMNode);
*aUniqueID = static_cast<void*>(mDOMNode);
return NS_OK;
}
@ -659,7 +659,7 @@ nsAccessNode::GetDocAccessibleFor(nsIWeakReference *aPresShell)
{
nsIAccessibleDocument *docAccessible = nsnull;
nsCOMPtr<nsIAccessNode> accessNode;
gGlobalDocAccessibleCache.Get(NS_STATIC_CAST(void*, aPresShell), getter_AddRefs(accessNode));
gGlobalDocAccessibleCache.Get(static_cast<void*>(aPresShell), getter_AddRefs(accessNode));
if (accessNode) {
CallQueryInterface(accessNode, &docAccessible);
}

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

@ -125,7 +125,7 @@ nsAccessibilityService::nsAccessibilityService()
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
nsCOMPtr<nsIWebProgress> progress(do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID));
if (progress) {
progress->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,this),
progress->AddProgressListener(static_cast<nsIWebProgressListener*>(this),
nsIWebProgress::NOTIFY_STATE_DOCUMENT |
nsIWebProgress::NOTIFY_LOCATION);
}
@ -155,7 +155,7 @@ nsAccessibilityService::Observe(nsISupports *aSubject, const char *aTopic,
}
nsCOMPtr<nsIWebProgress> progress(do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID));
if (progress) {
progress->RemoveProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,this));
progress->RemoveProgressListener(static_cast<nsIWebProgressListener*>(this));
}
nsAccessNodeWrap::ShutdownAccessibility();
}
@ -279,7 +279,7 @@ nsresult
nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
{
NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!");
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
*aRealFrame = static_cast<nsIFrame*>(aFrame);
nsCOMPtr<nsIContent> content = (*aRealFrame)->GetContent();
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
if (!content || !node)
@ -651,7 +651,7 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsIFrame *frame;
GetInfo(NS_STATIC_CAST(nsIFrame*, aFrame), &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
GetInfo(static_cast<nsIFrame*>(aFrame), &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
*aAccessible = nsnull;
if (!frame || frame->GetRect().IsEmpty()) {
@ -763,7 +763,7 @@ nsAccessibilityService::CreateHTMLTableHeadAccessible(nsIDOMNode *aDOMNode, nsIA
NS_ENSURE_TRUE(accTableHead, NS_ERROR_OUT_OF_MEMORY);
*_retval = NS_STATIC_CAST(nsIAccessible *, accTableHead);
*_retval = static_cast<nsIAccessible *>(accTableHead);
NS_IF_ADDREF(*_retval);
return rv;
@ -922,7 +922,7 @@ NS_IMETHODIMP nsAccessibilityService::GetCachedAccessNode(nsIDOMNode *aNode,
return NS_ERROR_FAILURE;
}
return accessibleDoc->GetCachedAccessNode(NS_STATIC_CAST(void*, aNode), aAccessNode);
return accessibleDoc->GetCachedAccessNode(static_cast<void*>(aNode), aAccessNode);
}
NS_IMETHODIMP
@ -1724,7 +1724,7 @@ NS_IMETHODIMP nsAccessibilityService::AddNativeRootAccessible(void * aAtkAccessi
nsNativeRootAccessibleWrap* rootAccWrap =
new nsNativeRootAccessibleWrap((AtkObject*)aAtkAccessible);
*aRootAccessible = NS_STATIC_CAST(nsIAccessible*, rootAccWrap);
*aRootAccessible = static_cast<nsIAccessible*>(rootAccWrap);
NS_ADDREF(*aRootAccessible);
nsRefPtr<nsApplicationAccessibleWrap> appRoot =

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

@ -192,13 +192,13 @@ nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
*aInstancePtr = nsnull;
if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
*aInstancePtr = NS_STATIC_CAST(nsIAccessible*, this);
*aInstancePtr = static_cast<nsIAccessible*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
if(aIID.Equals(NS_GET_IID(nsPIAccessible))) {
*aInstancePtr = NS_STATIC_CAST(nsPIAccessible*, this);
*aInstancePtr = static_cast<nsPIAccessible*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
@ -220,7 +220,7 @@ nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsAccessibilityAtoms::multiselectable,
strings, eCaseMatters) ==
nsIContent::ATTR_VALUE_NO_MATCH) {
*aInstancePtr = NS_STATIC_CAST(nsIAccessibleSelectable*, this);
*aInstancePtr = static_cast<nsIAccessibleSelectable*>(this);
NS_ADDREF_THIS();
}
}
@ -228,7 +228,7 @@ nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
if (aIID.Equals(NS_GET_IID(nsIAccessibleValue))) {
if (mRoleMapEntry && mRoleMapEntry->valueRule != eNoValue) {
*aInstancePtr = NS_STATIC_CAST(nsIAccessibleValue*, this);
*aInstancePtr = static_cast<nsIAccessibleValue*>(this);
NS_ADDREF_THIS();
}
}
@ -237,7 +237,7 @@ nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsCOMPtr<nsIAccessible> parent(GetParent());
nsCOMPtr<nsIAccessibleHyperText> hyperTextParent(do_QueryInterface(parent));
if (hyperTextParent) {
*aInstancePtr = NS_STATIC_CAST(nsIAccessibleHyperLink*, this);
*aInstancePtr = static_cast<nsIAccessibleHyperLink*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
@ -255,7 +255,7 @@ nsAccessible::nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): nsAcces
{
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(aShell));
printf(">>> %p Created Acc - DOM: %p PS: %p",
(void*)NS_STATIC_CAST(nsIAccessible*, this), (void*)aNode,
(void*)static_cast<nsIAccessible*>(this), (void*)aNode,
(void*)shell.get());
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
if (content) {
@ -2810,7 +2810,7 @@ void nsAccessible::DoCommandCallback(nsITimer *aTimer, void *aClosure)
NS_ASSERTION(gDoCommandTimer, "How did we get here if there was no gDoCommandTimer?");
NS_RELEASE(gDoCommandTimer);
nsIContent *content = NS_REINTERPRET_CAST(nsIContent*, aClosure);
nsIContent *content = reinterpret_cast<nsIContent*>(aClosure);
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(content));
if (xulElement) {
xulElement->Click();

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

@ -68,7 +68,7 @@ class nsIAtom;
class nsIView;
// When mNextSibling is set to this, it indicates there ar eno more siblings
#define DEAD_END_ACCESSIBLE NS_STATIC_CAST(nsIAccessible*, (void*)1)
#define DEAD_END_ACCESSIBLE static_cast<nsIAccessible*>((void*)1)
// Saves a data member -- if child count equals this value we haven't
// cached children or child count yet

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

@ -143,7 +143,7 @@ nsApplicationAccessible::GetChildAt(PRInt32 aChildNum, nsIAccessible **aChild)
NS_ENSURE_SUCCESS(rv, rv);
}
if (aChildNum >= NS_STATIC_CAST(PRInt32, count) || count == 0)
if (aChildNum >= static_cast<PRInt32>(count) || count == 0)
return NS_ERROR_INVALID_ARG;
if (aChildNum < 0)
@ -213,7 +213,7 @@ nsApplicationAccessible::CacheChildren()
PRUint32 count = 0;
mChildren->GetLength(&count);
mAccChildCount = NS_STATIC_CAST(PRInt32, count);
mAccChildCount = static_cast<PRInt32>(count);
}
}

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

@ -516,7 +516,7 @@ NS_IMETHODIMP nsDocAccessible::Init()
NS_IMETHODIMP nsDocAccessible::Destroy()
{
if (mWeakShell) {
gGlobalDocAccessibleCache.Remove(NS_STATIC_CAST(void*, mWeakShell));
gGlobalDocAccessibleCache.Remove(static_cast<void*>(mWeakShell));
}
return Shutdown();
}
@ -822,7 +822,7 @@ NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
void nsDocAccessible::ScrollTimerCallback(nsITimer *aTimer, void *aClosure)
{
nsDocAccessible *docAcc = NS_REINTERPRET_CAST(nsDocAccessible*, aClosure);
nsDocAccessible *docAcc = reinterpret_cast<nsDocAccessible*>(aClosure);
if (docAcc && docAcc->mScrollPositionChangedTicks &&
++docAcc->mScrollPositionChangedTicks > 2) {
@ -1235,7 +1235,7 @@ nsDocAccessible::FireDelayedAccessibleEvent(nsIAccessibleEvent *aEvent,
// This is be the first delayed event in queue, start timer
// so that event gets fired via FlushEventsCallback
mFireEventTimer->InitWithFuncCallback(FlushEventsCallback,
NS_STATIC_CAST(nsPIAccessibleDocument*, this),
static_cast<nsPIAccessibleDocument*>(this),
0, nsITimer::TYPE_ONE_SHOT);
}
@ -1294,7 +1294,7 @@ NS_IMETHODIMP nsDocAccessible::FlushPendingEvents()
void nsDocAccessible::FlushEventsCallback(nsITimer *aTimer, void *aClosure)
{
nsPIAccessibleDocument *accessibleDoc = NS_STATIC_CAST(nsPIAccessibleDocument*, aClosure);
nsPIAccessibleDocument *accessibleDoc = static_cast<nsPIAccessibleDocument*>(aClosure);
NS_ASSERTION(accessibleDoc, "How did we get here without an accessible document?");
accessibleDoc->FlushPendingEvents();
}
@ -1315,7 +1315,7 @@ void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode, PRUint32 aChangeEvent
// children when they override Shutdown()
// Don't shutdown our doc object!
if (accessNode != NS_STATIC_CAST(nsIAccessNode*, this)) {
if (accessNode != static_cast<nsIAccessNode*>(this)) {
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(accessNode));
if (accessible) {
@ -1545,7 +1545,7 @@ void nsDocAccessible::DocLoadCallback(nsITimer *aTimer, void *aClosure)
// which is important because we only fire doc loaded events for focused documents.
nsDocAccessible *docAcc =
NS_REINTERPRET_CAST(nsDocAccessible*, aClosure);
reinterpret_cast<nsDocAccessible*>(aClosure);
if (!docAcc) {
return;
}

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

@ -94,7 +94,7 @@
NS_IMPL_QUERY_HEAD(nsRootAccessible)
NS_IMPL_QUERY_BODY(nsIDOMEventListener)
if (aIID.Equals(NS_GET_IID(nsRootAccessible)))
foundInterface = NS_REINTERPRET_CAST(nsISupports*, this);
foundInterface = reinterpret_cast<nsISupports*>(this);
else
NS_IMPL_QUERY_TAIL_INHERITING(nsDocAccessible)
@ -866,7 +866,7 @@ void nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsIDOMNode **aTargetNo
void nsRootAccessible::FireFocusCallback(nsITimer *aTimer, void *aClosure)
{
nsRootAccessible *rootAccessible = NS_STATIC_CAST(nsRootAccessible*, aClosure);
nsRootAccessible *rootAccessible = static_cast<nsRootAccessible*>(aClosure);
NS_ASSERTION(rootAccessible, "How did we get here without a root accessible?");
rootAccessible->FireCurrentFocusEvent();
}

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

@ -132,7 +132,7 @@ void nsHTMLSelectableAccessible::iterator::AddAccessibleIfSelected(nsIAccessibil
}
if (tempAccess)
aSelectedAccessibles->AppendElement(NS_STATIC_CAST(nsISupports*, tempAccess), PR_FALSE);
aSelectedAccessibles->AppendElement(static_cast<nsISupports*>(tempAccess), PR_FALSE);
}
PRBool nsHTMLSelectableAccessible::iterator::GetAccessibleIfSelected(PRInt32 aIndex,
@ -565,7 +565,7 @@ nsHTMLSelectOptionAccessible::GetAttributesInternal(nsIPersistentProperties *aAt
}
nsAccUtils::SetAccGroupAttrs(aAttributes, level, posInSet,
NS_STATIC_CAST(PRInt32, setSize));
static_cast<PRInt32>(setSize));
return NS_OK;
}
@ -1170,7 +1170,7 @@ nsHTMLTextFieldAccessible(aDOMNode, aShell)
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same as for our parent, use |this| pointer as the unique Id
*aUniqueID = NS_STATIC_CAST(void*, this);
*aUniqueID = static_cast<void*>(this);
return NS_OK;
}
@ -1290,7 +1290,7 @@ NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetActionName(PRUint8 aIndex, nsAS
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same for all tree item, use |this| pointer as the unique Id
*aUniqueID = NS_STATIC_CAST(void*, this);
*aUniqueID = static_cast<void*>(this);
return NS_OK;
}
@ -1422,7 +1422,7 @@ NS_IMETHODIMP nsHTMLComboboxListAccessible::GetParent(nsIAccessible **aParent)
NS_IMETHODIMP nsHTMLComboboxListAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same for all tree item, use |this| pointer as the unique Id
*aUniqueID = NS_STATIC_CAST(void*, this);
*aUniqueID = static_cast<void*>(this);
return NS_OK;
}

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

@ -167,7 +167,7 @@ nsHTMLBRAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
NS_IMETHODIMP nsHTMLBRAccessible::GetName(nsAString& aName)
{
aName = NS_STATIC_CAST(PRUnichar, '\n'); // Newline char
aName = static_cast<PRUnichar>('\n'); // Newline char
return NS_OK;
}
@ -313,7 +313,7 @@ NS_IMETHODIMP
nsHTMLListBulletAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same as for list item, use |this| pointer as the unique Id
*aUniqueID = NS_STATIC_CAST(void*, this);
*aUniqueID = static_cast<void*>(this);
return NS_OK;
}

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

@ -81,7 +81,7 @@ nsresult nsHyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePt
PRInt32 numChildren;
GetChildCount(&numChildren);
if (numChildren > 0) {
*aInstancePtr = NS_STATIC_CAST(nsIAccessibleText*, this);
*aInstancePtr = static_cast<nsIAccessibleText*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
@ -91,7 +91,7 @@ nsresult nsHyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePt
if (aIID.Equals(NS_GET_IID(nsIAccessibleHyperText))) {
if (IsHyperText()) {
// If |this| contains text and embedded objects
*aInstancePtr = NS_STATIC_CAST(nsIAccessibleHyperText*, this);
*aInstancePtr = static_cast<nsIAccessibleHyperText*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
@ -103,7 +103,7 @@ nsresult nsHyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePt
PRUint32 state, extState;
GetState(&state, &extState);
if (extState & nsIAccessibleStates::EXT_STATE_EDITABLE) {
*aInstancePtr = NS_STATIC_CAST(nsIAccessibleEditableText*, this);
*aInstancePtr = static_cast<nsIAccessibleEditableText*>(this);
NS_ADDREF_THIS();
return NS_OK;
}

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

@ -328,7 +328,7 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
//
// get the native root accessible, and tell it to return its first parent unignored accessible.
nsRefPtr<nsRootAccessible> root(mGeckoAccessible->GetRootAccessible());
id nativeParent = GetNativeFromGeckoAccessible(NS_STATIC_CAST(nsIAccessible*, root));
id nativeParent = GetNativeFromGeckoAccessible(static_cast<nsIAccessible*>(root));
NSAssert1 (nativeParent, @"!!! we can't find a parent for %@", self);
return GetClosestInterestingAccessible(nativeParent);
@ -510,7 +510,7 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
- (NSWindow*)window
{
nsAccessibleWrap *accWrap = NS_STATIC_CAST (nsAccessibleWrap*, mGeckoAccessible);
nsAccessibleWrap *accWrap = static_cast<nsAccessibleWrap*>(mGeckoAccessible);
NSWindow *nativeWindow = nil;
accWrap->GetNativeWindow ((void**)&nativeWindow);

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

@ -44,7 +44,7 @@
static id <mozAccessible, mozView> getNativeViewFromRootAccessible (nsAccessible *accessible)
{
nsRootAccessibleWrap *root = NS_STATIC_CAST (nsRootAccessibleWrap*, accessible);
nsRootAccessibleWrap *root = static_cast<nsRootAccessibleWrap*>(accessible);
id <mozAccessible, mozView> nativeView = nil;
root->GetNativeWidget ((void**)&nativeView);
return nativeView;

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

@ -117,10 +117,10 @@ class nsAccessibleWrap : public nsAccessible
nsCOMPtr<nsIAccessible> curParent = GetParent();
while (curParent) {
nsAccessibleWrap *ancestorWrap = NS_STATIC_CAST(nsAccessibleWrap*, (nsIAccessible*)curParent.get());
nsAccessibleWrap *ancestorWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)curParent.get());
if (ancestorWrap->IsFlat())
return PR_TRUE;
curParent = NS_STATIC_CAST(nsAccessibleWrap*, (nsIAccessible*)curParent.get())->GetParent();
curParent = static_cast<nsAccessibleWrap*>((nsIAccessible*)curParent.get())->GetParent();
}
// no parent was flat
return PR_FALSE;

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

@ -214,7 +214,7 @@ nsAccessibleWrap::GetUnignoredChildCount(PRBool aDeepCount)
nsCOMPtr<nsIAccessible> curAcc;
while (NextChild(curAcc)) {
nsAccessibleWrap *childWrap = NS_STATIC_CAST(nsAccessibleWrap*, (nsIAccessible*)curAcc.get());
nsAccessibleWrap *childWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)curAcc.get());
// if the current child is not ignored, count it.
if (!childWrap->IsIgnored())
@ -256,7 +256,7 @@ nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aC
return;
while (NextChild(curAcc)) {
nsAccessibleWrap *childWrap = NS_STATIC_CAST(nsAccessibleWrap*, (nsIAccessible*)curAcc.get());
nsAccessibleWrap *childWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)curAcc.get());
if (childWrap->IsIgnored()) {
// element is ignored, so try adding its children as substitutes, if it has any.
if (!childWrap->IsFlat()) {
@ -277,7 +277,7 @@ already_AddRefed<nsIAccessible>
nsAccessibleWrap::GetUnignoredParent()
{
nsCOMPtr<nsIAccessible> parent(GetParent());
nsAccessibleWrap *parentWrap = NS_STATIC_CAST(nsAccessibleWrap*, (nsIAccessible*)parent.get());
nsAccessibleWrap *parentWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)parent.get());
if (!parentWrap)
return nsnull;

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

@ -56,8 +56,8 @@ CAccessibleAction::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleAction == iid) {
*ppv = NS_STATIC_CAST(IAccessibleAction*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleAction*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
@ -89,7 +89,7 @@ CAccessibleAction::doAction(long aActionIndex)
if (!acc)
return E_FAIL;
PRUint8 index = NS_STATIC_CAST(PRUint8, aActionIndex);
PRUint8 index = static_cast<PRUint8>(aActionIndex);
if (NS_SUCCEEDED(acc->DoAction(index)))
return S_OK;
return E_FAIL;
@ -105,7 +105,7 @@ CAccessibleAction::get_description(long aActionIndex, BSTR *aDescription)
return E_FAIL;
nsAutoString description;
PRUint8 index = NS_STATIC_CAST(PRUint8, aActionIndex);
PRUint8 index = static_cast<PRUint8>(aActionIndex);
if (NS_FAILED(acc->GetActionDescription(index, description)))
return E_FAIL;
@ -130,7 +130,7 @@ CAccessibleAction::get_keyBinding(long aActionIndex, long aNumMaxBinding,
return E_FAIL;
nsCOMPtr<nsIDOMDOMStringList> keys;
PRUint8 index = NS_STATIC_CAST(PRUint8, aActionIndex);
PRUint8 index = static_cast<PRUint8>(aActionIndex);
nsresult rv = acc->GetKeyBindings(index, getter_AddRefs(keys));
if (NS_FAILED(rv))
return E_FAIL;
@ -138,9 +138,9 @@ CAccessibleAction::get_keyBinding(long aActionIndex, long aNumMaxBinding,
PRUint32 length = 0;
keys->GetLength(&length);
PRBool aUseNumMaxBinding = length > NS_STATIC_CAST(PRUint32, aNumMaxBinding);
PRBool aUseNumMaxBinding = length > static_cast<PRUint32>(aNumMaxBinding);
PRUint32 maxBinding = NS_STATIC_CAST(PRUint32, aNumMaxBinding);
PRUint32 maxBinding = static_cast<PRUint32>(aNumMaxBinding);
PRUint32 numBinding = length > maxBinding ? maxBinding : length;
*aNumBinding = numBinding;
@ -171,7 +171,7 @@ CAccessibleAction::get_name(long aActionIndex, BSTR *aName)
return E_FAIL;
nsAutoString name;
PRUint8 index = NS_STATIC_CAST(PRUint8, aActionIndex);
PRUint8 index = static_cast<PRUint8>(aActionIndex);
if (NS_FAILED(acc->GetActionName(index, name)))
return E_FAIL;

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

@ -67,8 +67,8 @@ CAccessibleComponent::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleComponent == iid) {
*ppv = NS_STATIC_CAST(IAccessibleComponent*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleComponent*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}

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

@ -64,8 +64,8 @@ CAccessibleEditableText::QueryInterface(REFIID iid, void** ppv)
nsCOMPtr<nsIAccessibleEditableText> editTextAcc(do_QueryInterface(this));
if (!editTextAcc)
return E_NOINTERFACE;
*ppv = NS_STATIC_CAST(IAccessibleEditableText*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleEditableText*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}

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

@ -65,8 +65,8 @@ CAccessibleHyperlink::QueryInterface(REFIID iid, void** ppv)
if (!acc)
return E_NOINTERFACE;
*ppv = NS_STATIC_CAST(IAccessibleHyperlink*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleHyperlink*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
@ -99,7 +99,7 @@ CAccessibleHyperlink::get_anchor(long aIndex, VARIANT *aAnchor)
if (NS_FAILED(rv))
return E_FAIL;
IUnknown *unknownPtr = NS_STATIC_CAST(IUnknown*, instancePtr);
IUnknown *unknownPtr = static_cast<IUnknown*>(instancePtr);
aAnchor->ppunkVal = &unknownPtr;
aAnchor->vt = VT_UNKNOWN;

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

@ -59,8 +59,8 @@ CAccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
if (!hyperAcc)
return E_NOINTERFACE;
*ppv = NS_STATIC_CAST(IAccessibleHypertext*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleHypertext*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
@ -107,7 +107,7 @@ CAccessibleHypertext::get_hyperlink(long aIndex,
void *instancePtr = NULL;
nsresult rv = winAccessNode->QueryNativeInterface(IID_IAccessibleHyperlink,
&instancePtr);
*aHyperlink = NS_STATIC_CAST(IAccessibleHyperlink*, instancePtr);
*aHyperlink = static_cast<IAccessibleHyperlink*>(instancePtr);
return NS_FAILED(rv) ? E_FAIL : S_OK;
}

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

@ -60,8 +60,8 @@ CAccessibleImage::QueryInterface(REFIID iid, void** ppv)
if (!imageAcc)
return E_FAIL;
*ppv = NS_STATIC_CAST(IAccessibleImage*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleImage*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}

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

@ -61,8 +61,8 @@ CAccessibleTable::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleTable == iid) {
*ppv = NS_STATIC_CAST(IAccessibleTable*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleTable*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
@ -95,7 +95,7 @@ CAccessibleTable::get_accessibleAt(long aRow, long aColumn,
if (NS_FAILED(rv))
return E_FAIL;
*aAccessible = NS_STATIC_CAST(IUnknown*, instancePtr);
*aAccessible = static_cast<IUnknown*>(instancePtr);
return S_OK;
}
@ -122,7 +122,7 @@ CAccessibleTable::get_caption(IUnknown **aAccessible)
if (NS_FAILED(rv))
return E_FAIL;
*aAccessible = NS_STATIC_CAST(IUnknown*, instancePtr);
*aAccessible = static_cast<IUnknown*>(instancePtr);
return S_OK;
}
@ -208,7 +208,7 @@ CAccessibleTable::get_columnHeader(IAccessibleTable **aAccessibleTable,
if (NS_FAILED(rv))
return E_FAIL;
*aAccessibleTable = NS_STATIC_CAST(IAccessibleTable*, instancePtr);
*aAccessibleTable = static_cast<IAccessibleTable*>(instancePtr);
return S_OK;
}
@ -348,7 +348,7 @@ CAccessibleTable::get_rowHeader(IAccessibleTable **aAccessibleTable,
if (NS_FAILED(rv))
return E_FAIL;
*aAccessibleTable = NS_STATIC_CAST(IAccessibleTable*, instancePtr);
*aAccessibleTable = static_cast<IAccessibleTable*>(instancePtr);
return S_OK;
}

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

@ -70,8 +70,8 @@ CAccessibleText::QueryInterface(REFIID iid, void** ppv)
if (!textAcc) {
return E_NOINTERFACE;
}
*ppv = NS_STATIC_CAST(IAccessibleText*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleText*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
@ -111,7 +111,7 @@ CAccessibleText::get_attributes(long aOffset, long *aStartOffset,
if (!instancePtr)
return E_FAIL;
IAccessible2 *pAccessible2 = NS_STATIC_CAST(IAccessible2*, *instancePtr);
IAccessible2 *pAccessible2 = static_cast<IAccessible2*>(*instancePtr);
HRESULT hr = pAccessible2->get_attributes(aTextAttributes);
pAccessible2->Release();
@ -378,7 +378,7 @@ CAccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
if (!instancePtr)
return E_FAIL;
IAccessible2 *pAccessible2 = NS_STATIC_CAST(IAccessible2*, *instancePtr);
IAccessible2 *pAccessible2 = static_cast<IAccessible2*>(*instancePtr);
HRESULT hr = pAccessible2->scrollTo(aScrollType);
pAccessible2->Release();
@ -410,7 +410,7 @@ CAccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
if (!instancePtr)
return E_FAIL;
IAccessible2 *pAccessible2 = NS_STATIC_CAST(IAccessible2*, *instancePtr);
IAccessible2 *pAccessible2 = static_cast<IAccessible2*>(*instancePtr);
HRESULT hr = pAccessible2->scrollToPoint(aCoordinateType, aX, aY);
pAccessible2->Release();

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

@ -58,8 +58,8 @@ CAccessibleValue::QueryInterface(REFIID iid, void** ppv)
if (!valueAcc)
return E_NOINTERFACE;
*ppv = NS_STATIC_CAST(IAccessibleValue*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleValue*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}

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

@ -117,12 +117,12 @@ STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv)
*ppv = nsnull;
if (IID_IUnknown == iid || IID_ISimpleDOMNode == iid)
*ppv = NS_STATIC_CAST(ISimpleDOMNode*, this);
*ppv = static_cast<ISimpleDOMNode*>(this);
if (nsnull == *ppv)
return E_NOINTERFACE; //iid not supported.
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
@ -148,7 +148,7 @@ STDMETHODIMP nsAccessNodeWrap::get_nodeInfo(
PRUint16 nodeType = 0;
mDOMNode->GetNodeType(&nodeType);
*aNodeType=NS_STATIC_CAST(unsigned short, nodeType);
*aNodeType=static_cast<unsigned short>(nodeType);
if (*aNodeType != NODETYPE_TEXT) {
nsAutoString nodeName;
@ -160,7 +160,7 @@ STDMETHODIMP nsAccessNodeWrap::get_nodeInfo(
mDOMNode->GetNodeValue(nodeValue);
*aNodeValue = ::SysAllocString(nodeValue.get());
*aNameSpaceID = content ? NS_STATIC_CAST(short, content->GetNameSpaceID()) : 0;
*aNameSpaceID = content ? static_cast<short>(content->GetNameSpaceID()) : 0;
// This is a unique ID for every content node. The 3rd party
// accessibility application can compare this to the childID we
@ -175,7 +175,7 @@ STDMETHODIMP nsAccessNodeWrap::get_nodeInfo(
nsCOMPtr<nsIDOMNodeList> nodeList;
mDOMNode->GetChildNodes(getter_AddRefs(nodeList));
if (nodeList && NS_OK == nodeList->GetLength(&numChildren))
*aNumChildren = NS_STATIC_CAST(unsigned int, numChildren);
*aNumChildren = static_cast<unsigned int>(numChildren);
return S_OK;
}
@ -199,7 +199,7 @@ STDMETHODIMP nsAccessNodeWrap::get_attributes(
if (numAttribs > aMaxAttribs)
numAttribs = aMaxAttribs;
*aNumAttribs = NS_STATIC_CAST(unsigned short, numAttribs);
*aNumAttribs = static_cast<unsigned short>(numAttribs);
for (PRUint32 index = 0; index < numAttribs; index++) {
aNameSpaceIDs[index] = 0; aAttribValues[index] = aAttribNames[index] = nsnull;
@ -207,7 +207,7 @@ STDMETHODIMP nsAccessNodeWrap::get_attributes(
const char *pszAttributeName;
const nsAttrName* name = content->GetAttrNameAt(index);
aNameSpaceIDs[index] = NS_STATIC_CAST(short, name->NamespaceID());
aNameSpaceIDs[index] = static_cast<short>(name->NamespaceID());
name->LocalName()->GetUTF8String(&pszAttributeName);
aAttribNames[index] = ::SysAllocString(NS_ConvertUTF8toUTF16(pszAttributeName).get());
content->GetAttr(name->NamespaceID(), name->LocalName(), attributeValue);
@ -242,7 +242,7 @@ STDMETHODIMP nsAccessNodeWrap::get_attributesForNames(
aAttribValues[index] = nsnull;
if (aAttribNames[index]) {
nsAutoString attributeValue, nameSpaceURI;
nsAutoString attributeName(nsDependentString(NS_STATIC_CAST(PRUnichar*,aAttribNames[index])));
nsAutoString attributeName(nsDependentString(static_cast<PRUnichar*>(aAttribNames[index])));
nsresult rv;
if (aNameSpaceID[index]>0 &&
@ -290,7 +290,7 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyle(
++realIndex;
}
}
*aNumStyleProperties = NS_STATIC_CAST(unsigned short, realIndex);
*aNumStyleProperties = static_cast<unsigned short>(realIndex);
return S_OK;
}
@ -314,7 +314,7 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyleForProperties(
for (index = 0; index < aNumStyleProperties; index ++) {
nsAutoString value;
if (aStyleProperties[index])
cssDecl->GetPropertyValue(nsDependentString(NS_STATIC_CAST(PRUnichar*,aStyleProperties[index])), value); // Get property value
cssDecl->GetPropertyValue(nsDependentString(static_cast<PRUnichar*>(aStyleProperties[index])), value); // Get property value
aStyleValues[index] = ::SysAllocString(value.get());
}
@ -376,7 +376,7 @@ ISimpleDOMNode* nsAccessNodeWrap::MakeAccessNode(nsIDOMNode *node)
return NULL;
newNode->Init();
iNode = NS_STATIC_CAST(ISimpleDOMNode*, newNode);
iNode = static_cast<ISimpleDOMNode*>(newNode);
iNode->AddRef();
}
@ -498,7 +498,7 @@ STDMETHODIMP
nsAccessNodeWrap::get_localInterface(
/* [out] */ void __RPC_FAR *__RPC_FAR *localInterface)
{
*localInterface = NS_STATIC_CAST(nsIAccessNode*, this);
*localInterface = static_cast<nsIAccessNode*>(this);
NS_ADDREF_THIS();
return S_OK;
}

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

@ -71,8 +71,8 @@ nsAccessibleRelationWrap::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleRelation == iid || IID_IUnknown == iid) {
*ppv = NS_STATIC_CAST(IAccessibleRelation*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleRelation*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
@ -175,7 +175,7 @@ nsAccessibleRelationWrap::get_target(long aTargetIndex, IUnknown **aTarget)
if (NS_FAILED(rv))
return E_FAIL;
*aTarget = NS_STATIC_CAST(IUnknown*, instancePtr);
*aTarget = static_cast<IUnknown*>(instancePtr);
return S_OK;
}
@ -209,7 +209,7 @@ nsAccessibleRelationWrap::get_targets(long aMaxTargets, IUnknown **aTarget,
if (NS_FAILED(rv))
break;
aTarget[index] = NS_STATIC_CAST(IUnknown*, instancePtr);
aTarget[index] = static_cast<IUnknown*>(instancePtr);
}
if (NS_FAILED(rv)) {

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

@ -106,16 +106,16 @@ STDMETHODIMP nsAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IUnknown == iid || IID_IDispatch == iid || IID_IAccessible == iid)
*ppv = NS_STATIC_CAST(IAccessible*, this);
*ppv = static_cast<IAccessible*>(this);
else if (IID_IEnumVARIANT == iid && !gIsEnumVariantSupportDisabled) {
long numChildren;
get_accChildCount(&numChildren);
if (numChildren > 0) // Don't support this interface for leaf elements
*ppv = NS_STATIC_CAST(IEnumVARIANT*, this);
*ppv = static_cast<IEnumVARIANT*>(this);
} else if (IID_IServiceProvider == iid)
*ppv = NS_STATIC_CAST(IServiceProvider*, this);
*ppv = static_cast<IServiceProvider*>(this);
else if (IID_IAccessible2 == iid)
*ppv = NS_STATIC_CAST(IAccessible2*, this);
*ppv = static_cast<IAccessible2*>(this);
if (NULL == *ppv) {
HRESULT hr = CAccessibleComponent::QueryInterface(iid, ppv);
@ -138,7 +138,7 @@ STDMETHODIMP nsAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
if (NULL == *ppv)
return nsAccessNodeWrap::QueryInterface(iid, ppv);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
@ -260,7 +260,7 @@ STDMETHODIMP nsAccessibleWrap::get_accChild(
return E_FAIL;
if (varChild.lVal == CHILDID_SELF) {
*ppdispChild = NS_STATIC_CAST(IDispatch*, this);
*ppdispChild = static_cast<IDispatch*>(this);
AddRef();
return S_OK;
}
@ -728,7 +728,7 @@ STDMETHODIMP nsAccessibleWrap::get_accSelection(VARIANT __RPC_FAR *pvarChildren)
pvarChildren->vt = VT_EMPTY;
nsCOMPtr<nsIAccessibleSelectable>
select(do_QueryInterface(NS_STATIC_CAST(nsIAccessible*, this)));
select(do_QueryInterface(static_cast<nsIAccessible*>(this)));
if (select) { // do we have an nsIAccessibleSelectable?
// we have an accessible that can have children selected
@ -959,7 +959,7 @@ STDMETHODIMP nsAccessibleWrap::accHitTest(
// if we got a child
if (xpAccessible) {
// if the child is us
if (xpAccessible == NS_STATIC_CAST(nsIAccessible*, this)) {
if (xpAccessible == static_cast<nsIAccessible*>(this)) {
pvarChild->vt = VT_I4;
pvarChild->lVal = CHILDID_SELF;
} else { // its not create an Accessible for it.
@ -1061,7 +1061,7 @@ nsAccessibleWrap::Next(ULONG aNumElementsRequested, VARIANT FAR* pvar, ULONG FAR
for (long childIndex = 0; pvar[*aNumElementsFetched].vt == VT_DISPATCH; ++childIndex) {
PRBool wasAccessibleFetched = PR_FALSE;
nsAccessibleWrap *msaaAccessible =
NS_STATIC_CAST(nsAccessibleWrap*, pvar[*aNumElementsFetched].pdispVal);
static_cast<nsAccessibleWrap*>(pvar[*aNumElementsFetched].pdispVal);
if (!msaaAccessible)
break;
if (childIndex >= mEnumVARIANTPosition) {
@ -1074,14 +1074,14 @@ nsAccessibleWrap::Next(ULONG aNumElementsRequested, VARIANT FAR* pvar, ULONG FAR
msaaAccessible->nsAccessNode::Release(); // this accessible will not be received by the caller
}
mEnumVARIANTPosition += NS_STATIC_CAST(PRUint16, *aNumElementsFetched);
mEnumVARIANTPosition += static_cast<PRUint16>(*aNumElementsFetched);
return NOERROR;
}
STDMETHODIMP
nsAccessibleWrap::Skip(ULONG aNumElements)
{
mEnumVARIANTPosition += NS_STATIC_CAST(PRUint16, aNumElements);
mEnumVARIANTPosition += static_cast<PRUint16>(aNumElements);
PRInt32 numChildren;
GetChildCount(&numChildren);
@ -1133,7 +1133,7 @@ nsAccessibleWrap::get_relation(long aRelationIndex,
if (NS_FAILED(rv))
return E_FAIL;
*aRelation = NS_STATIC_CAST(IAccessibleRelation*, instancePtr);
*aRelation = static_cast<IAccessibleRelation*>(instancePtr);
return S_OK;
}
@ -1168,7 +1168,7 @@ nsAccessibleWrap::get_relations(long aMaxRelations,
if (NS_FAILED(rv))
break;
aRelation[index] = NS_STATIC_CAST(IAccessibleRelation*, instancePtr);
aRelation[index] = static_cast<IAccessibleRelation*>(instancePtr);
}
if (NS_FAILED(rv)) {
@ -1326,7 +1326,7 @@ nsAccessibleWrap::get_uniqueID(long *uniqueID)
{
void *id;
if (NS_SUCCEEDED(GetUniqueID(&id))) {
*uniqueID = NS_REINTERPRET_POINTER_CAST(long, id);
*uniqueID = reinterpret_cast<long>(id);
return S_OK;
}
return E_FAIL;
@ -1337,7 +1337,7 @@ nsAccessibleWrap::get_windowHandle(HWND *windowHandle)
{
void **handle = nsnull;
if (NS_SUCCEEDED(GetOwnerWindow(handle))) {
*windowHandle = NS_REINTERPRET_POINTER_CAST(HWND, *handle);
*windowHandle = reinterpret_cast<HWND>(*handle);
return S_OK;
}
return E_FAIL;
@ -1434,7 +1434,7 @@ nsAccessibleWrap::Clone(IEnumVARIANT FAR* FAR* ppenum)
if (!accessibleWrap)
return E_FAIL;
IAccessible *msaaAccessible = NS_STATIC_CAST(IAccessible*, accessibleWrap);
IAccessible *msaaAccessible = static_cast<IAccessible*>(accessibleWrap);
msaaAccessible->AddRef();
QueryInterface(IID_IEnumVARIANT, (void**)ppenum);
if (*ppenum)
@ -1479,7 +1479,7 @@ STDMETHODIMP nsAccessibleWrap::Invoke(DISPID dispIdMember, REFIID riid,
NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
{
*aOutAccessible = NS_STATIC_CAST(IAccessible*, this);
*aOutAccessible = static_cast<IAccessible*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
@ -1637,7 +1637,7 @@ IDispatch *nsAccessibleWrap::NativeAccessible(nsIAccessible *aXPAccessible)
accObject->GetHwnd(&hwnd);
if (hwnd) {
IDispatch *retval = nsnull;
AccessibleObjectFromWindow(NS_REINTERPRET_CAST(HWND, hwnd),
AccessibleObjectFromWindow(reinterpret_cast<HWND>(hwnd),
OBJID_WINDOW, IID_IAccessible, (void **) &retval);
return retval;
}
@ -1646,7 +1646,7 @@ IDispatch *nsAccessibleWrap::NativeAccessible(nsIAccessible *aXPAccessible)
IAccessible *msaaAccessible;
aXPAccessible->GetNativeInterface((void**)&msaaAccessible);
return NS_STATIC_CAST(IDispatch*, msaaAccessible);
return static_cast<IDispatch*>(msaaAccessible);
}
@ -1658,7 +1658,7 @@ void nsAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild, nsIAccessibl
// if its us real easy - this seems to always be the case
if (aVarChild.lVal == CHILDID_SELF) {
*aXPAccessible = NS_STATIC_CAST(nsIAccessible*, this);
*aXPAccessible = static_cast<nsIAccessible*>(this);
}
else if (MustPrune(this)) {
return;

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

@ -58,8 +58,8 @@ nsApplicationAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleApplication == iid) {
*ppv = NS_STATIC_CAST(IAccessibleApplication*, this);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
*ppv = static_cast<IAccessibleApplication*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}

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

@ -85,12 +85,12 @@ STDMETHODIMP nsDocAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_ISimpleDOMDocument == iid)
*ppv = NS_STATIC_CAST(ISimpleDOMDocument*, this);
*ppv = static_cast<ISimpleDOMDocument*>(this);
if (NULL == *ppv)
return nsHyperTextAccessibleWrap::QueryInterface(iid, ppv);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
@ -127,7 +127,7 @@ STDMETHODIMP nsDocAccessibleWrap::get_accChild(
if (xpAccessible) {
IAccessible *msaaAccessible;
xpAccessible->GetNativeInterface((void**)&msaaAccessible);
*ppdispChild = NS_STATIC_CAST(IDispatch*, msaaAccessible);
*ppdispChild = static_cast<IDispatch*>(msaaAccessible);
return S_OK;
}
else if (mDocument) {

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

@ -67,7 +67,7 @@ nsHyperTextAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
NS_IF_RELEASE(gTextEvent);
CallQueryInterface(aEvent, &gTextEvent);
(NS_STATIC_CAST(IUnknown*, instancePtr))->Release();
(static_cast<IUnknown*>(instancePtr))->Release();
}
}
}

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

@ -78,12 +78,12 @@ STDMETHODIMP nsTextAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
*ppv = nsnull;
if (IID_IUnknown == iid || IID_ISimpleDOMText == iid)
*ppv = NS_STATIC_CAST(ISimpleDOMText*, this);
*ppv = static_cast<ISimpleDOMText*>(this);
if (nsnull == *ppv)
return nsAccessibleWrap::QueryInterface(iid, ppv);
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}

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

@ -567,7 +567,7 @@ NS_IMETHODIMP nsXULTreeitemAccessible::GetName(nsAString& aName)
NS_IMETHODIMP nsXULTreeitemAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same for all tree item, use |this| pointer as the unique Id
*aUniqueID = NS_STATIC_CAST(void*, this);
*aUniqueID = static_cast<void*>(this);
return NS_OK;
}

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

@ -2009,7 +2009,7 @@ nsBookmarksService::GetBookmarkToPing(nsIRDFResource **theBookmark)
void
nsBookmarksService::FireTimer(nsITimer* aTimer, void* aClosure)
{
nsBookmarksService *bmks = NS_STATIC_CAST(nsBookmarksService *, aClosure);
nsBookmarksService *bmks = static_cast<nsBookmarksService *>(aClosure);
if (!bmks) return;
nsresult rv;
@ -3613,7 +3613,7 @@ CompareLastModifiedFolders(nsIRDFResource* aResource1, nsIRDFResource* aResource
{
nsCOMPtr<nsIRDFNode> node1, node2;
nsIRDFDataSource* outer = NS_STATIC_CAST(nsIRDFDataSource*, aOuter);
nsIRDFDataSource* outer = static_cast<nsIRDFDataSource*>(aOuter);
outer->GetTarget(aResource1, kWEB_LastModifiedDate, PR_TRUE, getter_AddRefs(node1));
outer->GetTarget(aResource2, kWEB_LastModifiedDate, PR_TRUE, getter_AddRefs(node2));
@ -3666,7 +3666,7 @@ nsBookmarksService::GetLastModifiedFolders(nsISimpleEnumerator **aResult)
}
// sort the array containing all the folders
folderArray.Sort(CompareLastModifiedFolders, NS_STATIC_CAST(void*, mInner));
folderArray.Sort(CompareLastModifiedFolders, static_cast<void*>(mInner));
// only keep the first elements
PRInt32 index;

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

@ -388,7 +388,7 @@ nsFeedSniffer::AppendSegmentToString(nsIInputStream* inputStream,
PRUint32 count,
PRUint32* writeCount)
{
nsCString* decodedData = NS_STATIC_CAST(nsCString*, closure);
nsCString* decodedData = static_cast<nsCString*>(closure);
decodedData->Append(rawSegment, count);
*writeCount = count;
return NS_OK;

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

@ -196,7 +196,7 @@ TranslateDWORDtoPRInt32(nsIWindowsRegKey *aRegKey,
PRInt32 prefIntValue = 0;
if (NS_SUCCEEDED(aRegKey->ReadIntValue(aRegValueName,
NS_REINTERPRET_CAST(PRUint32 *, &prefIntValue))))
reinterpret_cast<PRUint32 *>(&prefIntValue))))
aPrefs->SetIntPref(aPrefKeyName, prefIntValue);
}

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

@ -796,7 +796,7 @@ nsOperaCookieMigrator::Migrate()
break;
case COOKIE_EXPIRY:
mStream->Read16(&length);
mStream->Read32(NS_REINTERPRET_CAST(PRUint32*, &(mCurrCookie.expiryTime)));
mStream->Read32(reinterpret_cast<PRUint32*>(&(mCurrCookie.expiryTime)));
break;
case COOKIE_SECURE:
mCurrCookie.isSecure = PR_TRUE;
@ -808,7 +808,7 @@ nsOperaCookieMigrator::Migrate()
{
mStream->Read16(&length);
PRTime temp;
mStream->Read32(NS_REINTERPRET_CAST(PRUint32*, &temp));
mStream->Read32(reinterpret_cast<PRUint32*>(&temp));
}
break;
case COOKIE_COMMENT:

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

@ -1298,12 +1298,12 @@ BookmarkContentSink::SetFaviconForURI(nsIURI* aPageURI, nsIURI* aIconURI,
return NS_ERROR_FAILURE;
// read all the decoded data
PRUint8* buffer = NS_STATIC_CAST(PRUint8*,
nsMemory::Alloc(sizeof(PRUint8) * available));
PRUint8* buffer = static_cast<PRUint8*>
(nsMemory::Alloc(sizeof(PRUint8) * available));
if (!buffer)
return NS_ERROR_OUT_OF_MEMORY;
PRUint32 numRead;
rv = stream->Read(NS_REINTERPRET_CAST(char*, buffer), available, &numRead);
rv = stream->Read(reinterpret_cast<char*>(buffer), available, &numRead);
if (NS_FAILED(rv) || numRead != available) {
nsMemory::Free(buffer);
return rv;
@ -1484,7 +1484,7 @@ static nsresult
DataToDataURI(PRUint8* aData, PRUint32 aDataLen, const nsACString& aMimeType,
nsACString& aDataURI)
{
char* encoded = PL_Base64Encode(NS_REINTERPRET_CAST(const char*, aData),
char* encoded = PL_Base64Encode(reinterpret_cast<const char*>(aData),
aDataLen, nsnull);
if (!encoded)
return NS_ERROR_OUT_OF_MEMORY;

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

@ -97,7 +97,7 @@ public:
typedef const nsIPrincipal* KeyTypePointer;
PrincipalKey(const nsIPrincipal* key)
: mKey(NS_CONST_CAST(nsIPrincipal*, key))
: mKey(const_cast<nsIPrincipal*>(key))
{
}
@ -118,7 +118,7 @@ public:
PRBool KeyEquals(KeyTypePointer aKey) const
{
PRBool eq;
mKey->Equals(NS_CONST_CAST(nsIPrincipal*, aKey),
mKey->Equals(const_cast<nsIPrincipal*>(aKey),
&eq);
return eq;
}
@ -131,7 +131,7 @@ public:
static PLDHashNumber HashKey(KeyTypePointer aKey)
{
PRUint32 hash;
NS_CONST_CAST(nsIPrincipal*, aKey)->GetHashValue(&hash);
const_cast<nsIPrincipal*>(aKey)->GetHashValue(&hash);
return PLDHashNumber(hash);
}
@ -352,10 +352,10 @@ MoveClassPolicyEntry(PLDHashTable *table,
memcpy(to, from, table->entrySize);
// Now update the mDefaultPolicy pointer that points to us, if any.
ClassPolicy* cp = NS_STATIC_CAST(ClassPolicy*, to);
ClassPolicy* cp = static_cast<ClassPolicy*>(to);
if (cp->mDomainWeAreWildcardFor) {
NS_ASSERTION(cp->mDomainWeAreWildcardFor->mWildcardPolicy ==
NS_STATIC_CAST(const ClassPolicy*, from),
static_cast<const ClassPolicy*>(from),
"Unexpected wildcard policy on mDomainWeAreWildcardFor");
cp->mDomainWeAreWildcardFor->mWildcardPolicy = cp;
}

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

@ -63,8 +63,8 @@ nsGlobalPrivilegesEnabled(JSContext *cx, JSPrincipals *jsprin)
JS_STATIC_DLL_CALLBACK(JSBool)
nsJSPrincipalsSubsume(JSPrincipals *jsprin, JSPrincipals *other)
{
nsJSPrincipals *nsjsprin = NS_STATIC_CAST(nsJSPrincipals *, jsprin);
nsJSPrincipals *nsother = NS_STATIC_CAST(nsJSPrincipals *, other);
nsJSPrincipals *nsjsprin = static_cast<nsJSPrincipals *>(jsprin);
nsJSPrincipals *nsother = static_cast<nsJSPrincipals *>(other);
JSBool result;
nsresult rv = nsjsprin->nsIPrincipalPtr->Subsumes(nsother->nsIPrincipalPtr,
@ -75,7 +75,7 @@ nsJSPrincipalsSubsume(JSPrincipals *jsprin, JSPrincipals *other)
JS_STATIC_DLL_CALLBACK(void)
nsDestroyJSPrincipals(JSContext *cx, struct JSPrincipals *jsprin)
{
nsJSPrincipals *nsjsprin = NS_STATIC_CAST(nsJSPrincipals *, jsprin);
nsJSPrincipals *nsjsprin = static_cast<nsJSPrincipals *>(jsprin);
// We need to destroy the nsIPrincipal. We'll do this by adding
// to the refcount and calling release
@ -106,7 +106,7 @@ nsTranscodeJSPrincipals(JSXDRState *xdr, JSPrincipals **jsprinp)
if (xdr->mode == JSXDR_ENCODE) {
nsIObjectOutputStream *stream =
NS_REINTERPRET_CAST(nsIObjectOutputStream*, xdr->userdata);
reinterpret_cast<nsIObjectOutputStream*>(xdr->userdata);
// Flush xdr'ed data to the underlying object output stream.
uint32 size;
@ -121,7 +121,7 @@ nsTranscodeJSPrincipals(JSXDRState *xdr, JSPrincipals **jsprinp)
// Require that GetJSPrincipals has been called already by the
// code that compiled the script that owns the principals.
nsJSPrincipals *nsjsprin =
NS_STATIC_CAST(nsJSPrincipals*, *jsprinp);
static_cast<nsJSPrincipals*>(*jsprinp);
rv = stream->WriteObject(nsjsprin->nsIPrincipalPtr, PR_TRUE);
}
@ -129,7 +129,7 @@ nsTranscodeJSPrincipals(JSXDRState *xdr, JSPrincipals **jsprinp)
} else {
NS_ASSERTION(JS_XDRMemDataLeft(xdr) == 0, "XDR out of sync?!");
nsIObjectInputStream *stream =
NS_REINTERPRET_CAST(nsIObjectInputStream*, xdr->userdata);
reinterpret_cast<nsIObjectInputStream*>(xdr->userdata);
nsCOMPtr<nsIPrincipal> prin;
rv = stream->ReadObject(PR_TRUE, getter_AddRefs(prin));

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

@ -235,8 +235,7 @@ nsPrincipal::GetSecurityPolicy(void** aSecurityPolicy)
NS_IMETHODIMP
nsPrincipal::SetSecurityPolicy(void* aSecurityPolicy)
{
DomainPolicy *newPolicy = NS_REINTERPRET_CAST(
DomainPolicy *, aSecurityPolicy);
DomainPolicy *newPolicy = reinterpret_cast<DomainPolicy *>(aSecurityPolicy);
if (newPolicy)
newPolicy->Hold();
@ -932,7 +931,7 @@ nsPrincipal::Read(nsIObjectInputStream* aStream)
return rv;
}
if (!mAnnotations.InsertElementAt(NS_REINTERPRET_CAST(void*, ht), i)) {
if (!mAnnotations.InsertElementAt(reinterpret_cast<void*>(ht), i)) {
delete ht;
return NS_ERROR_OUT_OF_MEMORY;
}
@ -977,7 +976,7 @@ nsPrincipal::Write(nsIObjectOutputStream* aStream)
}
for (PRInt32 i = 0, n = PRInt32(annotationCount); i < n; i++) {
nsHashtable *ht = NS_REINTERPRET_CAST(nsHashtable *, mAnnotations[i]);
nsHashtable *ht = reinterpret_cast<nsHashtable *>(mAnnotations[i]);
rv = ht->Write(aStream, WriteScalarValue);
if (NS_FAILED(rv)) {
return rv;

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

@ -106,7 +106,7 @@ JSValIDToString(JSContext *cx, const jsval idval)
JSString *str = JS_ValueToString(cx, idval);
if(!str)
return nsnull;
return NS_REINTERPRET_CAST(PRUnichar*, JS_GetStringChars(str));
return reinterpret_cast<PRUnichar*>(JS_GetStringChars(str));
}
static nsIScriptContext *
@ -127,7 +127,7 @@ inline void SetPendingException(JSContext *cx, const PRUnichar *aMsg)
{
JSAutoRequest ar(cx);
JSString *str = JS_NewUCStringCopyZ(cx,
NS_REINTERPRET_CAST(const jschar*, aMsg));
reinterpret_cast<const jschar*>(aMsg));
if (str)
JS_SetPendingException(cx, STRING_TO_JSVAL(str));
}
@ -150,7 +150,7 @@ class ClassInfoData
public:
ClassInfoData(nsIClassInfo *aClassInfo, const char *aName)
: mClassInfo(aClassInfo),
mName(NS_CONST_CAST(char *, aName)),
mName(const_cast<char *>(aName)),
mDidGetFlags(PR_FALSE),
mMustFreeName(PR_FALSE)
{
@ -200,7 +200,7 @@ public:
if (mName) {
mMustFreeName = PR_TRUE;
} else {
mName = NS_CONST_CAST(char *, "UnnamedClass");
mName = const_cast<char *>("UnnamedClass");
}
}
@ -1056,8 +1056,8 @@ nsScriptSecurityManager::LookupPolicy(nsIPrincipal* aPrincipal,
printf("ClassLookup ");
#endif
cpolicy = NS_STATIC_CAST(ClassPolicy*,
PL_DHashTableOperate(dpolicy,
cpolicy = static_cast<ClassPolicy*>
(PL_DHashTableOperate(dpolicy,
aClassData.GetName(),
PL_DHASH_LOOKUP));
@ -1076,8 +1076,8 @@ nsScriptSecurityManager::LookupPolicy(nsIPrincipal* aPrincipal,
PropertyPolicy* ppolicy = nsnull;
if (cpolicy != NO_POLICY_FOR_CLASS)
{
ppolicy = NS_STATIC_CAST(PropertyPolicy*,
PL_DHashTableOperate(cpolicy->mPolicy,
ppolicy = static_cast<PropertyPolicy*>
(PL_DHashTableOperate(cpolicy->mPolicy,
(void*)aProperty,
PL_DHASH_LOOKUP));
}
@ -1088,8 +1088,8 @@ nsScriptSecurityManager::LookupPolicy(nsIPrincipal* aPrincipal,
(!ppolicy || PL_DHASH_ENTRY_IS_FREE(ppolicy)))
{
ppolicy =
NS_STATIC_CAST(PropertyPolicy*,
PL_DHashTableOperate(dpolicy->mWildcardPolicy->mPolicy,
static_cast<PropertyPolicy*>
(PL_DHashTableOperate(dpolicy->mWildcardPolicy->mPolicy,
(void*)aProperty,
PL_DHASH_LOOKUP));
}
@ -1100,16 +1100,16 @@ nsScriptSecurityManager::LookupPolicy(nsIPrincipal* aPrincipal,
if (dpolicy != mDefaultPolicy &&
(!ppolicy || PL_DHASH_ENTRY_IS_FREE(ppolicy)))
{
cpolicy = NS_STATIC_CAST(ClassPolicy*,
PL_DHashTableOperate(mDefaultPolicy,
cpolicy = static_cast<ClassPolicy*>
(PL_DHashTableOperate(mDefaultPolicy,
aClassData.GetName(),
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(cpolicy))
{
ppolicy =
NS_STATIC_CAST(PropertyPolicy*,
PL_DHashTableOperate(cpolicy->mPolicy,
static_cast<PropertyPolicy*>
(PL_DHashTableOperate(cpolicy->mPolicy,
(void*)aProperty,
PL_DHASH_LOOKUP));
}
@ -1118,8 +1118,8 @@ nsScriptSecurityManager::LookupPolicy(nsIPrincipal* aPrincipal,
mDefaultPolicy->mWildcardPolicy)
{
ppolicy =
NS_STATIC_CAST(PropertyPolicy*,
PL_DHashTableOperate(mDefaultPolicy->mWildcardPolicy->mPolicy,
static_cast<PropertyPolicy*>
(PL_DHashTableOperate(mDefaultPolicy->mWildcardPolicy->mPolicy,
(void*)aProperty,
PL_DHASH_LOOKUP));
}
@ -1833,8 +1833,8 @@ nsScriptSecurityManager::DoGetCertificatePrincipal(const nsACString& aCertFinger
// Make sure this principal has names, so if we ever go to save it
// we'll save them. If we get a name mismatch here we'll throw,
// but that's desirable.
rv = NS_STATIC_CAST(nsPrincipal*,
NS_STATIC_CAST(nsIPrincipal*, fromTable))
rv = static_cast<nsPrincipal*>
(static_cast<nsIPrincipal*>(fromTable))
->EnsureCertData(aSubjectName, aPrettyName, aCertificate);
if (NS_FAILED(rv)) {
// We have a subject name mismatch for the same cert id.
@ -1848,9 +1848,9 @@ nsScriptSecurityManager::DoGetCertificatePrincipal(const nsACString& aCertFinger
if (!aURI) {
// We were asked to just get the base certificate, so output
// what we have in the table.
certificate = NS_STATIC_CAST(nsPrincipal*,
NS_STATIC_CAST(nsIPrincipal*,
fromTable));
certificate = static_cast<nsPrincipal*>
(static_cast<nsIPrincipal*>
(fromTable));
} else {
// We found a certificate and now need to install a codebase
// on it. We don't want to modify the principal in the hash
@ -2040,7 +2040,7 @@ nsScriptSecurityManager::GetScriptPrincipal(JSContext *cx,
// Script didn't have principals -- shouldn't happen.
return nsnull;
}
nsJSPrincipals *nsJSPrin = NS_STATIC_CAST(nsJSPrincipals *, jsp);
nsJSPrincipals *nsJSPrin = static_cast<nsJSPrincipals *>(jsp);
nsIPrincipal* result = nsJSPrin->nsIPrincipalPtr;
if (!result)
*rv = NS_ERROR_FAILURE;
@ -3236,7 +3236,7 @@ nsScriptSecurityManager::SystemPrincipalSingletonConstructor()
nsIPrincipal *sysprin = nsnull;
if (gScriptSecMan)
NS_ADDREF(sysprin = gScriptSecMan->mSystemPrincipal);
return NS_STATIC_CAST(nsSystemPrincipal*, sysprin);
return static_cast<nsSystemPrincipal*>(sysprin);
}
nsresult
@ -3468,7 +3468,7 @@ nsScriptSecurityManager::InitDomainPolicy(JSContext* cx,
{ //-- pref value is the name of a capability
nsCStringKey secLevelKey(prefValue);
secLevel.capability =
NS_REINTERPRET_CAST(char*, mCapabilities->Get(&secLevelKey));
reinterpret_cast<char*>(mCapabilities->Get(&secLevelKey));
if (!secLevel.capability)
{
secLevel.capability = NS_strdup(prefValue);
@ -3482,8 +3482,8 @@ nsScriptSecurityManager::InitDomainPolicy(JSContext* cx,
*end = '\0';
// Find or store this class in the classes table
ClassPolicy* cpolicy =
NS_STATIC_CAST(ClassPolicy*,
PL_DHashTableOperate(aDomainPolicy, start,
static_cast<ClassPolicy*>
(PL_DHashTableOperate(aDomainPolicy, start,
PL_DHASH_ADD));
if (!cpolicy)
break;
@ -3513,10 +3513,10 @@ nsScriptSecurityManager::InitDomainPolicy(JSContext* cx,
// Store this property in the class policy
const void* ppkey =
NS_REINTERPRET_CAST(const void*, STRING_TO_JSVAL(propertyKey));
reinterpret_cast<const void*>(STRING_TO_JSVAL(propertyKey));
PropertyPolicy* ppolicy =
NS_STATIC_CAST(PropertyPolicy*,
PL_DHashTableOperate(cpolicy->mPolicy, ppkey,
static_cast<PropertyPolicy*>
(PL_DHashTableOperate(cpolicy->mPolicy, ppkey,
PL_DHASH_ADD));
if (!ppolicy)
break;

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

@ -251,7 +251,7 @@ nsChromeRegistry::nsProviderArray::GetProvider(const nsACString& aPreferred, Mat
ProviderEntry* entry;
while (i--) {
entry = NS_REINTERPRET_CAST(ProviderEntry*, mArray[i]);
entry = reinterpret_cast<ProviderEntry*>(mArray[i]);
if (aPreferred.Equals(entry->provider))
return entry;
@ -318,7 +318,7 @@ nsChromeRegistry::nsProviderArray::EnumerateToArray(nsCStringArray *a)
{
PRInt32 i = mArray.Count();
while (i--) {
ProviderEntry *entry = NS_REINTERPRET_CAST(ProviderEntry*, mArray[i]);
ProviderEntry *entry = reinterpret_cast<ProviderEntry*>(mArray[i]);
a->AppendCString(entry->provider);
}
}
@ -328,7 +328,7 @@ nsChromeRegistry::nsProviderArray::Clear()
{
PRInt32 i = mArray.Count();
while (i--) {
ProviderEntry* entry = NS_REINTERPRET_CAST(ProviderEntry*, mArray[i]);
ProviderEntry* entry = reinterpret_cast<ProviderEntry*>(mArray[i]);
delete entry;
}
@ -343,7 +343,7 @@ nsChromeRegistry::PackageEntry::PackageEntry(const nsACString& aPackage) :
PLHashNumber
nsChromeRegistry::HashKey(PLDHashTable *table, const void *key)
{
const nsACString& str = *NS_REINTERPRET_CAST(const nsACString*, key);
const nsACString& str = *reinterpret_cast<const nsACString*>(key);
return HashString(str);
}
@ -351,15 +351,15 @@ PRBool
nsChromeRegistry::MatchKey(PLDHashTable *table, const PLDHashEntryHdr *entry,
const void *key)
{
const nsACString& str = *NS_REINTERPRET_CAST(const nsACString*, key);
const PackageEntry* pentry = NS_STATIC_CAST(const PackageEntry*, entry);
const nsACString& str = *reinterpret_cast<const nsACString*>(key);
const PackageEntry* pentry = static_cast<const PackageEntry*>(entry);
return str.Equals(pentry->package);
}
void
nsChromeRegistry::ClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
{
PackageEntry* pentry = NS_STATIC_CAST(PackageEntry*, entry);
PackageEntry* pentry = static_cast<PackageEntry*>(entry);
pentry->~PackageEntry();
}
@ -367,7 +367,7 @@ PRBool
nsChromeRegistry::InitEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
const void *key)
{
const nsACString& str = *NS_REINTERPRET_CAST(const nsACString*, key);
const nsACString& str = *reinterpret_cast<const nsACString*>(key);
new (entry) PackageEntry(str);
return PR_TRUE;
@ -701,7 +701,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURI, nsIURI* *aResult)
NS_ENSURE_SUCCESS(rv, rv);
PackageEntry* entry =
NS_STATIC_CAST(PackageEntry*, PL_DHashTableOperate(&mPackagesHash,
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
& (nsACString&) package,
PL_DHASH_LOOKUP));
@ -749,7 +749,7 @@ nsresult
nsChromeRegistry::GetSelectedLocale(const nsACString& aPackage, nsACString& aLocale)
{
PackageEntry* entry =
NS_STATIC_CAST(PackageEntry*, PL_DHashTableOperate(&mPackagesHash,
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
& aPackage,
PL_DHASH_LOOKUP));
@ -772,7 +772,7 @@ nsChromeRegistry::GetLocalesForPackage(const nsACString& aPackage,
return NS_ERROR_OUT_OF_MEMORY;
PackageEntry* entry =
NS_STATIC_CAST(PackageEntry*, PL_DHashTableOperate(&mPackagesHash,
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
& aPackage,
PL_DHASH_LOOKUP));
@ -883,7 +883,7 @@ nsChromeRegistry::FlushSkinCaches()
do_GetService("@mozilla.org/observer-service;1");
NS_ASSERTION(obsSvc, "Couldn't get observer service.");
obsSvc->NotifyObservers(NS_STATIC_CAST(nsIChromeRegistry*, this),
obsSvc->NotifyObservers(static_cast<nsIChromeRegistry*>(this),
NS_CHROME_FLUSH_SKINS_TOPIC, nsnull);
}
@ -2158,7 +2158,7 @@ nsChromeRegistry::ProcessManifestBuffer(char *buf, PRInt32 length,
continue;
PackageEntry* entry =
NS_STATIC_CAST(PackageEntry*, PL_DHashTableOperate(&mPackagesHash,
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
& (const nsACString&) nsDependentCString(package),
PL_DHASH_ADD));
if (!entry)
@ -2227,7 +2227,7 @@ nsChromeRegistry::ProcessManifestBuffer(char *buf, PRInt32 length,
continue;
PackageEntry* entry =
NS_STATIC_CAST(PackageEntry*, PL_DHashTableOperate(&mPackagesHash,
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
& (const nsACString&) nsDependentCString(package),
PL_DHASH_ADD));
if (!entry)
@ -2277,7 +2277,7 @@ nsChromeRegistry::ProcessManifestBuffer(char *buf, PRInt32 length,
continue;
PackageEntry* entry =
NS_STATIC_CAST(PackageEntry*, PL_DHashTableOperate(&mPackagesHash,
static_cast<PackageEntry*>(PL_DHashTableOperate(&mPackagesHash,
& (const nsACString&) nsDependentCString(package),
PL_DHASH_ADD));
if (!entry)

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

@ -979,7 +979,7 @@ public:
static void DestroyMatchString(void* aData)
{
if (aData) {
nsString* matchString = NS_STATIC_CAST(nsString*, aData);
nsString* matchString = static_cast<nsString*>(aData);
delete matchString;
}
}
@ -1205,7 +1205,7 @@ private:
#define NS_INTERFACE_MAP_ENTRY_TEAROFF(_interface, _allocator) \
if (aIID.Equals(NS_GET_IID(_interface))) { \
foundInterface = NS_STATIC_CAST(_interface *, _allocator); \
foundInterface = static_cast<_interface *>(_allocator); \
if (!foundInterface) { \
*aInstancePtr = nsnull; \
return NS_ERROR_OUT_OF_MEMORY; \

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

@ -101,8 +101,8 @@ class nsNodeSupportsWeakRefTearoff;
// Returns the first argument cast to nsINode if it is non-null, otherwise
// returns the second (which may be null)
#define NODE_FROM(content_, document_) \
((content_) ? NS_STATIC_CAST(nsINode*, (content_)) : \
NS_STATIC_CAST(nsINode*, (document_)))
((content_) ? static_cast<nsINode*>((content_)) : \
static_cast<nsINode*>((document_)))
// IID for the nsINode interface
@ -460,8 +460,8 @@ public:
nsIContent* GetParent() const
{
return NS_LIKELY(mParentPtrBits & PARENT_BIT_PARENT_IS_CONTENT) ?
NS_REINTERPRET_CAST(nsIContent*,
mParentPtrBits & ~kParentBitMask) :
reinterpret_cast<nsIContent*>
(mParentPtrBits & ~kParentBitMask) :
nsnull;
}
@ -472,7 +472,7 @@ public:
*/
nsINode* GetNodeParent() const
{
return NS_REINTERPRET_CAST(nsINode*, mParentPtrBits & ~kParentBitMask);
return reinterpret_cast<nsINode*>(mParentPtrBits & ~kParentBitMask);
}
/**
@ -621,7 +621,7 @@ protected:
nsSlots* FlagsAsSlots() const
{
NS_ASSERTION(HasSlots(), "check HasSlots first");
return NS_REINTERPRET_CAST(nsSlots*, mFlagsOrSlots);
return reinterpret_cast<nsSlots*>(mFlagsOrSlots);
}
nsSlots* GetExistingSlots() const
@ -637,7 +637,7 @@ protected:
nsSlots* slots = CreateSlots();
if (slots) {
mFlagsOrSlots = NS_REINTERPRET_CAST(PtrBits, slots);
mFlagsOrSlots = reinterpret_cast<PtrBits>(slots);
}
return slots;

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

@ -300,7 +300,7 @@ mozSanitizingHTMLSerializer::OpenContainer(const nsIParserNode& aNode)
{
PRInt32 type = aNode.GetNodeType();
mParserNode = NS_CONST_CAST(nsIParserNode *, &aNode);
mParserNode = const_cast<nsIParserNode *>(&aNode);
return DoOpenContainer(type);
}
@ -316,7 +316,7 @@ mozSanitizingHTMLSerializer::AddLeaf(const nsIParserNode& aNode)
eHTMLTags type = (eHTMLTags)aNode.GetNodeType();
const nsAString& text = aNode.GetText();
mParserNode = NS_CONST_CAST(nsIParserNode*, &aNode);
mParserNode = const_cast<nsIParserNode*>(&aNode);
return DoAddLeaf(type, text);
}

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

@ -113,7 +113,7 @@ GetIndexFromCache(const nsAttrAndChildArray* aArray)
* See Bug 231104 for more information.
*/
#define ATTRS(_impl) \
NS_REINTERPRET_CAST(InternalAttr*, &((_impl)->mBuffer[0]))
reinterpret_cast<InternalAttr*>(&((_impl)->mBuffer[0]))
#define NS_IMPL_EXTRA_SIZE \
@ -213,7 +213,7 @@ nsAttrAndChildArray::RemoveChildAt(PRUint32 aPos)
PRUint32 childCount = ChildCount();
void** pos = mImpl->mBuffer + AttrSlotsSize() + aPos;
nsIContent* child = NS_STATIC_CAST(nsIContent*, *pos);
nsIContent* child = static_cast<nsIContent*>(*pos);
NS_RELEASE(child);
memmove(pos, pos + 1, (childCount - aPos - 1) * sizeof(nsIContent*));
SetChildCount(childCount - 1);
@ -265,7 +265,7 @@ nsAttrAndChildArray::IndexOfChild(nsINode* aPossibleChild) const
if (children[cursor] == aPossibleChild) {
AddIndexToCache(this, cursor);
return NS_STATIC_CAST(PRInt32, cursor);
return static_cast<PRInt32>(cursor);
}
}
}
@ -274,7 +274,7 @@ nsAttrAndChildArray::IndexOfChild(nsINode* aPossibleChild) const
if (children[cursor] == aPossibleChild) {
AddIndexToCache(this, cursor);
return NS_STATIC_CAST(PRInt32, cursor);
return static_cast<PRInt32>(cursor);
}
}
}
@ -285,7 +285,7 @@ nsAttrAndChildArray::IndexOfChild(nsINode* aPossibleChild) const
for (i = 0; i < count; ++i) {
if (children[i] == aPossibleChild) {
return NS_STATIC_CAST(PRInt32, i);
return static_cast<PRInt32>(i);
}
}
@ -497,7 +497,7 @@ nsAttrAndChildArray::GetSafeAttrNameAt(PRUint32 aPos) const
return nsnull;
}
return &NS_REINTERPRET_CAST(InternalAttr*, pos)->mName;
return &reinterpret_cast<InternalAttr*>(pos)->mName;
}
const nsAttrName*
@ -619,7 +619,7 @@ nsAttrAndChildArray::Compact()
mImpl = nsnull;
}
else if (newSize < mImpl->mBufferSize) {
mImpl = NS_STATIC_CAST(Impl*, PR_Realloc(mImpl, (newSize + NS_IMPL_EXTRA_SIZE) * sizeof(nsIContent*)));
mImpl = static_cast<Impl*>(PR_Realloc(mImpl, (newSize + NS_IMPL_EXTRA_SIZE) * sizeof(nsIContent*)));
NS_ASSERTION(mImpl, "failed to reallocate to smaller buffer");
mImpl->mBufferSize = newSize;
@ -644,7 +644,7 @@ nsAttrAndChildArray::Clear()
PRUint32 end = slotCount * ATTRSIZE + ChildCount();
for (i = slotCount * ATTRSIZE; i < end; ++i) {
nsIContent* child = NS_STATIC_CAST(nsIContent*, mImpl->mBuffer[i]);
nsIContent* child = static_cast<nsIContent*>(mImpl->mBuffer[i]);
// making this PR_FALSE so tree teardown doesn't end up being
// O(N*D) (number of nodes times average depth of tree).
child->UnbindFromTree(PR_FALSE); // XXX is it better to let the owner do this?
@ -755,8 +755,8 @@ nsAttrAndChildArray::GrowBy(PRUint32 aGrowSize)
size = PR_BIT(PR_CeilingLog2(minSize));
}
Impl* newImpl = NS_STATIC_CAST(Impl*,
mImpl ? PR_Realloc(mImpl, size * sizeof(void*)) :
Impl* newImpl = static_cast<Impl*>
(mImpl ? PR_Realloc(mImpl, size * sizeof(void*)) :
PR_Malloc(size * sizeof(void*)));
NS_ENSURE_TRUE(newImpl, PR_FALSE);

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

@ -85,7 +85,7 @@ public:
nsIContent* ChildAt(PRUint32 aPos) const
{
NS_ASSERTION(aPos < ChildCount(), "out-of-bounds access in nsAttrAndChildArray");
return NS_REINTERPRET_CAST(nsIContent*, mImpl->mBuffer[AttrSlotsSize() + aPos]);
return reinterpret_cast<nsIContent*>(mImpl->mBuffer[AttrSlotsSize() + aPos]);
}
nsIContent* GetSafeChildAt(PRUint32 aPos) const;
nsresult AppendChild(nsIContent* aChild)

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

@ -62,7 +62,7 @@ public:
}
explicit nsAttrName(nsIAtom* aAtom)
: mBits(NS_REINTERPRET_CAST(PtrBits, aAtom))
: mBits(reinterpret_cast<PtrBits>(aAtom))
{
NS_ASSERTION(aAtom, "null atom-name in nsAttrName");
NS_ADDREF(aAtom);
@ -72,11 +72,11 @@ public:
{
NS_ASSERTION(aNodeInfo, "null nodeinfo-name in nsAttrName");
if (aNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
mBits = NS_REINTERPRET_CAST(PtrBits, aNodeInfo->NameAtom());
mBits = reinterpret_cast<PtrBits>(aNodeInfo->NameAtom());
NS_ADDREF(aNodeInfo->NameAtom());
}
else {
mBits = NS_REINTERPRET_CAST(PtrBits, aNodeInfo) |
mBits = reinterpret_cast<PtrBits>(aNodeInfo) |
NS_ATTRNAME_NODEINFO_BIT;
NS_ADDREF(aNodeInfo);
}
@ -93,11 +93,11 @@ public:
ReleaseInternalName();
if (aNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
mBits = NS_REINTERPRET_CAST(PtrBits, aNodeInfo->NameAtom());
mBits = reinterpret_cast<PtrBits>(aNodeInfo->NameAtom());
NS_ADDREF(aNodeInfo->NameAtom());
}
else {
mBits = NS_REINTERPRET_CAST(PtrBits, aNodeInfo) |
mBits = reinterpret_cast<PtrBits>(aNodeInfo) |
NS_ATTRNAME_NODEINFO_BIT;
NS_ADDREF(aNodeInfo);
}
@ -108,7 +108,7 @@ public:
NS_ASSERTION(aAtom, "null atom-name in nsAttrName");
ReleaseInternalName();
mBits = NS_REINTERPRET_CAST(PtrBits, aAtom);
mBits = reinterpret_cast<PtrBits>(aAtom);
NS_ADDREF(aAtom);
}
@ -120,13 +120,13 @@ public:
nsINodeInfo* NodeInfo() const
{
NS_ASSERTION(!IsAtom(), "getting nodeinfo-value of atom-name");
return NS_REINTERPRET_CAST(nsINodeInfo*, mBits & ~NS_ATTRNAME_NODEINFO_BIT);
return reinterpret_cast<nsINodeInfo*>(mBits & ~NS_ATTRNAME_NODEINFO_BIT);
}
nsIAtom* Atom() const
{
NS_ASSERTION(IsAtom(), "getting atom-value of nodeinfo-name");
return NS_REINTERPRET_CAST(nsIAtom*, mBits);
return reinterpret_cast<nsIAtom*>(mBits);
}
PRBool Equals(const nsAttrName& aOther) const
@ -137,7 +137,7 @@ public:
// Faster comparison in the case we know the namespace is null
PRBool Equals(nsIAtom* aAtom) const
{
return NS_REINTERPRET_CAST(PtrBits, aAtom) == mBits;
return reinterpret_cast<PtrBits>(aAtom) == mBits;
}
PRBool Equals(nsIAtom* aLocalName, PRInt32 aNamespaceID) const
@ -211,7 +211,7 @@ public:
PRBool IsSmaller(nsIAtom* aOther) const
{
return mBits < NS_REINTERPRET_CAST(PtrBits, aOther);
return mBits < reinterpret_cast<PtrBits>(aOther);
}
private:
@ -220,8 +220,8 @@ private:
{
// Since both nsINodeInfo and nsIAtom inherit nsISupports as its first
// interface we can safely assume that it's first in the vtable
nsISupports* name = NS_REINTERPRET_CAST(nsISupports *,
mBits & ~NS_ATTRNAME_NODEINFO_BIT);
nsISupports* name = reinterpret_cast<nsISupports *>
(mBits & ~NS_ATTRNAME_NODEINFO_BIT);
NS_ADDREF(name);
}
@ -230,8 +230,8 @@ private:
{
// Since both nsINodeInfo and nsIAtom inherit nsISupports as its first
// interface we can safely assume that it's first in the vtable
nsISupports* name = NS_REINTERPRET_CAST(nsISupports *,
mBits & ~NS_ATTRNAME_NODEINFO_BIT);
nsISupports* name = reinterpret_cast<nsISupports *>
(mBits & ~NS_ATTRNAME_NODEINFO_BIT);
NS_RELEASE(name);
}

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

@ -118,7 +118,7 @@ nsAttrValue::Type() const
switch (BaseType()) {
case eIntegerBase:
{
return NS_STATIC_CAST(ValueType, mBits & NS_ATTRVALUE_INTEGERTYPE_MASK);
return static_cast<ValueType>(mBits & NS_ATTRVALUE_INTEGERTYPE_MASK);
}
case eOtherBase:
{
@ -126,7 +126,7 @@ nsAttrValue::Type() const
}
default:
{
return NS_STATIC_CAST(ValueType, NS_STATIC_CAST(PRUint16, BaseType()));
return static_cast<ValueType>(static_cast<PRUint16>(BaseType()));
}
}
}
@ -137,7 +137,7 @@ nsAttrValue::Reset()
switch(BaseType()) {
case eStringBase:
{
nsStringBuffer* str = NS_STATIC_CAST(nsStringBuffer*, GetPtr());
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) {
str->Release();
}
@ -174,7 +174,7 @@ nsAttrValue::SetTo(const nsAttrValue& aOther)
case eStringBase:
{
ResetIfSet();
nsStringBuffer* str = NS_STATIC_CAST(nsStringBuffer*, aOther.GetPtr());
nsStringBuffer* str = static_cast<nsStringBuffer*>(aOther.GetPtr());
if (str) {
str->AddRef();
SetPtrValueAndType(str, eStringBase);
@ -257,7 +257,7 @@ nsAttrValue::SetTo(const nsAString& aValue)
if (!buf) {
return;
}
PRUnichar *data = NS_STATIC_CAST(PRUnichar*, buf->Data());
PRUnichar *data = static_cast<PRUnichar*>(buf->Data());
CopyUnicodeTo(aValue, 0, data, len);
data[len] = PRUnichar(0);
@ -308,7 +308,7 @@ nsAttrValue::ToString(nsAString& aResult) const
switch(Type()) {
case eString:
{
nsStringBuffer* str = NS_STATIC_CAST(nsStringBuffer*, GetPtr());
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) {
str->ToString(str->StorageSize()/sizeof(PRUnichar) - 1, aResult);
}
@ -319,7 +319,7 @@ nsAttrValue::ToString(nsAString& aResult) const
}
case eAtom:
{
nsIAtom *atom = NS_STATIC_CAST(nsIAtom*, GetPtr());
nsIAtom *atom = static_cast<nsIAtom*>(GetPtr());
atom->ToString(aResult);
break;
@ -417,7 +417,7 @@ nsAttrValue::GetStringValue() const
{
NS_PRECONDITION(Type() == eString, "wrong type");
return nsCheapString(NS_STATIC_CAST(nsStringBuffer*, GetPtr()));
return nsCheapString(static_cast<nsStringBuffer*>(GetPtr()));
}
PRBool
@ -437,7 +437,7 @@ nsAttrValue::GetColorValue(nscolor& aColor) const
}
case eIntegerBase:
{
aColor = NS_STATIC_CAST(nscolor, GetIntInternal());
aColor = static_cast<nscolor>(GetIntInternal());
break;
}
@ -489,10 +489,10 @@ nsAttrValue::HashValue() const
switch(BaseType()) {
case eStringBase:
{
nsStringBuffer* str = NS_STATIC_CAST(nsStringBuffer*, GetPtr());
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) {
PRUint32 len = str->StorageSize()/sizeof(PRUnichar) - 1;
return nsCRT::BufferHashCode(NS_STATIC_CAST(PRUnichar*, str->Data()), len);
return nsCRT::BufferHashCode(static_cast<PRUnichar*>(str->Data()), len);
}
return 0;
@ -622,9 +622,9 @@ nsAttrValue::Equals(const nsAString& aValue,
switch (BaseType()) {
case eStringBase:
{
nsStringBuffer* str = NS_STATIC_CAST(nsStringBuffer*, GetPtr());
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) {
nsDependentString dep(NS_STATIC_CAST(PRUnichar*, str->Data()),
nsDependentString dep(static_cast<PRUnichar*>(str->Data()),
str->StorageSize()/sizeof(PRUnichar) - 1);
return aCaseSensitive == eCaseMatters ? aValue.Equals(dep) :
aValue.Equals(dep, nsCaseInsensitiveStringComparator());
@ -634,7 +634,7 @@ nsAttrValue::Equals(const nsAString& aValue,
case eAtomBase:
// Need a way to just do case-insensitive compares on atoms..
if (aCaseSensitive == eCaseMatters) {
return NS_STATIC_CAST(nsIAtom*, GetPtr())->Equals(aValue);;
return static_cast<nsIAtom*>(GetPtr())->Equals(aValue);;
}
default:
break;
@ -659,9 +659,9 @@ nsAttrValue::Equals(nsIAtom* aValue, nsCaseTreatment aCaseSensitive) const
switch (BaseType()) {
case eStringBase:
{
nsStringBuffer* str = NS_STATIC_CAST(nsStringBuffer*, GetPtr());
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) {
nsDependentString dep(NS_STATIC_CAST(PRUnichar*, str->Data()),
nsDependentString dep(static_cast<PRUnichar*>(str->Data()),
str->StorageSize()/sizeof(PRUnichar) - 1);
return aValue->Equals(dep);
}
@ -669,7 +669,7 @@ nsAttrValue::Equals(nsIAtom* aValue, nsCaseTreatment aCaseSensitive) const
}
case eAtomBase:
{
return NS_STATIC_CAST(nsIAtom*, GetPtr()) == aValue;
return static_cast<nsIAtom*>(GetPtr()) == aValue;
}
default:
break;
@ -971,7 +971,7 @@ nsAttrValue::ParseColor(const nsAString& aString, nsIDocument* aDocument)
}
}
PRInt32 colAsInt = NS_STATIC_CAST(PRInt32, color);
PRInt32 colAsInt = static_cast<PRInt32>(color);
PRInt32 tmp = colAsInt * NS_ATTRVALUE_INTEGERTYPE_MULTIPLIER;
if (tmp / NS_ATTRVALUE_INTEGERTYPE_MULTIPLIER == colAsInt) {
ResetIfSet();

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

@ -298,7 +298,7 @@ inline nsIAtom*
nsAttrValue::GetAtomValue() const
{
NS_PRECONDITION(Type() == eAtom, "wrong type");
return NS_REINTERPRET_CAST(nsIAtom*, GetPtr());
return reinterpret_cast<nsIAtom*>(GetPtr());
}
inline PRInt32
@ -321,15 +321,15 @@ nsAttrValue::GetEnumValue() const
NS_PRECONDITION(Type() == eEnum, "wrong type");
// We don't need to worry about sign extension here since we're
// returning an PRInt16 which will cut away the top bits.
return NS_STATIC_CAST(PRInt16,
GetIntInternal() >> NS_ATTRVALUE_ENUMTABLEINDEX_BITS);
return static_cast<PRInt16>
(GetIntInternal() >> NS_ATTRVALUE_ENUMTABLEINDEX_BITS);
}
inline float
nsAttrValue::GetPercentValue() const
{
NS_PRECONDITION(Type() == ePercent, "wrong type");
return NS_STATIC_CAST(float, GetIntInternal()) /
return static_cast<float>(GetIntInternal()) /
100.0f;
}
@ -359,7 +359,7 @@ nsAttrValue::GetSVGValue() const
inline nsAttrValue::ValueBaseType
nsAttrValue::BaseType() const
{
return NS_STATIC_CAST(ValueBaseType, mBits & NS_ATTRVALUE_BASETYPE_MASK);
return static_cast<ValueBaseType>(mBits & NS_ATTRVALUE_BASETYPE_MASK);
}
inline void
@ -367,7 +367,7 @@ nsAttrValue::SetPtrValueAndType(void* aValue, ValueBaseType aType)
{
NS_ASSERTION(!(NS_PTR_TO_INT32(aValue) & ~NS_ATTRVALUE_POINTERVALUE_MASK),
"pointer not properly aligned, this will crash");
mBits = NS_REINTERPRET_CAST(PtrBits, aValue) | aType;
mBits = reinterpret_cast<PtrBits>(aValue) | aType;
}
inline void
@ -396,14 +396,14 @@ nsAttrValue::GetPtr() const
{
NS_ASSERTION(BaseType() != eIntegerBase,
"getting pointer from non-pointer");
return NS_REINTERPRET_CAST(void*, mBits & NS_ATTRVALUE_POINTERVALUE_MASK);
return reinterpret_cast<void*>(mBits & NS_ATTRVALUE_POINTERVALUE_MASK);
}
inline nsAttrValue::MiscContainer*
nsAttrValue::GetMiscContainer() const
{
NS_ASSERTION(BaseType() == eOtherBase, "wrong type");
return NS_STATIC_CAST(MiscContainer*, GetPtr());
return static_cast<MiscContainer*>(GetPtr());
}
inline PRInt32
@ -414,7 +414,7 @@ nsAttrValue::GetIntInternal() const
// Make sure we get a signed value.
// Lets hope the optimizer optimizes this into a shift. Unfortunatly signed
// bitshift right is implementaion dependant.
return NS_STATIC_CAST(PRInt32, mBits & ~NS_ATTRVALUE_INTEGERTYPE_MASK) /
return static_cast<PRInt32>(mBits & ~NS_ATTRVALUE_INTEGERTYPE_MASK) /
NS_ATTRVALUE_INTEGERTYPE_MULTIPLIER;
}

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

@ -217,7 +217,7 @@ nsContentAreaDragDrop::AddDragListener()
nsresult rv = NS_ERROR_FAILURE;
if (mEventTarget) {
nsIDOMDragListener *pListener = NS_STATIC_CAST(nsIDOMDragListener *, this);
nsIDOMDragListener *pListener = static_cast<nsIDOMDragListener *>(this);
rv = mEventTarget->AddEventListenerByIID(pListener,
NS_GET_IID(nsIDOMDragListener));
if (NS_SUCCEEDED(rv))
@ -239,7 +239,7 @@ nsContentAreaDragDrop::RemoveDragListener()
nsresult rv = NS_ERROR_FAILURE;
if (mEventTarget) {
nsIDOMDragListener *pListener = NS_STATIC_CAST(nsIDOMDragListener *, this);
nsIDOMDragListener *pListener = static_cast<nsIDOMDragListener *>(this);
rv =
mEventTarget->RemoveEventListenerByIID(pListener,
NS_GET_IID(nsIDOMDragListener));
@ -743,7 +743,7 @@ nsContentAreaDragDrop::DragGesture(nsIDOMEvent* inMouseEvent)
PRBool isSelection = PR_FALSE;
nsCOMPtr<nsITransferable> trans;
nsTransferableFactory factory(inMouseEvent, NS_STATIC_CAST(nsIFlavorDataProvider*, this));
nsTransferableFactory factory(inMouseEvent, static_cast<nsIFlavorDataProvider*>(this));
factory.Produce(&isSelection, getter_AddRefs(trans));
if (trans) {
@ -1636,7 +1636,7 @@ void nsTransferableFactory::GetSelectedLink(nsISelection* inSelection,
nsAutoString nodeStr;
selectionStart->GetNodeValue(nodeStr);
if (nodeStr.IsEmpty() ||
startOffset+1 >= NS_STATIC_CAST(PRInt32, nodeStr.Length())) {
startOffset+1 >= static_cast<PRInt32>(nodeStr.Length())) {
nsCOMPtr<nsIDOMNode> curr = selectionStart;
nsIDOMNode* next;

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

@ -415,7 +415,7 @@ nsContentIterator::Init(nsIDOMRange* aRange)
NS_ASSERTION(startNode->IsNodeOfType(nsINode::eCONTENT),
"Data node that's not content?");
mFirst = NS_STATIC_CAST(nsIContent*, startNode);
mFirst = static_cast<nsIContent*>(startNode);
mLast = mFirst;
mCurNode = mFirst;
@ -459,13 +459,13 @@ nsContentIterator::Init(nsIDOMRange* aRange)
NS_ASSERTION(startNode->IsNodeOfType(nsINode::eCONTENT),
"Data node that's not content?");
mFirst = NS_STATIC_CAST(nsIContent*, startNode);
mFirst = static_cast<nsIContent*>(startNode);
}
}
else {
// post-order
if (startNode->IsNodeOfType(nsINode::eCONTENT)) {
mFirst = NS_STATIC_CAST(nsIContent*, startNode);
mFirst = static_cast<nsIContent*>(startNode);
} else {
// What else can we do?
mFirst = nsnull;
@ -500,7 +500,7 @@ nsContentIterator::Init(nsIDOMRange* aRange)
{
if (mPre) {
if (endNode->IsNodeOfType(nsINode::eCONTENT)) {
mLast = NS_STATIC_CAST(nsIContent*, endNode);
mLast = static_cast<nsIContent*>(endNode);
} else {
// Not much else to do here...
mLast = nsnull;
@ -524,7 +524,7 @@ nsContentIterator::Init(nsIDOMRange* aRange)
NS_ASSERTION(endNode->IsNodeOfType(nsINode::eCONTENT),
"Data node that's not content?");
mLast = NS_STATIC_CAST(nsIContent*, endNode);
mLast = static_cast<nsIContent*>(endNode);
}
}
}

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

@ -188,7 +188,7 @@ struct ContentListHashEntry : public PLDHashEntryHdr
PR_STATIC_CALLBACK(PLDHashNumber)
ContentListHashtableHashKey(PLDHashTable *table, const void *key)
{
const nsContentListKey* list = NS_STATIC_CAST(const nsContentListKey *, key);
const nsContentListKey* list = static_cast<const nsContentListKey *>(key);
return list->GetHash();
}
@ -198,9 +198,9 @@ ContentListHashtableMatchEntry(PLDHashTable *table,
const void *key)
{
const ContentListHashEntry *e =
NS_STATIC_CAST(const ContentListHashEntry *, entry);
static_cast<const ContentListHashEntry *>(entry);
const nsContentListKey* list1 = e->mContentList->GetKey();
const nsContentListKey* list2 = NS_STATIC_CAST(const nsContentListKey *, key);
const nsContentListKey* list2 = static_cast<const nsContentListKey *>(key);
return list1->Equals(*list2);
}
@ -244,8 +244,8 @@ NS_GetContentList(nsINode* aRootNode, nsIAtom* aMatchAtom,
// A PL_DHASH_ADD is equivalent to a PL_DHASH_LOOKUP for cases
// when the entry is already in the hashtable.
entry = NS_STATIC_CAST(ContentListHashEntry *,
PL_DHashTableOperate(&gContentListHashTable,
entry = static_cast<ContentListHashEntry *>
(PL_DHashTableOperate(&gContentListHashTable,
&hashKey,
PL_DHASH_ADD));
if (entry)
@ -873,10 +873,10 @@ nsContentList::AssertInSync()
// elements that are outside of the document element.
nsIContent *root;
if (mRootNode->IsNodeOfType(nsINode::eDOCUMENT)) {
root = NS_STATIC_CAST(nsIDocument*, mRootNode)->GetRootContent();
root = static_cast<nsIDocument*>(mRootNode)->GetRootContent();
}
else {
root = NS_STATIC_CAST(nsIContent*, mRootNode);
root = static_cast<nsIContent*>(mRootNode);
}
nsCOMPtr<nsIContentIterator> iter;

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

@ -240,7 +240,7 @@ public:
NS_HIDDEN_(nsIContent*) NamedItem(const nsAString& aName, PRBool aDoFlush);
nsContentListKey* GetKey() {
return NS_STATIC_CAST(nsContentListKey*, this);
return static_cast<nsContentListKey*>(this);
}

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

@ -1352,12 +1352,12 @@ nsContentSink::DidProcessATokenImpl()
// to pressing the ENTER key in the URL bar...
PRUint32 delayBeforeLoweringThreshold =
NS_STATIC_CAST(PRUint32, ((2 * mDynamicIntervalSwitchThreshold) +
static_cast<PRUint32>(((2 * mDynamicIntervalSwitchThreshold) +
NS_DELAY_FOR_WINDOW_CREATION));
if ((currentTime - mBeginLoadTime) > delayBeforeLoweringThreshold) {
if ((currentTime - eventTime) <
NS_STATIC_CAST(PRUint32, mDynamicIntervalSwitchThreshold)) {
static_cast<PRUint32>(mDynamicIntervalSwitchThreshold)) {
if (!mDynamicLowerValue) {
// lower the dynamic values to favor application
@ -1380,7 +1380,7 @@ nsContentSink::DidProcessATokenImpl()
}
if ((currentTime - mDelayTimerStart) >
NS_STATIC_CAST(PRUint32, GetMaxTokenProcessingTime())) {
static_cast<PRUint32>(GetMaxTokenProcessingTime())) {
return NS_ERROR_HTMLPARSER_INTERRUPTED;
}

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

@ -227,7 +227,7 @@ PR_STATIC_CALLBACK(void)
EventListenerManagerHashClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
{
EventListenerManagerMapEntry *lm =
NS_STATIC_CAST(EventListenerManagerMapEntry *, entry);
static_cast<EventListenerManagerMapEntry *>(entry);
// Let the EventListenerManagerMapEntry clean itself up...
lm->~EventListenerManagerMapEntry();
@ -690,7 +690,7 @@ nsContentUtils::Shutdown()
if (sPtrsToPtrsToRelease) {
for (i = 0; i < sPtrsToPtrsToRelease->Count(); ++i) {
nsISupports** ptrToPtr =
NS_STATIC_CAST(nsISupports**, sPtrsToPtrsToRelease->ElementAt(i));
static_cast<nsISupports**>(sPtrsToPtrsToRelease->ElementAt(i));
NS_RELEASE(*ptrToPtr);
}
delete sPtrsToPtrsToRelease;
@ -823,7 +823,7 @@ nsContentUtils::InProlog(nsINode *aNode)
return PR_FALSE;
}
nsIDocument* doc = NS_STATIC_CAST(nsIDocument*, parent);
nsIDocument* doc = static_cast<nsIDocument*>(parent);
nsIContent* root = doc->GetRootContent();
return !root || doc->IndexOf(aNode) < doc->IndexOf(root);
@ -1000,13 +1000,13 @@ nsContentUtils::ReparentContentWrappersInScope(nsIScriptGlobalObject *aOldScope,
// Try really hard to find a context to work on.
nsIScriptContext *context = aOldScope->GetContext();
if (context) {
cx = NS_STATIC_CAST(JSContext *, context->GetNativeContext());
cx = static_cast<JSContext *>(context->GetNativeContext());
}
if (!cx) {
context = aNewScope->GetContext();
if (context) {
cx = NS_STATIC_CAST(JSContext *, context->GetNativeContext());
cx = static_cast<JSContext *>(context->GetNativeContext());
}
if (!cx) {
@ -1293,17 +1293,17 @@ nsContentUtils::ComparePosition(nsINode* aNode1,
// Check if either node is an attribute
nsIAttribute* attr1 = nsnull;
if (aNode1->IsNodeOfType(nsINode::eATTRIBUTE)) {
attr1 = NS_STATIC_CAST(nsIAttribute*, aNode1);
attr1 = static_cast<nsIAttribute*>(aNode1);
nsIContent* elem = attr1->GetContent();
// If there is an owner element add the attribute
// to the chain and walk up to the element
if (elem) {
aNode1 = elem;
parents1.AppendElement(NS_STATIC_CAST(nsINode*, attr1));
parents1.AppendElement(static_cast<nsINode*>(attr1));
}
}
if (aNode2->IsNodeOfType(nsINode::eATTRIBUTE)) {
nsIAttribute* attr2 = NS_STATIC_CAST(nsIAttribute*, aNode2);
nsIAttribute* attr2 = static_cast<nsIAttribute*>(aNode2);
nsIContent* elem = attr2->GetContent();
if (elem == aNode1 && attr1) {
// Both nodes are attributes on the same element.
@ -1329,7 +1329,7 @@ nsContentUtils::ComparePosition(nsINode* aNode1,
if (elem) {
aNode2 = elem;
parents2.AppendElement(NS_STATIC_CAST(nsINode*, attr2));
parents2.AppendElement(static_cast<nsINode*>(attr2));
}
}
@ -1374,8 +1374,8 @@ nsContentUtils::ComparePosition(nsINode* aNode1,
// IndexOf will return -1 for the attribute making the attribute be
// considered before any child.
return parent->IndexOf(child1) < parent->IndexOf(child2) ?
NS_STATIC_CAST(PRUint16, nsIDOM3Node::DOCUMENT_POSITION_PRECEDING) :
NS_STATIC_CAST(PRUint16, nsIDOM3Node::DOCUMENT_POSITION_FOLLOWING);
static_cast<PRUint16>(nsIDOM3Node::DOCUMENT_POSITION_PRECEDING) :
static_cast<PRUint16>(nsIDOM3Node::DOCUMENT_POSITION_FOLLOWING);
}
parent = child1;
}
@ -3039,8 +3039,8 @@ nsContentUtils::TraverseListenerManager(nsINode *aNode,
}
EventListenerManagerMapEntry *entry =
NS_STATIC_CAST(EventListenerManagerMapEntry *,
PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
static_cast<EventListenerManagerMapEntry *>
(PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
cb.NoteXPCOMChild(entry->mListenerManager);
@ -3067,8 +3067,8 @@ nsContentUtils::GetListenerManager(nsINode *aNode,
if (!aCreateIfNotFound) {
EventListenerManagerMapEntry *entry =
NS_STATIC_CAST(EventListenerManagerMapEntry *,
PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
static_cast<EventListenerManagerMapEntry *>
(PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
*aResult = entry->mListenerManager;
@ -3078,8 +3078,8 @@ nsContentUtils::GetListenerManager(nsINode *aNode,
}
EventListenerManagerMapEntry *entry =
NS_STATIC_CAST(EventListenerManagerMapEntry *,
PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
static_cast<EventListenerManagerMapEntry *>
(PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
PL_DHASH_ADD));
if (!entry) {
@ -3112,8 +3112,8 @@ nsContentUtils::RemoveListenerManager(nsINode *aNode)
{
if (sEventListenerManagersHash.ops) {
EventListenerManagerMapEntry *entry =
NS_STATIC_CAST(EventListenerManagerMapEntry *,
PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
static_cast<EventListenerManagerMapEntry *>
(PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
nsCOMPtr<nsIEventListenerManager> listenerManager;
@ -3426,7 +3426,7 @@ nsContentUtils::AppendNodeTextContent(nsINode* aNode, PRBool aDeep,
nsAString& aResult)
{
if (aNode->IsNodeOfType(nsINode::eTEXT)) {
NS_STATIC_CAST(nsIContent*, aNode)->AppendTextTo(aResult);
static_cast<nsIContent*>(aNode)->AppendTextTo(aResult);
}
else if (aDeep) {
AppendNodeTextContentsRecurse(aNode, aResult);
@ -3478,7 +3478,7 @@ nsContentUtils::IsInSameAnonymousTree(nsINode* aNode,
return aContent->GetBindingParent() == nsnull;
}
return NS_STATIC_CAST(nsIContent*, aNode)->GetBindingParent() ==
return static_cast<nsIContent*>(aNode)->GetBindingParent() ==
aContent->GetBindingParent();
}

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

@ -366,7 +366,7 @@ nsresult
nsDOMAttribute::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
nsAutoString value;
NS_CONST_CAST(nsDOMAttribute*, this)->GetValue(value);
const_cast<nsDOMAttribute*>(this)->GetValue(value);
*aResult = new nsDOMAttribute(nsnull, aNodeInfo, value);
if (!*aResult) {
@ -469,7 +469,7 @@ nsDOMAttribute::IsSupported(const nsAString& aFeature,
const nsAString& aVersion,
PRBool* aReturn)
{
return nsGenericElement::InternalIsSupported(NS_STATIC_CAST(nsIDOMAttr*, this),
return nsGenericElement::InternalIsSupported(static_cast<nsIDOMAttr*>(this),
aFeature, aVersion, aReturn);
}
@ -503,7 +503,7 @@ nsDOMAttribute::IsSameNode(nsIDOMNode* aOther,
{
NS_ASSERTION(aReturn, "IsSameNode() called with aReturn == nsnull!");
*aReturn = SameCOMIdentity(NS_STATIC_CAST(nsIDOMNode*, this), aOther);
*aReturn = SameCOMIdentity(static_cast<nsIDOMNode*>(this), aOther);
return NS_OK;
}
@ -572,7 +572,7 @@ nsDOMAttribute::GetFeature(const nsAString& aFeature,
const nsAString& aVersion,
nsISupports** aReturn)
{
return nsGenericElement::InternalGetFeature(NS_STATIC_CAST(nsIDOMAttr*, this),
return nsGenericElement::InternalGetFeature(static_cast<nsIDOMAttr*>(this),
aFeature, aVersion, aReturn);
}
@ -768,7 +768,7 @@ nsDOMAttribute::EnsureChildState(PRBool aSetText, PRBool &aHasChild) const
{
aHasChild = PR_FALSE;
nsDOMAttribute* mutableThis = NS_CONST_CAST(nsDOMAttribute*, this);
nsDOMAttribute* mutableThis = const_cast<nsDOMAttribute*>(this);
nsAutoString value;
mutableThis->GetValue(value);

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

@ -101,7 +101,7 @@ PLDHashOperator
TraverseMapEntry(nsAttrHashKey::KeyType aKey, nsCOMPtr<nsIDOMNode>& aData, void* aUserArg)
{
nsCycleCollectionTraversalCallback *cb =
NS_STATIC_CAST(nsCycleCollectionTraversalCallback*, aUserArg);
static_cast<nsCycleCollectionTraversalCallback*>(aUserArg);
cb->NoteXPCOMChild(aData.get());
@ -129,7 +129,7 @@ SetOwnerDocumentFunc(nsAttrHashKey::KeyType aKey, nsCOMPtr<nsIDOMNode>& aData,
{
nsCOMPtr<nsIAttribute> attr(do_QueryInterface(aData));
NS_ASSERTION(attr, "non-nsIAttribute somehow made it into the hashmap?!");
nsresult rv = attr->SetOwnerDocument(NS_STATIC_CAST(nsIDocument*, aUserArg));
nsresult rv = attr->SetOwnerDocument(static_cast<nsIDocument*>(aUserArg));
return NS_FAILED(rv) ? PL_DHASH_STOP : PL_DHASH_NEXT;
}

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

@ -163,7 +163,7 @@ nsDOMParser::ParseFromBuffer(const PRUint8 *buf,
// The new stream holds a reference to the buffer
nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream),
NS_REINTERPRET_CAST(const char *, buf),
reinterpret_cast<const char *>(buf),
bufLen, NS_ASSIGNMENT_DEPEND);
if (NS_FAILED(rv))
return rv;
@ -225,13 +225,12 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream,
// Register as a load listener on the document
nsCOMPtr<nsPIDOMEventTarget> target(do_QueryInterface(domDocument));
if (target) {
nsWeakPtr requestWeak(do_GetWeakReference(NS_STATIC_CAST(nsIDOMParser*, this)));
nsWeakPtr requestWeak(do_GetWeakReference(static_cast<nsIDOMParser*>(this)));
nsLoadListenerProxy* proxy = new nsLoadListenerProxy(requestWeak);
if (!proxy) return NS_ERROR_OUT_OF_MEMORY;
// This will addref the proxy
rv = target->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMEventListener*,
proxy),
rv = target->AddEventListenerByIID(static_cast<nsIDOMEventListener*>(proxy),
NS_GET_IID(nsIDOMLoadListener));
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -258,8 +258,8 @@ nsUint32ToContentHashEntryVisitorCallback(nsISupportsHashKey* aEntry,
void* aClosure)
{
nsUint32ToContentHashEntry::Visitor* visitor =
NS_STATIC_CAST(nsUint32ToContentHashEntry::Visitor*, aClosure);
visitor->Visit(NS_STATIC_CAST(nsIContent*, aEntry->GetKey()));
static_cast<nsUint32ToContentHashEntry::Visitor*>(aClosure);
visitor->Visit(static_cast<nsIContent*>(aEntry->GetKey()));
return PL_DHASH_NEXT;
}
@ -673,7 +673,7 @@ nsDOMImplementation::HasFeature(const nsAString& aFeature,
PRBool* aReturn)
{
return nsGenericElement::InternalIsSupported(
NS_STATIC_CAST(nsIDOMDOMImplementation*, this),
static_cast<nsIDOMDOMImplementation*>(this),
aFeature, aVersion, aReturn);
}
@ -786,7 +786,7 @@ nsDocument::~nsDocument()
#endif
#ifdef DEBUG
nsCycleCollector_DEBUG_wasFreed(NS_STATIC_CAST(nsIDocument*, this));
nsCycleCollector_DEBUG_wasFreed(static_cast<nsIDocument*>(this));
#endif
mInDestructor = PR_TRUE;
@ -913,7 +913,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDocument)
nsresult rv;
mXPathEvaluatorTearoff =
do_CreateInstance(NS_XPATH_EVALUATOR_CONTRACTID,
NS_STATIC_CAST(nsIDocument *, this), &rv);
static_cast<nsIDocument *>(this), &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -933,9 +933,9 @@ PR_STATIC_CALLBACK(PLDHashOperator)
SubDocTraverser(PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number,
void *arg)
{
SubDocMapEntry *entry = NS_STATIC_CAST(SubDocMapEntry*, hdr);
SubDocMapEntry *entry = static_cast<SubDocMapEntry*>(hdr);
nsCycleCollectionTraversalCallback *cb =
NS_STATIC_CAST(nsCycleCollectionTraversalCallback*, arg);
static_cast<nsCycleCollectionTraversalCallback*>(arg);
cb->NoteXPCOMChild(entry->mKey);
cb->NoteXPCOMChild(entry->mSubDocument);
@ -946,16 +946,16 @@ SubDocTraverser(PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number,
PR_STATIC_CALLBACK(PRIntn)
RadioGroupsTraverser(nsHashKey *aKey, void *aData, void* aClosure)
{
nsRadioGroupStruct *entry = NS_STATIC_CAST(nsRadioGroupStruct*, aData);
nsRadioGroupStruct *entry = static_cast<nsRadioGroupStruct*>(aData);
nsCycleCollectionTraversalCallback *cb =
NS_STATIC_CAST(nsCycleCollectionTraversalCallback*, aClosure);
static_cast<nsCycleCollectionTraversalCallback*>(aClosure);
cb->NoteXPCOMChild(entry->mSelectedRadioButton);
nsSmallVoidArray &radioButtons = entry->mRadioButtons;
PRUint32 i, count = radioButtons.Count();
for (i = 0; i < count; ++i) {
cb->NoteXPCOMChild(NS_STATIC_CAST(nsIFormControl*, radioButtons[i]));
cb->NoteXPCOMChild(static_cast<nsIFormControl*>(radioButtons[i]));
}
@ -966,7 +966,7 @@ PR_STATIC_CALLBACK(PLDHashOperator)
BoxObjectTraverser(nsISupports* key, nsPIBoxObject* boxObject, void* userArg)
{
nsCycleCollectionTraversalCallback *cb =
NS_STATIC_CAST(nsCycleCollectionTraversalCallback*, userArg);
static_cast<nsCycleCollectionTraversalCallback*>(userArg);
cb->NoteXPCOMChild(key);
cb->NoteXPCOMChild(boxObject);
@ -988,7 +988,7 @@ PLDHashOperator PR_CALLBACK
LinkMapTraverser(nsUint32ToContentHashEntry* aEntry, void* userArg)
{
LinkMapTraversalVisitor visitor;
visitor.mCb = NS_STATIC_CAST(nsCycleCollectionTraversalCallback*, userArg);
visitor.mCb = static_cast<nsCycleCollectionTraversalCallback*>(userArg);
aEntry->VisitContent(&visitor);
return PL_DHASH_NEXT;
}
@ -1622,7 +1622,7 @@ nsDocument::GetActiveElement(nsIDOMElement **aElement)
// No focused element anywhere in this document. Try to get the BODY.
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc =
do_QueryInterface(NS_STATIC_CAST(nsIDocument*, this));
do_QueryInterface(static_cast<nsIDocument*>(this));
if (htmlDoc) {
nsCOMPtr<nsIDOMHTMLElement> bodyElement;
htmlDoc->GetBody(getter_AddRefs(bodyElement));
@ -1694,7 +1694,7 @@ nsDocument::MatchClassNames(nsIContent* aContent,
}
// need to match *all* of the classes
nsCOMArray<nsIAtom>* classes = NS_STATIC_CAST(nsCOMArray<nsIAtom>*, aData);
nsCOMArray<nsIAtom>* classes = static_cast<nsCOMArray<nsIAtom>*>(aData);
PRInt32 length = classes->Count();
PRInt32 i;
for (i = 0; i < length; ++i) {
@ -1710,7 +1710,7 @@ nsDocument::MatchClassNames(nsIContent* aContent,
void
nsDocument::DestroyClassNameArray(void* aData)
{
nsCOMArray<nsIAtom>* classes = NS_STATIC_CAST(nsCOMArray<nsIAtom>*, aData);
nsCOMArray<nsIAtom>* classes = static_cast<nsCOMArray<nsIAtom>*>(aData);
delete classes;
}
@ -1765,9 +1765,9 @@ nsDocument::SetDocumentCharacterSet(const nsACString& aCharSetID)
for (PRInt32 i = 0; i < n; i++) {
nsIObserver* observer =
NS_STATIC_CAST(nsIObserver *, mCharSetObservers.ElementAt(i));
static_cast<nsIObserver *>(mCharSetObservers.ElementAt(i));
observer->Observe(NS_STATIC_CAST(nsIDocument *, this), "charset",
observer->Observe(static_cast<nsIDocument *>(this), "charset",
NS_ConvertASCIItoUTF16(aCharSetID).get());
}
}
@ -1979,7 +1979,7 @@ nsDocument::GetPrimaryShell() const
PR_STATIC_CALLBACK(void)
SubDocClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
{
SubDocMapEntry *e = NS_STATIC_CAST(SubDocMapEntry *, entry);
SubDocMapEntry *e = static_cast<SubDocMapEntry *>(entry);
NS_RELEASE(e->mKey);
NS_IF_RELEASE(e->mSubDocument);
@ -1989,11 +1989,11 @@ PR_STATIC_CALLBACK(PRBool)
SubDocInitEntry(PLDHashTable *table, PLDHashEntryHdr *entry, const void *key)
{
SubDocMapEntry *e =
NS_CONST_CAST(SubDocMapEntry *,
NS_STATIC_CAST(const SubDocMapEntry *, entry));
const_cast<SubDocMapEntry *>
(static_cast<const SubDocMapEntry *>(entry));
e->mKey = NS_CONST_CAST(nsIContent *,
NS_STATIC_CAST(const nsIContent *, key));
e->mKey = const_cast<nsIContent *>
(static_cast<const nsIContent *>(key));
NS_ADDREF(e->mKey);
e->mSubDocument = nsnull;
@ -2010,8 +2010,8 @@ nsDocument::SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc)
if (mSubDocuments) {
SubDocMapEntry *entry =
NS_STATIC_CAST(SubDocMapEntry*,
PL_DHashTableOperate(mSubDocuments, aContent,
static_cast<SubDocMapEntry*>
(PL_DHashTableOperate(mSubDocuments, aContent,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
@ -2045,8 +2045,8 @@ nsDocument::SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc)
// Add a mapping to the hash table
SubDocMapEntry *entry =
NS_STATIC_CAST(SubDocMapEntry*,
PL_DHashTableOperate(mSubDocuments, aContent,
static_cast<SubDocMapEntry*>
(PL_DHashTableOperate(mSubDocuments, aContent,
PL_DHASH_ADD));
if (!entry) {
@ -2074,8 +2074,8 @@ nsDocument::GetSubDocumentFor(nsIContent *aContent) const
{
if (mSubDocuments) {
SubDocMapEntry *entry =
NS_STATIC_CAST(SubDocMapEntry*,
PL_DHashTableOperate(mSubDocuments, aContent,
static_cast<SubDocMapEntry*>
(PL_DHashTableOperate(mSubDocuments, aContent,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
@ -2090,8 +2090,8 @@ PR_STATIC_CALLBACK(PLDHashOperator)
FindContentEnumerator(PLDHashTable *table, PLDHashEntryHdr *hdr,
PRUint32 number, void *arg)
{
SubDocMapEntry *entry = NS_STATIC_CAST(SubDocMapEntry*, hdr);
FindContentData *data = NS_STATIC_CAST(FindContentData*, arg);
SubDocMapEntry *entry = static_cast<SubDocMapEntry*>(hdr);
FindContentData *data = static_cast<FindContentData*>(arg);
if (entry->mSubDocument == data->mSubDocument) {
data->mResult = entry->mKey;
@ -2683,7 +2683,7 @@ nsDocument::DispatchContentLoadedEvents()
// Fire a DOM event notifying listeners that this document has been
// loaded (excluding images and other loads initiated by this
// document).
nsContentUtils::DispatchTrustedEvent(this, NS_STATIC_CAST(nsIDocument*, this),
nsContentUtils::DispatchTrustedEvent(this, static_cast<nsIDocument*>(this),
NS_LITERAL_STRING("DOMContentLoaded"),
PR_TRUE, PR_TRUE);
@ -3436,7 +3436,7 @@ nsDocument::LoadBindingDocument(const nsAString& aURI)
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURI,
mCharacterSet.get(),
NS_STATIC_CAST(nsIDocument *, this)->GetBaseURI());
static_cast<nsIDocument *>(this)->GetBaseURI());
NS_ENSURE_SUCCESS(rv, rv);
mBindingManager->LoadBindingDocument(this, uri);
@ -3636,7 +3636,7 @@ nsDocument::SetTitle(const nsAString& aTitle)
mDocumentTitle.Assign(aTitle);
// Fire a DOM event for the title change.
nsContentUtils::DispatchTrustedEvent(this, NS_STATIC_CAST(nsIDocument*, this),
nsContentUtils::DispatchTrustedEvent(this, static_cast<nsIDocument*>(this),
NS_LITERAL_STRING("DOMTitleChanged"),
PR_TRUE, PR_TRUE);
@ -4018,7 +4018,7 @@ NS_IMETHODIMP
nsDocument::IsSupported(const nsAString& aFeature, const nsAString& aVersion,
PRBool* aReturn)
{
return nsGenericElement::InternalIsSupported(NS_STATIC_CAST(nsIDOMDocument*, this),
return nsGenericElement::InternalIsSupported(static_cast<nsIDOMDocument*>(this),
aFeature, aVersion, aReturn);
}
@ -4131,7 +4131,7 @@ nsDocument::GetFeature(const nsAString& aFeature,
const nsAString& aVersion,
nsISupports** aReturn)
{
return nsGenericElement::InternalGetFeature(NS_STATIC_CAST(nsIDOMDocument*, this),
return nsGenericElement::InternalGetFeature(static_cast<nsIDOMDocument*>(this),
aFeature, aVersion, aReturn);
}
@ -4274,7 +4274,7 @@ PLDHashOperator PR_CALLBACK
BlastFunc(nsAttrHashKey::KeyType aKey, nsIDOMNode *aData, void* aUserArg)
{
nsCOMPtr<nsIAttribute> *attr =
NS_STATIC_CAST(nsCOMPtr<nsIAttribute>*, aUserArg);
static_cast<nsCOMPtr<nsIAttribute>*>(aUserArg);
*attr = do_QueryInterface(aData);
@ -4289,7 +4289,7 @@ BlastSubtreeToPieces(nsINode *aNode)
{
PRUint32 i, count;
if (aNode->IsNodeOfType(nsINode::eELEMENT)) {
nsGenericElement *element = NS_STATIC_CAST(nsGenericElement*, aNode);
nsGenericElement *element = static_cast<nsGenericElement*>(aNode);
const nsDOMAttributeMap *map = element->GetAttributeMap();
if (map) {
nsCOMPtr<nsIAttribute> attr;
@ -4523,7 +4523,7 @@ nsDocument::GetListenerManager(PRBool aCreateIfNotFound,
nsresult rv = NS_NewEventListenerManager(getter_AddRefs(mListenerManager));
NS_ENSURE_SUCCESS(rv, rv);
mListenerManager->SetListenerTarget(NS_STATIC_CAST(nsIDocument *,this));
mListenerManager->SetListenerTarget(static_cast<nsIDocument *>(this));
*aInstancePtrResult = mListenerManager;
NS_ADDREF(*aInstancePtrResult);
@ -4570,7 +4570,7 @@ nsDocument::DispatchDOMEvent(nsEvent* aEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus)
{
return nsEventDispatcher::DispatchDOMEvent(NS_STATIC_CAST(nsINode*, this),
return nsEventDispatcher::DispatchDOMEvent(static_cast<nsINode*>(this),
aEvent, aDOMEvent,
aPresContext, aEventStatus);
}
@ -4632,7 +4632,7 @@ nsDocument::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
nsEventStatus status = nsEventStatus_eIgnore;
nsresult rv =
nsEventDispatcher::DispatchDOMEvent(NS_STATIC_CAST(nsINode*, this),
nsEventDispatcher::DispatchDOMEvent(static_cast<nsINode*>(this),
nsnull, aEvent, context, &status);
*_retval = (status != nsEventStatus_eConsumeNoDefault);
@ -4931,7 +4931,7 @@ nsDocument::GetRadioGroup(const nsAString& aName,
ToLowerCase(tmKey); //should case-insensitive.
nsStringKey key(tmKey);
nsRadioGroupStruct *radioGroup =
NS_STATIC_CAST(nsRadioGroupStruct *, mRadioGroups.Get(&key));
static_cast<nsRadioGroupStruct *>(mRadioGroups.Get(&key));
if (!radioGroup) {
radioGroup = new nsRadioGroupStruct();
@ -5045,8 +5045,7 @@ nsDocument::GetNextRadioButton(const nsAString& aName,
else if (++index >= numRadios) {
index = 0;
}
radio = do_QueryInterface(NS_STATIC_CAST(nsIFormControl*,
radioGroup->mRadioButtons.ElementAt(index)));
radio = do_QueryInterface(static_cast<nsIFormControl*>(radioGroup->mRadioButtons.ElementAt(index)));
NS_ASSERTION(radio, "mRadioButtons holding a non-radio button");
radio->GetDisabled(&disabled);
} while (disabled && radio != currentRadio);
@ -5097,8 +5096,8 @@ nsDocument::WalkRadioGroup(const nsAString& aName,
PRBool stop = PR_FALSE;
for (int i = 0; i < radioGroup->mRadioButtons.Count(); i++) {
aVisitor->Visit(NS_STATIC_CAST(nsIFormControl *,
radioGroup->mRadioButtons.ElementAt(i)),
aVisitor->Visit(static_cast<nsIFormControl *>
(radioGroup->mRadioButtons.ElementAt(i)),
&stop);
if (stop) {
return NS_OK;
@ -5245,8 +5244,8 @@ PRBool
nsDocument::IsSafeToFlush() const
{
PRBool isSafeToFlush = PR_TRUE;
nsPresShellIterator iter(NS_CONST_CAST(nsIDocument*,
NS_STATIC_CAST(const nsIDocument*, this)));
nsPresShellIterator iter(const_cast<nsIDocument*>
(static_cast<const nsIDocument*>(this)));
nsCOMPtr<nsIPresShell> shell;
while ((shell = iter.GetNextShell()) && isSafeToFlush) {
shell->IsSafeToFlush(isSafeToFlush);
@ -5338,8 +5337,8 @@ PR_STATIC_CALLBACK(PLDHashOperator)
SubDocHashEnum(PLDHashTable *table, PLDHashEntryHdr *hdr,
PRUint32 number, void *arg)
{
SubDocMapEntry *entry = NS_STATIC_CAST(SubDocMapEntry*, hdr);
SubDocEnumArgs *args = NS_STATIC_CAST(SubDocEnumArgs*, arg);
SubDocMapEntry *entry = static_cast<SubDocMapEntry*>(hdr);
SubDocEnumArgs *args = static_cast<SubDocEnumArgs*>(arg);
nsIDocument *subdoc = entry->mSubDocument;
PRBool next = subdoc ? args->callback(subdoc, args->data) : PR_TRUE;
@ -5360,8 +5359,8 @@ PR_STATIC_CALLBACK(PLDHashOperator)
CanCacheSubDocument(PLDHashTable *table, PLDHashEntryHdr *hdr,
PRUint32 number, void *arg)
{
SubDocMapEntry *entry = NS_STATIC_CAST(SubDocMapEntry*, hdr);
PRBool *canCacheArg = NS_STATIC_CAST(PRBool*, arg);
SubDocMapEntry *entry = static_cast<SubDocMapEntry*>(hdr);
PRBool *canCacheArg = static_cast<PRBool*>(arg);
nsIDocument *subdoc = entry->mSubDocument;
@ -5565,7 +5564,7 @@ nsDocument::CheckAncestryAndGetFrame(nsIDocument* aDocument) const
{
nsIDocument* parentDoc;
for (parentDoc = aDocument->GetParentDocument();
parentDoc != NS_STATIC_CAST(const nsIDocument* const, this);
parentDoc != static_cast<const nsIDocument* const>(this);
parentDoc = parentDoc->GetParentDocument()) {
if (!parentDoc) {
return nsnull;
@ -5603,7 +5602,7 @@ nsDocument::DispatchEventToWindow(nsEvent *aEvent)
if (!window)
return;
aEvent->target = NS_STATIC_CAST(nsIDocument*, this);
aEvent->target = static_cast<nsIDocument*>(this);
nsEventDispatcher::Dispatch(window, nsnull, aEvent);
}

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

@ -153,7 +153,7 @@ class nsUint32ToContentHashEntry : public PLDHashEntryHdr
// Pathetic attempt to not die: clear out the other mValOrHash so we're
// effectively stealing it. If toCopy is destroyed right after this,
// we'll be OK.
NS_CONST_CAST(nsUint32ToContentHashEntry&, toCopy).mValOrHash = nsnull;
const_cast<nsUint32ToContentHashEntry&>(toCopy).mValOrHash = nsnull;
NS_ERROR("Copying not supported. Fasten your seat belt.");
}
~nsUint32ToContentHashEntry() { Destroy(); }

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

@ -649,11 +649,11 @@ nsDocumentEncoder::SerializeRangeNodes(nsIDOMRange* aRange,
nsCOMPtr<nsIContent> startNode, endNode;
PRInt32 start = mStartRootIndex - aDepth;
if (start >= 0 && start <= mStartNodes.Count())
startNode = NS_STATIC_CAST(nsIContent *, mStartNodes[start]);
startNode = static_cast<nsIContent *>(mStartNodes[start]);
PRInt32 end = mEndRootIndex - aDepth;
if (end >= 0 && end <= mEndNodes.Count())
endNode = NS_STATIC_CAST(nsIContent *, mEndNodes[end]);
endNode = static_cast<nsIContent *>(mEndNodes[end]);
if ((startNode != content) && (endNode != content))
{
@ -1236,7 +1236,7 @@ nsHTMLCopyEncoder::EncodeToStringWithContext(nsAString& aContextString,
PRInt32 i;
nsCOMPtr<nsIDOMNode> node;
if (count > 0)
node = NS_STATIC_CAST(nsIDOMNode *, mCommonAncestors.ElementAt(0));
node = static_cast<nsIDOMNode *>(mCommonAncestors.ElementAt(0));
if (node && IsTextNode(node))
{
@ -1251,13 +1251,13 @@ nsHTMLCopyEncoder::EncodeToStringWithContext(nsAString& aContextString,
i = count;
while (i > 0)
{
node = NS_STATIC_CAST(nsIDOMNode *, mCommonAncestors.ElementAt(--i));
node = static_cast<nsIDOMNode *>(mCommonAncestors.ElementAt(--i));
SerializeNodeStart(node, 0, -1, aContextString);
}
//i = 0; guaranteed by above
while (i < count)
{
node = NS_STATIC_CAST(nsIDOMNode *, mCommonAncestors.ElementAt(i++));
node = static_cast<nsIDOMNode *>(mCommonAncestors.ElementAt(i++));
SerializeNodeEnd(node, aContextString);
}

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

@ -236,7 +236,7 @@ nsGenericDOMDataNode::IsSupported(const nsAString& aFeature,
const nsAString& aVersion,
PRBool* aReturn)
{
return nsGenericElement::InternalIsSupported(NS_STATIC_CAST(nsIContent*, this),
return nsGenericElement::InternalIsSupported(static_cast<nsIContent*>(this),
aFeature, aVersion, aReturn);
}
@ -580,10 +580,10 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
// Set parent
if (aParent) {
mParentPtrBits =
NS_REINTERPRET_CAST(PtrBits, aParent) | PARENT_BIT_PARENT_IS_CONTENT;
reinterpret_cast<PtrBits>(aParent) | PARENT_BIT_PARENT_IS_CONTENT;
}
else {
mParentPtrBits = NS_REINTERPRET_CAST(PtrBits, aDocument);
mParentPtrBits = reinterpret_cast<PtrBits>(aDocument);
}
// XXXbz sXBL/XBL2 issue!
@ -702,7 +702,7 @@ nsGenericDOMDataNode::DispatchDOMEvent(nsEvent* aEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus)
{
return nsEventDispatcher::DispatchDOMEvent(NS_STATIC_CAST(nsINode*, this),
return nsEventDispatcher::DispatchDOMEvent(static_cast<nsINode*>(this),
aEvent, aDOMEvent,
aPresContext, aEventStatus);
}

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

@ -298,12 +298,12 @@ protected:
nsDataSlots *GetDataSlots()
{
return NS_STATIC_CAST(nsDataSlots*, GetSlots());
return static_cast<nsDataSlots*>(GetSlots());
}
nsDataSlots *GetExistingDataSlots() const
{
return NS_STATIC_CAST(nsDataSlots*, GetExistingSlots());
return static_cast<nsDataSlots*>(GetExistingSlots());
}
nsresult SplitText(PRUint32 aOffset, nsIDOMText** aReturn);

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

@ -1091,7 +1091,7 @@ nsGenericElement::~nsGenericElement()
NS_PRECONDITION(!IsInDoc(),
"Please remove this from the document properly");
#ifdef DEBUG
nsCycleCollector_DEBUG_wasFreed(NS_STATIC_CAST(nsINode*, this));
nsCycleCollector_DEBUG_wasFreed(static_cast<nsINode*>(this));
#endif
}
@ -1959,14 +1959,14 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
// Now set the parent and set the "Force attach xbl" flag if needed.
if (aParent) {
mParentPtrBits = NS_REINTERPRET_CAST(PtrBits, aParent) | PARENT_BIT_PARENT_IS_CONTENT;
mParentPtrBits = reinterpret_cast<PtrBits>(aParent) | PARENT_BIT_PARENT_IS_CONTENT;
if (aParent->HasFlag(NODE_FORCE_XBL_BINDINGS)) {
SetFlags(NODE_FORCE_XBL_BINDINGS);
}
}
else {
mParentPtrBits = NS_REINTERPRET_CAST(PtrBits, aDocument);
mParentPtrBits = reinterpret_cast<PtrBits>(aDocument);
}
// XXXbz sXBL/XBL2 issue!
@ -2109,7 +2109,7 @@ nsGenericElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
nsNodeUtils::ParentChainChanged(this);
#ifdef DEBUG
nsCycleCollector_DEBUG_shouldBeFreed(NS_STATIC_CAST(nsINode*, this));
nsCycleCollector_DEBUG_shouldBeFreed(static_cast<nsINode*>(this));
#endif
}
@ -2150,8 +2150,8 @@ nsGenericElement::doPreHandleEvent(nsIContent* aContent,
if (aVisitor.mEvent->message == NS_MOUSE_ENTER_SYNTH ||
aVisitor.mEvent->message == NS_MOUSE_EXIT_SYNTH) {
nsCOMPtr<nsIContent> relatedTarget =
do_QueryInterface(NS_STATIC_CAST(nsMouseEvent*,
aVisitor.mEvent)->relatedTarget);
do_QueryInterface(static_cast<nsMouseEvent*>
(aVisitor.mEvent)->relatedTarget);
if (relatedTarget &&
relatedTarget->GetOwnerDoc() == aContent->GetOwnerDoc()) {
@ -2231,7 +2231,7 @@ nsGenericElement::DispatchDOMEvent(nsEvent* aEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus)
{
return nsEventDispatcher::DispatchDOMEvent(NS_STATIC_CAST(nsIContent*, this),
return nsEventDispatcher::DispatchDOMEvent(static_cast<nsIContent*>(this),
aEvent, aDOMEvent,
aPresContext, aEventStatus);
}
@ -2256,7 +2256,7 @@ nsGenericElement::GetID() const
nsAutoString idVal(attrVal->GetStringValue());
// Create an atom from the value and set it into the attribute list.
NS_CONST_CAST(nsAttrValue*, attrVal)->ParseAtom(idVal);
const_cast<nsAttrValue*>(attrVal)->ParseAtom(idVal);
return attrVal->GetAtomValue();
}
}
@ -2699,7 +2699,7 @@ nsGenericElement::doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
// was processing.
if (guard.Mutated(0)) {
aIndex = container->IndexOf(aKid);
if (NS_STATIC_CAST(PRInt32, aIndex) < 0) {
if (static_cast<PRInt32>(aIndex) < 0) {
return NS_OK;
}
}
@ -2760,7 +2760,7 @@ nsGenericElement::DispatchClickEvent(nsPresContext* aPresContext,
event.refPoint = aSourceEvent->refPoint;
PRUint32 clickCount = 1;
if (aSourceEvent->eventStructType == NS_MOUSE_EVENT) {
clickCount = NS_STATIC_CAST(nsMouseEvent*, aSourceEvent)->clickCount;
clickCount = static_cast<nsMouseEvent*>(aSourceEvent)->clickCount;
}
event.clickCount = clickCount;
event.isShift = aSourceEvent->isShift;
@ -3325,11 +3325,11 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericElement)
if (tmp->HasProperties() && tmp->IsNodeOfType(nsINode::eXUL)) {
nsISupports* property =
NS_STATIC_CAST(nsISupports*,
tmp->GetProperty(nsGkAtoms::contextmenulistener));
static_cast<nsISupports*>
(tmp->GetProperty(nsGkAtoms::contextmenulistener));
cb.NoteXPCOMChild(property);
property = NS_STATIC_CAST(nsISupports*,
tmp->GetProperty(nsGkAtoms::popuplistener));
property = static_cast<nsISupports*>
(tmp->GetProperty(nsGkAtoms::popuplistener));
cb.NoteXPCOMChild(property);
}
@ -3576,8 +3576,8 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
{
nsresult rv;
PRUint8 modType = aModification ?
NS_STATIC_CAST(PRUint8, nsIDOMMutationEvent::MODIFICATION) :
NS_STATIC_CAST(PRUint8, nsIDOMMutationEvent::ADDITION);
static_cast<PRUint8>(nsIDOMMutationEvent::MODIFICATION) :
static_cast<PRUint8>(nsIDOMMutationEvent::ADDITION);
nsIDocument* document = GetCurrentDoc();
mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
@ -3683,7 +3683,7 @@ nsGenericElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aMana
{
nsresult rv = GetListenerManager(PR_TRUE, aManager);
if (NS_SUCCEEDED(rv)) {
NS_ADDREF(*aTarget = NS_STATIC_CAST(nsIContent*, this));
NS_ADDREF(*aTarget = static_cast<nsIContent*>(this));
}
*aDefer = PR_TRUE;
return rv;
@ -3850,7 +3850,7 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
if (hasMutationListeners) {
nsCOMPtr<nsIDOMEventTarget> node =
do_QueryInterface(NS_STATIC_CAST(nsIContent *, this));
do_QueryInterface(static_cast<nsIContent *>(this));
nsMutationEvent mutation(PR_TRUE, NS_MUTATION_ATTRMODIFIED);
mutation.mRelatedNode = attrNode;
@ -3990,7 +3990,7 @@ nsGenericElement::List(FILE* out, PRInt32 aIndent,
fputs(">\n", out);
nsGenericElement* nonConstThis = NS_CONST_CAST(nsGenericElement*, this);
nsGenericElement* nonConstThis = const_cast<nsGenericElement*>(this);
// XXX sXBL/XBL2 issue! Owner or current document?
nsIDocument *document = GetOwnerDoc();
@ -4198,7 +4198,7 @@ nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
case NS_MOUSE_BUTTON_DOWN:
{
if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
NS_STATIC_CAST(nsMouseEvent*, aVisitor.mEvent)->button ==
static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
nsMouseEvent::eLeftButton) {
// don't make the link grab the focus if there is no link handler
nsILinkHandler *handler = aVisitor.mPresContext->GetLinkHandler();
@ -4232,7 +4232,7 @@ nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
case NS_MOUSE_CLICK:
if (NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent)) {
nsInputEvent* inputEvent = NS_STATIC_CAST(nsInputEvent*, aVisitor.mEvent);
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(aVisitor.mEvent);
if (inputEvent->isControl || inputEvent->isMeta ||
inputEvent->isAlt ||inputEvent->isShift) {
break;
@ -4262,7 +4262,7 @@ nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
case NS_KEY_PRESS:
{
if (aVisitor.mEvent->eventStructType == NS_KEY_EVENT) {
nsKeyEvent* keyEvent = NS_STATIC_CAST(nsKeyEvent*, aVisitor.mEvent);
nsKeyEvent* keyEvent = static_cast<nsKeyEvent*>(aVisitor.mEvent);
if (keyEvent->keyCode == NS_VK_RETURN) {
nsEventStatus status = nsEventStatus_eIgnore;
rv = DispatchClickEvent(aVisitor.mPresContext, keyEvent, this,

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

@ -309,7 +309,7 @@ public:
*/
PRBool Mutated(PRUint8 aIgnoreCount)
{
return sMutationCount < NS_STATIC_CAST(PRUint32, eMaxMutations - aIgnoreCount);
return sMutationCount < static_cast<PRUint32>(eMaxMutations - aIgnoreCount);
}
// This function should be called whenever a mutation that we want to keep
@ -960,12 +960,12 @@ protected:
nsDOMSlots *GetDOMSlots()
{
return NS_STATIC_CAST(nsDOMSlots*, GetSlots());
return static_cast<nsDOMSlots*>(GetSlots());
}
nsDOMSlots *GetExistingDOMSlots() const
{
return NS_STATIC_CAST(nsDOMSlots*, GetExistingSlots());
return static_cast<nsDOMSlots*>(GetExistingSlots());
}
/**

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

@ -99,7 +99,7 @@ void* nsMappedAttributes::operator new(size_t aSize, PRUint32 aAttrCount) CPP_TH
#ifdef DEBUG
if (newAttrs) {
NS_STATIC_CAST(nsMappedAttributes*, newAttrs)->mBufferSize = aAttrCount;
static_cast<nsMappedAttributes*>(newAttrs)->mBufferSize = aAttrCount;
}
#endif

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

@ -127,11 +127,11 @@ private:
*/
const InternalAttr* Attrs() const
{
return NS_REINTERPRET_CAST(const InternalAttr*, &(mAttrs[0]));
return reinterpret_cast<const InternalAttr*>(&(mAttrs[0]));
}
InternalAttr* Attrs()
{
return NS_REINTERPRET_CAST(InternalAttr*, &(mAttrs[0]));
return reinterpret_cast<InternalAttr*>(&(mAttrs[0]));
}
PRUint16 mAttrCount;

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

@ -60,7 +60,7 @@ nsNodeInfoManager::GetNodeInfoInnerHashValue(const void *key)
NS_ASSERTION(key, "Null key passed to nsNodeInfo::GetHashValue!");
const nsINodeInfo::nsNodeInfoInner *node =
NS_REINTERPRET_CAST(const nsINodeInfo::nsNodeInfoInner *, key);
reinterpret_cast<const nsINodeInfo::nsNodeInfoInner *>(key);
// Is this an acceptable hash value?
return (PLHashNumber(NS_PTR_TO_INT32(node->mName)) & 0xffff) >> 8;
@ -73,9 +73,9 @@ nsNodeInfoManager::NodeInfoInnerKeyCompare(const void *key1, const void *key2)
NS_ASSERTION(key1 && key2, "Null key passed to NodeInfoInnerKeyCompare!");
const nsINodeInfo::nsNodeInfoInner *node1 =
NS_REINTERPRET_CAST(const nsINodeInfo::nsNodeInfoInner *, key1);
reinterpret_cast<const nsINodeInfo::nsNodeInfoInner *>(key1);
const nsINodeInfo::nsNodeInfoInner *node2 =
NS_REINTERPRET_CAST(const nsINodeInfo::nsNodeInfoInner *, key2);
reinterpret_cast<const nsINodeInfo::nsNodeInfoInner *>(key2);
return (node1->mName == node2->mName &&
node1->mPrefix == node2->mPrefix &&
@ -187,7 +187,7 @@ nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);
if (node) {
*aNodeInfo = NS_STATIC_CAST(nsINodeInfo *, node);
*aNodeInfo = static_cast<nsINodeInfo *>(node);
NS_ADDREF(*aNodeInfo);

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

@ -121,12 +121,12 @@ nsNodeUtils::ContentInserted(nsINode* aContainer,
nsIContent* container;
nsIDocument* document;
if (aContainer->IsNodeOfType(nsINode::eCONTENT)) {
container = NS_STATIC_CAST(nsIContent*, aContainer);
container = static_cast<nsIContent*>(aContainer);
document = aContainer->GetOwnerDoc();
}
else {
container = nsnull;
document = NS_STATIC_CAST(nsIDocument*, aContainer);
document = static_cast<nsIDocument*>(aContainer);
}
IMPL_MUTATION_NOTIFICATION(ContentInserted, aContainer,
@ -144,12 +144,12 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer,
nsIContent* container;
nsIDocument* document;
if (aContainer->IsNodeOfType(nsINode::eCONTENT)) {
container = NS_STATIC_CAST(nsIContent*, aContainer);
container = static_cast<nsIContent*>(aContainer);
document = aContainer->GetOwnerDoc();
}
else {
container = nsnull;
document = NS_STATIC_CAST(nsIDocument*, aContainer);
document = static_cast<nsIDocument*>(aContainer);
}
IMPL_MUTATION_NOTIFICATION(ContentRemoved, aContainer,
@ -195,7 +195,7 @@ nsNodeUtils::LastRelease(nsINode* aNode)
// Delete all properties before tearing down the document. Some of the
// properties are bound to nsINode objects and the destructor functions of
// the properties may want to use the owner document of the nsINode.
NS_STATIC_CAST(nsIDocument*, aNode)->PropertyTable()->DeleteAllProperties();
static_cast<nsIDocument*>(aNode)->PropertyTable()->DeleteAllProperties();
}
else if (aNode->HasProperties()) {
// Strong reference to the document so that deleting properties can't
@ -266,7 +266,7 @@ nsNodeUtils::SetUserData(nsINode *aNode, const nsAString &aKey,
}
// Take over ownership of the old data from the property table.
nsCOMPtr<nsIVariant> oldData = dont_AddRef(NS_STATIC_CAST(nsIVariant*, data));
nsCOMPtr<nsIVariant> oldData = dont_AddRef(static_cast<nsIVariant*>(data));
if (aData && aHandler) {
nsCOMPtr<nsIDOMUserDataHandler> oldHandler;
@ -298,8 +298,8 @@ nsNodeUtils::GetUserData(nsINode *aNode, const nsAString &aKey,
return NS_ERROR_OUT_OF_MEMORY;
}
*aResult = NS_STATIC_CAST(nsIVariant*,
aNode->GetProperty(DOM_USER_DATA, key));
*aResult = static_cast<nsIVariant*>
(aNode->GetProperty(DOM_USER_DATA, key));
NS_IF_ADDREF(*aResult);
return NS_OK;
@ -314,12 +314,12 @@ struct nsHandlerData
static void
CallHandler(void *aObject, nsIAtom *aKey, void *aHandler, void *aData)
{
nsHandlerData *handlerData = NS_STATIC_CAST(nsHandlerData*, aData);
nsHandlerData *handlerData = static_cast<nsHandlerData*>(aData);
nsCOMPtr<nsIDOMUserDataHandler> handler =
NS_STATIC_CAST(nsIDOMUserDataHandler*, aHandler);
nsINode *node = NS_STATIC_CAST(nsINode*, aObject);
static_cast<nsIDOMUserDataHandler*>(aHandler);
nsINode *node = static_cast<nsINode*>(aObject);
nsCOMPtr<nsIVariant> data =
NS_STATIC_CAST(nsIVariant*, node->GetProperty(DOM_USER_DATA, aKey));
static_cast<nsIVariant*>(node->GetProperty(DOM_USER_DATA, aKey));
NS_ASSERTION(data, "Handler without data?");
nsAutoString key;
@ -371,8 +371,8 @@ static void
NoteUserData(void *aObject, nsIAtom *aKey, void *aXPCOMChild, void *aData)
{
nsCycleCollectionTraversalCallback* cb =
NS_STATIC_CAST(nsCycleCollectionTraversalCallback*, aData);
cb->NoteXPCOMChild(NS_STATIC_CAST(nsISupports*, aXPCOMChild));
static_cast<nsCycleCollectionTraversalCallback*>(aData);
cb->NoteXPCOMChild(static_cast<nsISupports*>(aXPCOMChild));
}
/* static */
@ -443,7 +443,7 @@ AdoptFunc(nsAttrHashKey::KeyType aKey, nsIDOMNode *aData, void* aUserArg)
nsCOMPtr<nsIAttribute> attr = do_QueryInterface(aData);
NS_ASSERTION(attr, "non-nsIAttribute somehow made it into the hashmap?!");
AdoptFuncData *data = NS_STATIC_CAST(AdoptFuncData*, aUserArg);
AdoptFuncData *data = static_cast<AdoptFuncData*>(aUserArg);
// If we were passed an element we need to clone the attribute nodes and
// insert them into the element.
@ -505,7 +505,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
}
nsGenericElement *elem = aNode->IsNodeOfType(nsINode::eELEMENT) ?
NS_STATIC_CAST(nsGenericElement*, aNode) :
static_cast<nsGenericElement*>(aNode) :
nsnull;
nsCOMPtr<nsINode> clone;
@ -642,7 +642,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
// in a document.
#ifdef MOZ_XUL
if (aClone && !aParent && aNode->IsNodeOfType(nsINode::eXUL)) {
nsXULElement *xulElem = NS_STATIC_CAST(nsXULElement*, elem);
nsXULElement *xulElem = static_cast<nsXULElement*>(elem);
if (!xulElem->mPrototype || xulElem->IsInDoc()) {
clone->SetFlags(NODE_FORCE_XBL_BINDINGS);
}

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

@ -105,12 +105,12 @@ public:
nsIURI* aURI)
: mContent(aContent), mFrame(aFrame), mContentType(aType), mURI(aURI)
{
NS_STATIC_CAST(nsIObjectLoadingContent *, mContent)->AddRef();
static_cast<nsIObjectLoadingContent *>(mContent)->AddRef();
}
~nsAsyncInstantiateEvent()
{
NS_STATIC_CAST(nsIObjectLoadingContent *, mContent)->Release();
static_cast<nsIObjectLoadingContent *>(mContent)->Release();
}
NS_IMETHOD Run();
@ -339,7 +339,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, nsISupports *aConte
}
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(NS_STATIC_CAST(nsIImageLoadingContent*, this));
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
switch (newType) {
case eType_Image:
@ -543,7 +543,7 @@ nsObjectLoadingContent::EnsureInstantiation(nsIPluginInstance** aInstance)
mInstantiating = PR_TRUE;
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(NS_STATIC_CAST(nsIImageLoadingContent*, this));
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
nsIDocument* doc = thisContent->GetCurrentDoc();
@ -703,7 +703,7 @@ nsObjectLoadingContent::LoadObject(const nsAString& aURI,
// Avoid StringToURI in order to use the codebase attribute as base URI
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(NS_STATIC_CAST(nsIImageLoadingContent*, this));
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
nsIDocument* doc = thisContent->GetOwnerDoc();
@ -765,7 +765,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
mContentType = aTypeHint;
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(NS_STATIC_CAST(nsIImageLoadingContent*, this));
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
nsIDocument* doc = thisContent->GetOwnerDoc();
@ -812,7 +812,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_OBJECT,
aURI,
doc->GetDocumentURI(),
NS_STATIC_CAST(nsIImageLoadingContent*, this),
static_cast<nsIImageLoadingContent*>(this),
aTypeHint,
nsnull, //extra
&shouldLoad,
@ -1095,7 +1095,7 @@ PRBool
nsObjectLoadingContent::IsSupportedDocument(const nsCString& aMimeType)
{
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(NS_STATIC_CAST(nsIImageLoadingContent*, this));
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
nsresult rv;
@ -1156,7 +1156,7 @@ nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
this, aOldType, aOldState, mType, ObjectState(), aSync));
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(NS_STATIC_CAST(nsIImageLoadingContent*, this));
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
nsIDocument* doc = thisContent->GetCurrentDoc();
@ -1230,7 +1230,7 @@ nsObjectLoadingContent::GetTypeOfContent(const nsCString& aMIMEType)
}
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(NS_STATIC_CAST(nsIImageLoadingContent*, this));
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
if (ShouldShowDefaultPlugin(thisContent, aMIMEType)) {
@ -1299,7 +1299,7 @@ nsIObjectFrame*
nsObjectLoadingContent::GetFrame()
{
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(NS_STATIC_CAST(nsIImageLoadingContent*, this));
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
PRBool flushed = PR_FALSE;
@ -1375,7 +1375,7 @@ nsObjectLoadingContent::Instantiate(const nsACString& aMIMEType, nsIURI* aURI)
// We need some URI. If we have nothing else, use the base URI.
// XXX(biesi): The code used to do this. Not sure why this is correct...
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(NS_STATIC_CAST(nsIImageLoadingContent*, this));
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
NS_ASSERTION(thisContent, "must be a content");
GetObjectBaseURI(thisContent, getter_AddRefs(baseURI));

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

@ -237,7 +237,7 @@ nsPlainTextSerializer::GetLastBool(const nsVoidArray& aStack)
if (size == 0) {
return PR_FALSE;
}
return (aStack.ElementAt(size-1) != NS_REINTERPRET_CAST(void*, PR_FALSE));
return (aStack.ElementAt(size-1) != reinterpret_cast<void*>(PR_FALSE));
}
void
@ -245,7 +245,7 @@ nsPlainTextSerializer::SetLastBool(nsVoidArray& aStack, PRBool aValue)
{
PRUint32 size = aStack.Count();
if (size > 0) {
aStack.ReplaceElementAt(NS_REINTERPRET_CAST(void*, aValue), size-1);
aStack.ReplaceElementAt(reinterpret_cast<void*>(aValue), size-1);
}
else {
NS_ERROR("There is no \"Last\" value");
@ -255,7 +255,7 @@ nsPlainTextSerializer::SetLastBool(nsVoidArray& aStack, PRBool aValue)
void
nsPlainTextSerializer::PushBool(nsVoidArray& aStack, PRBool aValue)
{
aStack.AppendElement(NS_REINTERPRET_CAST(void*, aValue));
aStack.AppendElement(reinterpret_cast<void*>(aValue));
}
PRBool
@ -264,7 +264,7 @@ nsPlainTextSerializer::PopBool(nsVoidArray& aStack)
PRBool returnValue = PR_FALSE;
PRUint32 size = aStack.Count();
if (size > 0) {
returnValue = (aStack.ElementAt(size-1) != NS_REINTERPRET_CAST(void*, PR_FALSE));
returnValue = (aStack.ElementAt(size-1) != reinterpret_cast<void*>(PR_FALSE));
aStack.RemoveElementAt(size-1);
}
return returnValue;

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

@ -133,8 +133,8 @@ nsPropertyTable::TransferOrDeleteAllPropertiesFor(nsPropertyOwner aObject,
nsresult rv = NS_OK;
for (PropertyList* prop = mPropertyList; prop; prop = prop->mNext) {
if (prop->mTransfer) {
PropertyListMapEntry *entry = NS_STATIC_CAST(PropertyListMapEntry*,
PL_DHashTableOperate(&prop->mObjectValueMap, aObject,
PropertyListMapEntry *entry = static_cast<PropertyListMapEntry*>
(PL_DHashTableOperate(&prop->mObjectValueMap, aObject,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
rv = aOtherTable->SetProperty(aObject, prop->mCategory, prop->mName,
@ -165,11 +165,11 @@ nsPropertyTable::Enumerate(nsPropertyOwner aObject, PRUint16 aCategory,
PropertyList* prop;
for (prop = mPropertyList; prop; prop = prop->mNext) {
if (prop->mCategory == aCategory) {
PropertyListMapEntry *entry = NS_STATIC_CAST(PropertyListMapEntry*,
PL_DHashTableOperate(&prop->mObjectValueMap, aObject,
PropertyListMapEntry *entry = static_cast<PropertyListMapEntry*>
(PL_DHashTableOperate(&prop->mObjectValueMap, aObject,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
aCallback(NS_CONST_CAST(void*, aObject.get()), prop->mName, entry->value,
aCallback(const_cast<void*>(aObject.get()), prop->mName, entry->value,
aData);
}
}
@ -189,8 +189,8 @@ nsPropertyTable::GetPropertyInternal(nsPropertyOwner aObject,
PropertyList* propertyList = GetPropertyListFor(aCategory, aPropertyName);
if (propertyList) {
PropertyListMapEntry *entry = NS_STATIC_CAST(PropertyListMapEntry*,
PL_DHashTableOperate(&propertyList->mObjectValueMap, aObject,
PropertyListMapEntry *entry = static_cast<PropertyListMapEntry*>
(PL_DHashTableOperate(&propertyList->mObjectValueMap, aObject,
PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
propValue = entry->value;
@ -246,8 +246,8 @@ nsPropertyTable::SetPropertyInternal(nsPropertyOwner aObject,
// The current property value (if there is one) is replaced and the current
// value is destroyed
nsresult result = NS_OK;
PropertyListMapEntry *entry = NS_STATIC_CAST(PropertyListMapEntry*,
PL_DHashTableOperate(&propertyList->mObjectValueMap, aObject, PL_DHASH_ADD));
PropertyListMapEntry *entry = static_cast<PropertyListMapEntry*>
(PL_DHashTableOperate(&propertyList->mObjectValueMap, aObject, PL_DHASH_ADD));
if (!entry)
return NS_ERROR_OUT_OF_MEMORY;
// A NULL entry->key is the sign that the entry has just been allocated
@ -256,7 +256,7 @@ nsPropertyTable::SetPropertyInternal(nsPropertyOwner aObject,
if (aOldValue)
*aOldValue = entry->value;
else if (propertyList->mDtorFunc)
propertyList->mDtorFunc(NS_CONST_CAST(void*, entry->key), aPropertyName,
propertyList->mDtorFunc(const_cast<void*>(entry->key), aPropertyName,
entry->value, propertyList->mDtorData);
result = NS_PROPTABLE_PROP_OVERWRITTEN;
}
@ -329,10 +329,10 @@ DestroyPropertyEnumerator(PLDHashTable *table, PLDHashEntryHdr *hdr,
PRUint32 number, void *arg)
{
nsPropertyTable::PropertyList *propList =
NS_STATIC_CAST(nsPropertyTable::PropertyList*, table->data);
PropertyListMapEntry* entry = NS_STATIC_CAST(PropertyListMapEntry*, hdr);
static_cast<nsPropertyTable::PropertyList*>(table->data);
PropertyListMapEntry* entry = static_cast<PropertyListMapEntry*>(hdr);
propList->mDtorFunc(NS_CONST_CAST(void*, entry->key), propList->mName,
propList->mDtorFunc(const_cast<void*>(entry->key), propList->mName,
entry->value, propList->mDtorData);
return PL_DHASH_NEXT;
}
@ -349,8 +349,8 @@ nsPropertyTable::PropertyList::Destroy()
PRBool
nsPropertyTable::PropertyList::DeletePropertyFor(nsPropertyOwner aObject)
{
PropertyListMapEntry *entry = NS_STATIC_CAST(PropertyListMapEntry*,
PL_DHashTableOperate(&mObjectValueMap, aObject, PL_DHASH_LOOKUP));
PropertyListMapEntry *entry = static_cast<PropertyListMapEntry*>
(PL_DHashTableOperate(&mObjectValueMap, aObject, PL_DHASH_LOOKUP));
if (!PL_DHASH_ENTRY_IS_BUSY(entry))
return PR_FALSE;
@ -358,7 +358,7 @@ nsPropertyTable::PropertyList::DeletePropertyFor(nsPropertyOwner aObject)
PL_DHashTableRawRemove(&mObjectValueMap, entry);
if (mDtorFunc)
mDtorFunc(NS_CONST_CAST(void*, aObject.get()), mName, value, mDtorData);
mDtorFunc(const_cast<void*>(aObject.get()), mName, value, mDtorData);
return PR_TRUE;
}
@ -368,6 +368,6 @@ void
nsPropertyTable::SupportsDtorFunc(void *aObject, nsIAtom *aPropertyName,
void *aPropertyValue, void *aData)
{
nsISupports *propertyValue = NS_STATIC_CAST(nsISupports*, aPropertyValue);
nsISupports *propertyValue = static_cast<nsISupports*>(aPropertyValue);
NS_IF_RELEASE(propertyValue);
}

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

@ -392,7 +392,7 @@ nsRange::ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aResult)
static PRInt32 GetNodeLength(nsINode *aNode)
{
if(aNode->IsNodeOfType(nsINode::eDATA_NODE)) {
return NS_STATIC_CAST(nsIContent*, aNode)->TextLength();
return static_cast<nsIContent*>(aNode)->TextLength();
}
return aNode->GetChildCount();
@ -421,9 +421,9 @@ nsRange::DoSetRange(nsINode* aStartN, PRInt32 aStartOffset,
(aStartN->IsNodeOfType(nsINode::eCONTENT) &&
aEndN->IsNodeOfType(nsINode::eCONTENT) &&
aRoot ==
NS_STATIC_CAST(nsIContent*, aStartN)->GetBindingParent() &&
static_cast<nsIContent*>(aStartN)->GetBindingParent() &&
aRoot ==
NS_STATIC_CAST(nsIContent*, aEndN)->GetBindingParent()) ||
static_cast<nsIContent*>(aEndN)->GetBindingParent()) ||
(!aRoot->GetNodeParent() &&
(aRoot->IsNodeOfType(nsINode::eDOCUMENT) ||
aRoot->IsNodeOfType(nsINode::eATTRIBUTE) ||
@ -556,7 +556,7 @@ nsINode* nsRange::IsValidBoundary(nsINode* aNode)
}
if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
nsIContent* content = NS_STATIC_CAST(nsIContent*, aNode);
nsIContent* content = static_cast<nsIContent*>(aNode);
if (content->Tag() == nsGkAtoms::documentTypeNodeName) {
return nsnull;
}

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

@ -166,7 +166,7 @@ InNonScriptingContainer(nsINode* aNode)
// prefs or per-document container settings for not allowing
// frames or plugins.
if (aNode->IsNodeOfType(nsINode::eHTML)) {
nsIAtom *localName = NS_STATIC_CAST(nsIContent*, aNode)->Tag();
nsIAtom *localName = static_cast<nsIContent*>(aNode)->Tag();
if (localName == nsGkAtoms::iframe ||
localName == nsGkAtoms::noframes ||
localName == nsGkAtoms::noembed) {

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

@ -744,7 +744,7 @@ nsScriptLoader::ConvertToUTF16(nsIChannel* aChannel, const PRUint8* aData,
if (NS_SUCCEEDED(rv)) {
PRInt32 unicodeLength = 0;
rv = unicodeDecoder->GetMaxLength(NS_REINTERPRET_CAST(const char*, aData),
rv = unicodeDecoder->GetMaxLength(reinterpret_cast<const char*>(aData),
aLength, &unicodeLength);
if (NS_SUCCEEDED(rv)) {
if (!EnsureStringLength(aString, unicodeLength))
@ -757,7 +757,7 @@ nsScriptLoader::ConvertToUTF16(nsIChannel* aChannel, const PRUint8* aData,
PRInt32 convertedLength = 0;
PRInt32 bufferLength = unicodeLength;
do {
rv = unicodeDecoder->Convert(NS_REINTERPRET_CAST(const char*, aData),
rv = unicodeDecoder->Convert(reinterpret_cast<const char*>(aData),
(PRInt32 *) &aLength, ustr,
&unicodeLength);
if (NS_FAILED(rv)) {
@ -787,7 +787,7 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
PRUint32 aStringLen,
const PRUint8* aString)
{
nsScriptLoadRequest* request = NS_STATIC_CAST(nsScriptLoadRequest*, aContext);
nsScriptLoadRequest* request = static_cast<nsScriptLoadRequest*>(aContext);
NS_ASSERTION(request, "null request in stream complete handler");
NS_ENSURE_TRUE(request, NS_ERROR_FAILURE);

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

@ -91,7 +91,7 @@ nsStyleLinkElement::SetStyleSheet(nsIStyleSheet* aStyleSheet)
if (cssSheet) {
nsCOMPtr<nsIDOMNode> node;
CallQueryInterface(this,
NS_STATIC_CAST(nsIDOMNode**, getter_AddRefs(node)));
static_cast<nsIDOMNode**>(getter_AddRefs(node)));
if (node) {
cssSheet->SetOwningNode(node);
}

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

@ -227,13 +227,12 @@ nsSyncLoader::LoadDocument(nsIChannel* aChannel,
nsCOMPtr<nsPIDOMEventTarget> target = do_QueryInterface(document);
NS_ENSURE_TRUE(target, NS_ERROR_FAILURE);
nsWeakPtr requestWeak = do_GetWeakReference(NS_STATIC_CAST(nsIDOMLoadListener*, this));
nsWeakPtr requestWeak = do_GetWeakReference(static_cast<nsIDOMLoadListener*>(this));
nsLoadListenerProxy* proxy = new nsLoadListenerProxy(requestWeak);
NS_ENSURE_TRUE(proxy, NS_ERROR_OUT_OF_MEMORY);
// This will addref the proxy
rv = target->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMEventListener*,
proxy),
rv = target->AddEventListenerByIID(static_cast<nsIDOMEventListener*>(proxy),
NS_GET_IID(nsIDOMLoadListener));
NS_ENSURE_SUCCESS(rv, rv);
@ -255,8 +254,7 @@ nsSyncLoader::LoadDocument(nsIChannel* aChannel,
// This will release the proxy. Don't use the errorvalue from this since
// we're more interested in the errorvalue from the loading
target->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMEventListener*,
proxy),
target->RemoveEventListenerByIID(static_cast<nsIDOMEventListener*>(proxy),
NS_GET_IID(nsIDOMLoadListener));
// check that the load succeeded

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

@ -130,8 +130,8 @@ nsTextFragment::operator=(const nsTextFragment& aOther)
m1b = aOther.m1b; // This will work even if aOther is using m2b
}
else {
m2b = NS_STATIC_CAST(PRUnichar*,
nsMemory::Clone(aOther.m2b, aOther.mState.mLength *
m2b = static_cast<PRUnichar*>
(nsMemory::Clone(aOther.m2b, aOther.mState.mLength *
(aOther.mState.mIs2b ? sizeof(PRUnichar) : sizeof(char))));
}
@ -358,7 +358,7 @@ nsTextFragment::Append(const PRUnichar* aBuffer, PRUint32 aLength)
// The new and the old data is all 1-byte
char* buff;
if (mState.mInHeap) {
buff = (char*)nsMemory::Realloc(NS_CONST_CAST(char*, m1b),
buff = (char*)nsMemory::Realloc(const_cast<char*>(m1b),
(mState.mLength + aLength) * sizeof(char));
if (!buff) {
return;

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

@ -182,7 +182,7 @@ public:
PRUnichar CharAt(PRInt32 aIndex) const
{
NS_ASSERTION(PRUint32(aIndex) < mState.mLength, "bad index");
return mState.mIs2b ? m2b[aIndex] : NS_STATIC_CAST(unsigned char, m1b[aIndex]);
return mState.mIs2b ? m2b[aIndex] : static_cast<unsigned char>(m1b[aIndex]);
}
/**

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

@ -585,7 +585,7 @@ nsresult nsTreeWalker::TestNode(nsINode* aNode, PRInt16* _filtered)
nodeType = nsIDOMNode::ELEMENT_NODE;
}
else if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
nsIAtom* tag = NS_STATIC_CAST(nsIContent*, aNode)->Tag();
nsIAtom* tag = static_cast<nsIContent*>(aNode)->Tag();
if (tag == nsGkAtoms::textTagName) {
nodeType = nsIDOMNode::TEXT_NODE;
}

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

@ -652,7 +652,7 @@ nsXMLHttpRequest::ConvertBodyToText(nsAString& aOutBuffer)
return rv;
PRUnichar * outBuffer =
NS_STATIC_CAST(PRUnichar*, nsMemory::Alloc((outBufferLength + 1) *
static_cast<PRUnichar*>(nsMemory::Alloc((outBufferLength + 1) *
sizeof(PRUnichar)));
if (!outBuffer) {
return NS_ERROR_OUT_OF_MEMORY;
@ -1170,8 +1170,8 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url)
JSString* userStr = ::JS_ValueToString(cx, argv[3]);
if (userStr) {
user.Assign(NS_REINTERPRET_CAST(PRUnichar *,
::JS_GetStringChars(userStr)),
user.Assign(reinterpret_cast<PRUnichar *>
(::JS_GetStringChars(userStr)),
::JS_GetStringLength(userStr));
}
@ -1179,8 +1179,8 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url)
JSString* passwdStr = JS_ValueToString(cx, argv[4]);
if (passwdStr) {
password.Assign(NS_REINTERPRET_CAST(PRUnichar *,
::JS_GetStringChars(passwdStr)),
password.Assign(reinterpret_cast<PRUnichar *>
(::JS_GetStringChars(passwdStr)),
::JS_GetStringLength(passwdStr));
}
}
@ -1202,7 +1202,7 @@ nsXMLHttpRequest::StreamReaderFunc(nsIInputStream* in,
PRUint32 count,
PRUint32 *writeCount)
{
nsXMLHttpRequest* xmlHttpRequest = NS_STATIC_CAST(nsXMLHttpRequest*, closure);
nsXMLHttpRequest* xmlHttpRequest = static_cast<nsXMLHttpRequest*>(closure);
if (!xmlHttpRequest || !writeCount) {
NS_WARNING("XMLHttpRequest cannot read from stream: no closure or writeCount");
return NS_ERROR_FAILURE;
@ -1300,13 +1300,13 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
nsCOMPtr<nsPIDOMEventTarget> target(do_QueryInterface(mDocument));
if (target) {
nsWeakPtr requestWeak =
do_GetWeakReference(NS_STATIC_CAST(nsIXMLHttpRequest*, this));
do_GetWeakReference(static_cast<nsIXMLHttpRequest*>(this));
nsCOMPtr<nsIDOMEventListener> proxy = new nsLoadListenerProxy(requestWeak);
if (!proxy) return NS_ERROR_OUT_OF_MEMORY;
// This will addref the proxy
rv = target->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMEventListener*,
proxy),
rv = target->AddEventListenerByIID(static_cast<nsIDOMEventListener*>
(proxy),
NS_GET_IID(nsIDOMLoadListener));
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
}
@ -2089,12 +2089,12 @@ nsXMLHttpRequest::GetInterface(const nsIID & aIID, void **aResult)
// need to see these notifications for proper functioning.
if (aIID.Equals(NS_GET_IID(nsIChannelEventSink))) {
mChannelEventSink = do_GetInterface(mNotificationCallbacks);
*aResult = NS_STATIC_CAST(nsIChannelEventSink*, this);
*aResult = static_cast<nsIChannelEventSink*>(this);
NS_ADDREF_THIS();
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIProgressEventSink))) {
mProgressEventSink = do_GetInterface(mNotificationCallbacks);
*aResult = NS_STATIC_CAST(nsIProgressEventSink*, this);
*aResult = static_cast<nsIProgressEventSink*>(this);
NS_ADDREF_THIS();
return NS_OK;
}

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

@ -86,8 +86,8 @@ nsXMLNameSpaceMap::AddPrefix(nsIAtom *aPrefix, PRInt32 aNameSpaceID)
nsNameSpaceEntry *foundEntry = nsnull;
for (PRInt32 i = 0; i < count; ++i) {
nsNameSpaceEntry *entry = NS_STATIC_CAST(nsNameSpaceEntry*,
mNameSpaces.FastElementAt(i));
nsNameSpaceEntry *entry = static_cast<nsNameSpaceEntry*>
(mNameSpaces.FastElementAt(i));
NS_ASSERTION(entry, "null entry in namespace map!");
@ -129,8 +129,8 @@ nsXMLNameSpaceMap::RemovePrefix(nsIAtom *aPrefix)
PRInt32 count = mNameSpaces.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsNameSpaceEntry *entry = NS_STATIC_CAST(nsNameSpaceEntry*,
mNameSpaces.FastElementAt(i));
nsNameSpaceEntry *entry = static_cast<nsNameSpaceEntry*>
(mNameSpaces.FastElementAt(i));
NS_ASSERTION(entry, "null entry in namespace map!");
@ -147,8 +147,8 @@ nsXMLNameSpaceMap::FindNameSpaceID(nsIAtom *aPrefix) const
PRInt32 count = mNameSpaces.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsNameSpaceEntry *entry = NS_STATIC_CAST(nsNameSpaceEntry*,
mNameSpaces.FastElementAt(i));
nsNameSpaceEntry *entry = static_cast<nsNameSpaceEntry*>
(mNameSpaces.FastElementAt(i));
NS_ASSERTION(entry, "null entry in namespace map!");
@ -169,8 +169,8 @@ nsXMLNameSpaceMap::FindPrefix(PRInt32 aNameSpaceID) const
PRInt32 count = mNameSpaces.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsNameSpaceEntry *entry = NS_STATIC_CAST(nsNameSpaceEntry*,
mNameSpaces.FastElementAt(i));
nsNameSpaceEntry *entry = static_cast<nsNameSpaceEntry*>
(mNameSpaces.FastElementAt(i));
NS_ASSERTION(entry, "null entry in namespace map!");
@ -184,7 +184,7 @@ nsXMLNameSpaceMap::FindPrefix(PRInt32 aNameSpaceID) const
PR_STATIC_CALLBACK(PRBool) DeleteEntry(void *aElement, void *aData)
{
delete NS_STATIC_CAST(nsNameSpaceEntry*, aElement);
delete static_cast<nsNameSpaceEntry*>(aElement);
return PR_TRUE;
}

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

@ -62,7 +62,7 @@ NS_IMPL_RELEASE_INHERITED(nsDOMCommandEvent, nsDOMEvent)
NS_IMETHODIMP
nsDOMCommandEvent::GetCommand(nsAString& aCommand)
{
nsIAtom* command = NS_STATIC_CAST(nsCommandEvent*, mEvent)->command;
nsIAtom* command = static_cast<nsCommandEvent*>(mEvent)->command;
if (command) {
command->ToString(aCommand);
} else {
@ -80,7 +80,7 @@ nsDOMCommandEvent::InitCommandEvent(const nsAString& aTypeArg,
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
NS_ENSURE_SUCCESS(rv, rv);
NS_STATIC_CAST(nsCommandEvent*, mEvent)->command = do_GetAtom(aCommand);
static_cast<nsCommandEvent*>(mEvent)->command = do_GetAtom(aCommand);
return NS_OK;
}

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

@ -162,13 +162,13 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent)
switch (tmp->mEvent->eventStructType) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
NS_STATIC_CAST(nsMouseEvent_base*, tmp->mEvent)->relatedTarget = nsnull;
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget = nsnull;
break;
case NS_XUL_COMMAND_EVENT:
NS_STATIC_CAST(nsXULCommandEvent*, tmp->mEvent)->sourceEvent = nsnull;
static_cast<nsXULCommandEvent*>(tmp->mEvent)->sourceEvent = nsnull;
break;
case NS_MUTATION_EVENT:
NS_STATIC_CAST(nsMutationEvent*, tmp->mEvent)->mRelatedNode = nsnull;
static_cast<nsMutationEvent*>(tmp->mEvent)->mRelatedNode = nsnull;
break;
default:
break;
@ -188,15 +188,15 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent)
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
cb.NoteXPCOMChild(
NS_STATIC_CAST(nsMouseEvent_base*, tmp->mEvent)->relatedTarget);
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget);
break;
case NS_XUL_COMMAND_EVENT:
cb.NoteXPCOMChild(
NS_STATIC_CAST(nsXULCommandEvent*, tmp->mEvent)->sourceEvent);
static_cast<nsXULCommandEvent*>(tmp->mEvent)->sourceEvent);
break;
case NS_MUTATION_EVENT:
cb.NoteXPCOMChild(
NS_STATIC_CAST(nsMutationEvent*, tmp->mEvent)->mRelatedNode);
static_cast<nsMutationEvent*>(tmp->mEvent)->mRelatedNode);
break;
default:
break;
@ -631,8 +631,8 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
{
nsSizeEvent* sizeEvent = new nsSizeEvent(PR_FALSE, msg, nsnull);
NS_ENSURE_TRUE(sizeEvent, NS_ERROR_OUT_OF_MEMORY);
sizeEvent->mWinWidth = NS_STATIC_CAST(nsSizeEvent*, mEvent)->mWinWidth;
sizeEvent->mWinHeight = NS_STATIC_CAST(nsSizeEvent*, mEvent)->mWinHeight;
sizeEvent->mWinWidth = static_cast<nsSizeEvent*>(mEvent)->mWinWidth;
sizeEvent->mWinHeight = static_cast<nsSizeEvent*>(mEvent)->mWinHeight;
newEvent = sizeEvent;
break;
}
@ -640,15 +640,15 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
{
newEvent = new nsSizeModeEvent(PR_FALSE, msg, nsnull);
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
NS_STATIC_CAST(nsSizeModeEvent*, newEvent)->mSizeMode =
NS_STATIC_CAST(nsSizeModeEvent*, mEvent)->mSizeMode;
static_cast<nsSizeModeEvent*>(newEvent)->mSizeMode =
static_cast<nsSizeModeEvent*>(mEvent)->mSizeMode;
break;
}
case NS_ZLEVEL_EVENT:
{
nsZLevelEvent* zLevelEvent = new nsZLevelEvent(PR_FALSE, msg, nsnull);
NS_ENSURE_TRUE(zLevelEvent, NS_ERROR_OUT_OF_MEMORY);
nsZLevelEvent* oldZLevelEvent = NS_STATIC_CAST(nsZLevelEvent*, mEvent);
nsZLevelEvent* oldZLevelEvent = static_cast<nsZLevelEvent*>(mEvent);
zLevelEvent->mPlacement = oldZLevelEvent->mPlacement;
zLevelEvent->mImmediate = oldZLevelEvent->mImmediate;
zLevelEvent->mAdjusted = oldZLevelEvent->mAdjusted;
@ -664,8 +664,8 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
{
newEvent = new nsScrollbarEvent(PR_FALSE, msg, nsnull);
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
NS_STATIC_CAST(nsScrollbarEvent*, newEvent)->position =
NS_STATIC_CAST(nsScrollbarEvent*, mEvent)->position;
static_cast<nsScrollbarEvent*>(newEvent)->position =
static_cast<nsScrollbarEvent*>(mEvent)->position;
break;
}
case NS_INPUT_EVENT:
@ -678,7 +678,7 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
{
nsKeyEvent* keyEvent = new nsKeyEvent(PR_FALSE, msg, nsnull);
NS_ENSURE_TRUE(keyEvent, NS_ERROR_OUT_OF_MEMORY);
nsKeyEvent* oldKeyEvent = NS_STATIC_CAST(nsKeyEvent*, mEvent);
nsKeyEvent* oldKeyEvent = static_cast<nsKeyEvent*>(mEvent);
isInputEvent = PR_TRUE;
keyEvent->keyCode = oldKeyEvent->keyCode;
keyEvent->charCode = oldKeyEvent->charCode;
@ -688,7 +688,7 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
}
case NS_MOUSE_EVENT:
{
nsMouseEvent* oldMouseEvent = NS_STATIC_CAST(nsMouseEvent*, mEvent);
nsMouseEvent* oldMouseEvent = static_cast<nsMouseEvent*>(mEvent);
nsMouseEvent* mouseEvent =
new nsMouseEvent(PR_FALSE, msg, nsnull, oldMouseEvent->reason);
NS_ENSURE_TRUE(mouseEvent, NS_ERROR_OUT_OF_MEMORY);
@ -704,16 +704,16 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
{
newEvent = new nsMenuEvent(PR_FALSE, msg, nsnull);
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
NS_STATIC_CAST(nsMenuEvent*, newEvent)->mCommand =
NS_STATIC_CAST(nsMenuEvent*, mEvent)->mCommand;
static_cast<nsMenuEvent*>(newEvent)->mCommand =
static_cast<nsMenuEvent*>(mEvent)->mCommand;
break;
}
case NS_SCRIPT_ERROR_EVENT:
{
newEvent = new nsScriptErrorEvent(PR_FALSE, msg);
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
NS_STATIC_CAST(nsScriptErrorEvent*, newEvent)->lineNr =
NS_STATIC_CAST(nsScriptErrorEvent*, mEvent)->lineNr;
static_cast<nsScriptErrorEvent*>(newEvent)->lineNr =
static_cast<nsScriptErrorEvent*>(mEvent)->lineNr;
break;
}
case NS_TEXT_EVENT:
@ -741,7 +741,7 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
NS_ENSURE_TRUE(mouseScrollEvent, NS_ERROR_OUT_OF_MEMORY);
isInputEvent = PR_TRUE;
nsMouseScrollEvent* oldMouseScrollEvent =
NS_STATIC_CAST(nsMouseScrollEvent*, mEvent);
static_cast<nsMouseScrollEvent*>(mEvent);
mouseScrollEvent->scrollFlags = oldMouseScrollEvent->scrollFlags;
mouseScrollEvent->delta = oldMouseScrollEvent->delta;
mouseScrollEvent->relatedTarget = oldMouseScrollEvent->relatedTarget;
@ -753,8 +753,8 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
{
newEvent = new nsScrollPortEvent(PR_FALSE, msg, nsnull);
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
NS_STATIC_CAST(nsScrollPortEvent*, newEvent)->orient =
NS_STATIC_CAST(nsScrollPortEvent*, mEvent)->orient;
static_cast<nsScrollPortEvent*>(newEvent)->orient =
static_cast<nsScrollPortEvent*>(mEvent)->orient;
break;
}
case NS_MUTATION_EVENT:
@ -762,7 +762,7 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
nsMutationEvent* mutationEvent = new nsMutationEvent(PR_FALSE, msg);
NS_ENSURE_TRUE(mutationEvent, NS_ERROR_OUT_OF_MEMORY);
nsMutationEvent* oldMutationEvent =
NS_STATIC_CAST(nsMutationEvent*, mEvent);
static_cast<nsMutationEvent*>(mEvent);
mutationEvent->mRelatedNode = oldMutationEvent->mRelatedNode;
mutationEvent->mAttrName = oldMutationEvent->mAttrName;
mutationEvent->mPrevAttrValue = oldMutationEvent->mPrevAttrValue;
@ -786,8 +786,8 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
{
newEvent = new nsFocusEvent(PR_FALSE, msg, nsnull);
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
NS_STATIC_CAST(nsFocusEvent*, newEvent)->isMozWindowTakingFocus =
NS_STATIC_CAST(nsFocusEvent*, mEvent)->isMozWindowTakingFocus;
static_cast<nsFocusEvent*>(newEvent)->isMozWindowTakingFocus =
static_cast<nsFocusEvent*>(mEvent)->isMozWindowTakingFocus;
break;
}
case NS_POPUP_EVENT:
@ -801,7 +801,7 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
case NS_COMMAND_EVENT:
{
newEvent = new nsCommandEvent(PR_FALSE, mEvent->userType,
NS_STATIC_CAST(nsCommandEvent*, mEvent)->command, nsnull);
static_cast<nsCommandEvent*>(mEvent)->command, nsnull);
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
break;
}
@ -815,14 +815,14 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
{
newEvent = new nsBeforePageUnloadEvent(PR_FALSE, msg);
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
NS_STATIC_CAST(nsBeforePageUnloadEvent*, newEvent)->text =
NS_STATIC_CAST(nsBeforePageUnloadEvent*, mEvent)->text;
static_cast<nsBeforePageUnloadEvent*>(newEvent)->text =
static_cast<nsBeforePageUnloadEvent*>(mEvent)->text;
break;
}
case NS_UI_EVENT:
{
newEvent = new nsUIEvent(PR_FALSE, msg,
NS_STATIC_CAST(nsUIEvent*, mEvent)->detail);
static_cast<nsUIEvent*>(mEvent)->detail);
break;
}
case NS_QUERYCARETRECT_EVENT:
@ -860,8 +860,8 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
isInputEvent = PR_TRUE;
newEvent->eventStructType = NS_XUL_COMMAND_EVENT;
NS_STATIC_CAST(nsXULCommandEvent*, newEvent)->sourceEvent =
NS_STATIC_CAST(nsXULCommandEvent*, mEvent)->sourceEvent;
static_cast<nsXULCommandEvent*>(newEvent)->sourceEvent =
static_cast<nsXULCommandEvent*>(mEvent)->sourceEvent;
break;
}
default:
@ -874,8 +874,8 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
if (isInputEvent) {
nsInputEvent* oldInputEvent = NS_STATIC_CAST(nsInputEvent*, mEvent);
nsInputEvent* newInputEvent = NS_STATIC_CAST(nsInputEvent*, newEvent);
nsInputEvent* oldInputEvent = static_cast<nsInputEvent*>(mEvent);
nsInputEvent* newInputEvent = static_cast<nsInputEvent*>(newEvent);
newInputEvent->isShift = oldInputEvent->isShift;
newInputEvent->isControl = oldInputEvent->isControl;
newInputEvent->isAlt = oldInputEvent->isAlt;
@ -1055,7 +1055,7 @@ nsDOMEvent::GetEventPopupControlState(nsEvent *aEvent)
break;
case NS_KEY_EVENT :
if (NS_IS_TRUSTED_EVENT(aEvent)) {
PRUint32 key = NS_STATIC_CAST(nsKeyEvent *, aEvent)->keyCode;
PRUint32 key = static_cast<nsKeyEvent *>(aEvent)->keyCode;
switch(aEvent->message) {
case NS_KEY_PRESS :
// return key on focused button. see note at NS_MOUSE_CLICK.
@ -1080,7 +1080,7 @@ nsDOMEvent::GetEventPopupControlState(nsEvent *aEvent)
break;
case NS_MOUSE_EVENT :
if (NS_IS_TRUSTED_EVENT(aEvent) &&
NS_STATIC_CAST(nsMouseEvent*, aEvent)->button == nsMouseEvent::eLeftButton) {
static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) {
switch(aEvent->message) {
case NS_MOUSE_BUTTON_UP :
if (::PopupAllowedForEvent("mouseup"))

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

@ -174,7 +174,7 @@ nsDOMKeyboardEvent::InitKeyEvent(const nsAString& aType, PRBool aCanBubble, PRBo
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
NS_ENSURE_SUCCESS(rv, rv);
nsKeyEvent* keyEvent = NS_STATIC_CAST(nsKeyEvent*, mEvent);
nsKeyEvent* keyEvent = static_cast<nsKeyEvent*>(mEvent);
keyEvent->isControl = aCtrlKey;
keyEvent->isAlt = aAltKey;
keyEvent->isShift = aShiftKey;

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

@ -65,10 +65,10 @@ nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext,
switch (mEvent->eventStructType)
{
case NS_MOUSE_EVENT:
mDetail = NS_STATIC_CAST(nsMouseEvent*, mEvent)->clickCount;
mDetail = static_cast<nsMouseEvent*>(mEvent)->clickCount;
break;
case NS_MOUSE_SCROLL_EVENT:
mDetail = NS_STATIC_CAST(nsMouseScrollEvent*, mEvent)->delta;
mDetail = static_cast<nsMouseScrollEvent*>(mEvent)->delta;
break;
default:
break;
@ -81,10 +81,10 @@ nsDOMMouseEvent::~nsDOMMouseEvent()
switch (mEvent->eventStructType)
{
case NS_MOUSE_EVENT:
delete NS_STATIC_CAST(nsMouseEvent*, mEvent);
delete static_cast<nsMouseEvent*>(mEvent);
break;
case NS_MOUSE_SCROLL_EVENT:
delete NS_STATIC_CAST(nsMouseScrollEvent*, mEvent);
delete static_cast<nsMouseScrollEvent*>(mEvent);
break;
default:
delete mEvent;
@ -117,9 +117,9 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBo
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
{
NS_STATIC_CAST(nsMouseEvent_base*, mEvent)->relatedTarget = aRelatedTarget;
NS_STATIC_CAST(nsMouseEvent_base*, mEvent)->button = aButton;
nsInputEvent* inputEvent = NS_STATIC_CAST(nsInputEvent*, mEvent);
static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget = aRelatedTarget;
static_cast<nsMouseEvent_base*>(mEvent)->button = aButton;
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(mEvent);
inputEvent->isControl = aCtrlKey;
inputEvent->isAlt = aAltKey;
inputEvent->isShift = aShiftKey;
@ -130,10 +130,10 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBo
inputEvent->refPoint.y = aScreenY;
if (mEvent->eventStructType == NS_MOUSE_SCROLL_EVENT) {
nsMouseScrollEvent* scrollEvent = NS_STATIC_CAST(nsMouseScrollEvent*, mEvent);
nsMouseScrollEvent* scrollEvent = static_cast<nsMouseScrollEvent*>(mEvent);
scrollEvent->delta = aDetail;
} else {
nsMouseEvent* mouseEvent = NS_STATIC_CAST(nsMouseEvent*, mEvent);
nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(mEvent);
mouseEvent->clickCount = aDetail;
}
break;
@ -153,7 +153,7 @@ nsDOMMouseEvent::GetButton(PRUint16* aButton)
{
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
*aButton = NS_STATIC_CAST(nsMouseEvent_base*, mEvent)->button;
*aButton = static_cast<nsMouseEvent_base*>(mEvent)->button;
break;
default:
NS_WARNING("Tried to get mouse button for non-mouse event!");
@ -173,7 +173,7 @@ nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
{
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
relatedTarget = NS_STATIC_CAST(nsMouseEvent_base*, mEvent)->relatedTarget;
relatedTarget = static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget;
break;
default:
break;

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

@ -53,7 +53,7 @@ nsDOMMutationEvent::nsDOMMutationEvent(nsPresContext* aPresContext,
nsDOMMutationEvent::~nsDOMMutationEvent()
{
if (mEventIsInternal) {
nsMutationEvent* mutation = NS_STATIC_CAST(nsMutationEvent*, mEvent);
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
delete mutation;
mEvent = nsnull;
}
@ -71,7 +71,7 @@ NS_IMETHODIMP
nsDOMMutationEvent::GetRelatedNode(nsIDOMNode** aRelatedNode)
{
*aRelatedNode = nsnull;
nsMutationEvent* mutation = NS_STATIC_CAST(nsMutationEvent*, mEvent);
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
*aRelatedNode = mutation->mRelatedNode;
NS_IF_ADDREF(*aRelatedNode);
return NS_OK;
@ -80,7 +80,7 @@ nsDOMMutationEvent::GetRelatedNode(nsIDOMNode** aRelatedNode)
NS_IMETHODIMP
nsDOMMutationEvent::GetPrevValue(nsAString& aPrevValue)
{
nsMutationEvent* mutation = NS_STATIC_CAST(nsMutationEvent*, mEvent);
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
if (mutation->mPrevAttrValue)
mutation->mPrevAttrValue->ToString(aPrevValue);
return NS_OK;
@ -89,7 +89,7 @@ nsDOMMutationEvent::GetPrevValue(nsAString& aPrevValue)
NS_IMETHODIMP
nsDOMMutationEvent::GetNewValue(nsAString& aNewValue)
{
nsMutationEvent* mutation = NS_STATIC_CAST(nsMutationEvent*, mEvent);
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
if (mutation->mNewAttrValue)
mutation->mNewAttrValue->ToString(aNewValue);
return NS_OK;
@ -98,7 +98,7 @@ nsDOMMutationEvent::GetNewValue(nsAString& aNewValue)
NS_IMETHODIMP
nsDOMMutationEvent::GetAttrName(nsAString& aAttrName)
{
nsMutationEvent* mutation = NS_STATIC_CAST(nsMutationEvent*, mEvent);
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
if (mutation->mAttrName)
mutation->mAttrName->ToString(aAttrName);
return NS_OK;
@ -108,7 +108,7 @@ NS_IMETHODIMP
nsDOMMutationEvent::GetAttrChange(PRUint16* aAttrChange)
{
*aAttrChange = 0;
nsMutationEvent* mutation = NS_STATIC_CAST(nsMutationEvent*, mEvent);
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
if (mutation->mAttrChange)
*aAttrChange = mutation->mAttrChange;
return NS_OK;
@ -120,7 +120,7 @@ nsDOMMutationEvent::InitMutationEvent(const nsAString& aTypeArg, PRBool aCanBubb
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
NS_ENSURE_SUCCESS(rv, rv);
nsMutationEvent* mutation = NS_STATIC_CAST(nsMutationEvent*, mEvent);
nsMutationEvent* mutation = static_cast<nsMutationEvent*>(mEvent);
mutation->mRelatedNode = aRelatedNodeArg;
if (!aPrevValueArg.IsEmpty())
mutation->mPrevAttrValue = do_GetAtom(aPrevValueArg);

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

@ -65,7 +65,7 @@ NS_IMPL_RELEASE_INHERITED(nsDOMPageTransitionEvent, nsDOMEvent)
NS_IMETHODIMP
nsDOMPageTransitionEvent::GetPersisted(PRBool* aPersisted)
{
*aPersisted = NS_STATIC_CAST(nsPageTransitionEvent*, mEvent)->persisted;
*aPersisted = static_cast<nsPageTransitionEvent*>(mEvent)->persisted;
return NS_OK;
}
@ -78,7 +78,7 @@ nsDOMPageTransitionEvent::InitPageTransitionEvent(const nsAString &aTypeArg,
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
NS_ENSURE_SUCCESS(rv, rv);
NS_STATIC_CAST(nsPageTransitionEvent*, mEvent)->persisted = aPersisted;
static_cast<nsPageTransitionEvent*>(mEvent)->persisted = aPersisted;
return NS_OK;
}

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

@ -61,7 +61,7 @@ nsDOMPopupBlockedEvent::~nsDOMPopupBlockedEvent()
{
if (mEventIsInternal) {
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
nsPopupBlockedEvent* event = NS_STATIC_CAST(nsPopupBlockedEvent*, mEvent);
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
NS_IF_RELEASE(event->mPopupWindowURI);
}
}
@ -90,7 +90,7 @@ nsDOMPopupBlockedEvent::InitPopupBlockedEvent(const nsAString & aTypeArg,
{
case NS_POPUPBLOCKED_EVENT:
{
nsPopupBlockedEvent* event = NS_STATIC_CAST(nsPopupBlockedEvent*, mEvent);
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
event->mRequestingWindow = do_GetWeakReference(aRequestingWindow);
event->mPopupWindowURI = aPopupWindowURI;
NS_IF_ADDREF(event->mPopupWindowURI);
@ -109,7 +109,7 @@ NS_IMETHODIMP
nsDOMPopupBlockedEvent::GetRequestingWindow(nsIDOMWindow **aRequestingWindow)
{
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
nsPopupBlockedEvent* event = NS_STATIC_CAST(nsPopupBlockedEvent*, mEvent);
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
CallQueryReferent(event->mRequestingWindow.get(), aRequestingWindow);
} else {
*aRequestingWindow = 0;
@ -123,7 +123,7 @@ nsDOMPopupBlockedEvent::GetPopupWindowURI(nsIURI **aPopupWindowURI)
{
NS_ENSURE_ARG_POINTER(aPopupWindowURI);
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
nsPopupBlockedEvent* event = NS_STATIC_CAST(nsPopupBlockedEvent*, mEvent);
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
*aPopupWindowURI = event->mPopupWindowURI;
NS_IF_ADDREF(*aPopupWindowURI);
return NS_OK;
@ -136,7 +136,7 @@ NS_IMETHODIMP
nsDOMPopupBlockedEvent::GetPopupWindowFeatures(nsAString &aPopupWindowFeatures)
{
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
nsPopupBlockedEvent* event = NS_STATIC_CAST(nsPopupBlockedEvent*, mEvent);
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
aPopupWindowFeatures = event->mPopupWindowFeatures;
return NS_OK;
}
@ -148,7 +148,7 @@ NS_IMETHODIMP
nsDOMPopupBlockedEvent::GetPopupWindowName(nsAString &aPopupWindowName)
{
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
nsPopupBlockedEvent* event = NS_STATIC_CAST(nsPopupBlockedEvent*, mEvent);
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
aPopupWindowName = event->mPopupWindowName;
return NS_OK;
}

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

@ -59,7 +59,7 @@ nsDOMTextEvent::nsDOMTextEvent(nsPresContext* aPresContext,
//
// extract the IME composition string
//
nsTextEvent *te = NS_STATIC_CAST(nsTextEvent*, mEvent);
nsTextEvent *te = static_cast<nsTextEvent*>(mEvent);
mText = te->theText;
//
@ -113,7 +113,7 @@ NS_METHOD nsDOMTextEvent::GetEventReply(nsTextEventReply** aReply)
{
if (mEvent->message == NS_TEXT_TEXT)
{
*aReply = &(NS_STATIC_CAST(nsTextEvent*, mEvent)->theReply);
*aReply = &(static_cast<nsTextEvent*>(mEvent)->theReply);
return NS_OK;
}
aReply = 0;

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

@ -55,8 +55,8 @@
nsDOMUIEvent::nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent)
: nsDOMEvent(aPresContext, aEvent ?
NS_STATIC_CAST(nsEvent *, aEvent) :
NS_STATIC_CAST(nsEvent *, new nsUIEvent(PR_FALSE, 0, 0)))
static_cast<nsEvent *>(aEvent) :
static_cast<nsEvent *>(new nsUIEvent(PR_FALSE, 0, 0)))
, mClientPoint(0,0)
{
if (aEvent) {
@ -73,14 +73,14 @@ nsDOMUIEvent::nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent)
{
case NS_UI_EVENT:
{
nsUIEvent *event = NS_STATIC_CAST(nsUIEvent*, mEvent);
nsUIEvent *event = static_cast<nsUIEvent*>(mEvent);
mDetail = event->detail;
break;
}
case NS_SCROLLPORT_EVENT:
{
nsScrollPortEvent* scrollEvent = NS_STATIC_CAST(nsScrollPortEvent*, mEvent);
nsScrollPortEvent* scrollEvent = static_cast<nsScrollPortEvent*>(mEvent);
mDetail = (PRInt32)scrollEvent->orient;
break;
}
@ -444,7 +444,7 @@ NS_METHOD nsDOMUIEvent::GetCompositionReply(nsTextEventReply** aReply)
(mEvent->message == NS_COMPOSITION_START) ||
(mEvent->message == NS_COMPOSITION_QUERY))
{
*aReply = &(NS_STATIC_CAST(nsCompositionEvent*, mEvent)->theReply);
*aReply = &(static_cast<nsCompositionEvent*>(mEvent)->theReply);
return NS_OK;
}
*aReply = nsnull;
@ -456,7 +456,7 @@ nsDOMUIEvent::GetReconversionReply(nsReconversionEventReply** aReply)
{
if (mEvent->eventStructType == NS_RECONVERSION_EVENT)
{
*aReply = &(NS_STATIC_CAST(nsReconversionEvent*, mEvent)->theReply);
*aReply = &(static_cast<nsReconversionEvent*>(mEvent)->theReply);
return NS_OK;
}
*aReply = nsnull;
@ -468,7 +468,7 @@ nsDOMUIEvent::GetQueryCaretRectReply(nsQueryCaretRectEventReply** aReply)
{
if (mEvent->eventStructType == NS_QUERYCARETRECT_EVENT)
{
*aReply = &(NS_STATIC_CAST(nsQueryCaretRectEvent*, mEvent)->theReply);
*aReply = &(static_cast<nsQueryCaretRectEvent*>(mEvent)->theReply);
return NS_OK;
}
*aReply = nsnull;

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

@ -56,7 +56,7 @@ nsDOMXULCommandEvent::nsDOMXULCommandEvent(nsPresContext* aPresContext,
nsDOMXULCommandEvent::~nsDOMXULCommandEvent()
{
if (mEventIsInternal) {
nsXULCommandEvent* command = NS_STATIC_CAST(nsXULCommandEvent*, mEvent);
nsXULCommandEvent* command = static_cast<nsXULCommandEvent*>(mEvent);
delete command;
mEvent = nsnull;
}

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

@ -60,7 +60,7 @@ public:
private:
// Convenience accessor for the event
nsXULCommandEvent* Event() {
return NS_STATIC_CAST(nsXULCommandEvent*, mEvent);
return static_cast<nsXULCommandEvent*>(mEvent);
}
};

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

@ -549,54 +549,54 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
switch(aEvent->eventStructType) {
case NS_MUTATION_EVENT:
return NS_NewDOMMutationEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsMutationEvent*,aEvent));
static_cast<nsMutationEvent*>(aEvent));
case NS_GUI_EVENT:
case NS_COMPOSITION_EVENT:
case NS_RECONVERSION_EVENT:
case NS_QUERYCARETRECT_EVENT:
case NS_SCROLLPORT_EVENT:
return NS_NewDOMUIEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsGUIEvent*,aEvent));
static_cast<nsGUIEvent*>(aEvent));
case NS_KEY_EVENT:
return NS_NewDOMKeyboardEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsKeyEvent*,aEvent));
static_cast<nsKeyEvent*>(aEvent));
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_POPUP_EVENT:
return NS_NewDOMMouseEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsInputEvent*,aEvent));
static_cast<nsInputEvent*>(aEvent));
case NS_POPUPBLOCKED_EVENT:
return NS_NewDOMPopupBlockedEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsPopupBlockedEvent*,
aEvent));
static_cast<nsPopupBlockedEvent*>
(aEvent));
case NS_TEXT_EVENT:
return NS_NewDOMTextEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsTextEvent*,aEvent));
static_cast<nsTextEvent*>(aEvent));
case NS_BEFORE_PAGE_UNLOAD_EVENT:
return
NS_NewDOMBeforeUnloadEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsBeforePageUnloadEvent*,
aEvent));
static_cast<nsBeforePageUnloadEvent*>
(aEvent));
case NS_PAGETRANSITION_EVENT:
return NS_NewDOMPageTransitionEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsPageTransitionEvent*,
aEvent));
static_cast<nsPageTransitionEvent*>
(aEvent));
#ifdef MOZ_SVG
case NS_SVG_EVENT:
return NS_NewDOMSVGEvent(aDOMEvent, aPresContext,
aEvent);
case NS_SVGZOOM_EVENT:
return NS_NewDOMSVGZoomEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsGUIEvent*,aEvent));
static_cast<nsGUIEvent*>(aEvent));
#endif // MOZ_SVG
case NS_XUL_COMMAND_EVENT:
return NS_NewDOMXULCommandEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsXULCommandEvent*,
aEvent));
static_cast<nsXULCommandEvent*>
(aEvent));
case NS_COMMAND_EVENT:
return NS_NewDOMCommandEvent(aDOMEvent, aPresContext,
NS_STATIC_CAST(nsCommandEvent*, aEvent));
static_cast<nsCommandEvent*>(aEvent));
}
// For all other types of events, create a vanilla event object.

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше