Bug 1547143 - Format the tree: Be prescriptive with the pointer style (left) r=Ehsan

# ignore-this-changeset

Depends on D28954

Differential Revision: https://phabricator.services.mozilla.com/D28956
This commit is contained in:
Sylvestre Ledru
2019-05-01 08:47:10 +00:00
parent 72bb6ee0b9
commit ad31adba4c
1031 changed files with 26880 additions and 26963 deletions

View File

@@ -24,10 +24,10 @@ typedef AtkUtilClass MaiUtilClass;
extern "C" {
static guint (*gail_add_global_event_listener)(GSignalEmissionHook listener,
const gchar *event_type);
const gchar* event_type);
static void (*gail_remove_global_event_listener)(guint remove_listener);
static void (*gail_remove_key_event_listener)(guint remove_listener);
static AtkObject *(*gail_get_root)();
static AtkObject* (*gail_get_root)();
}
struct MaiUtilListenerInfo {
@@ -41,13 +41,13 @@ struct MaiUtilListenerInfo {
guint gail_listenerid;
};
static GHashTable *sListener_list = nullptr;
static GHashTable* sListener_list = nullptr;
static gint sListener_idx = 1;
extern "C" {
static guint add_listener(GSignalEmissionHook listener,
const gchar *object_type, const gchar *signal,
const gchar *hook_data, guint gail_listenerid = 0) {
const gchar* object_type, const gchar* signal,
const gchar* hook_data, guint gail_listenerid = 0) {
GType type;
guint signal_id;
gint rc = 0;
@@ -56,12 +56,12 @@ static guint add_listener(GSignalEmissionHook listener,
if (type) {
signal_id = g_signal_lookup(signal, type);
if (signal_id > 0) {
MaiUtilListenerInfo *listener_info;
MaiUtilListenerInfo* listener_info;
rc = sListener_idx;
listener_info =
(MaiUtilListenerInfo *)g_malloc(sizeof(MaiUtilListenerInfo));
(MaiUtilListenerInfo*)g_malloc(sizeof(MaiUtilListenerInfo));
listener_info->key = sListener_idx;
listener_info->hook_id = g_signal_add_emission_hook(
signal_id, 0, listener, g_strdup(hook_data), (GDestroyNotify)g_free);
@@ -80,9 +80,9 @@ static guint add_listener(GSignalEmissionHook listener,
}
static guint mai_util_add_global_event_listener(GSignalEmissionHook listener,
const gchar *event_type) {
const gchar* event_type) {
guint rc = 0;
gchar **split_string;
gchar** split_string;
split_string = g_strsplit(event_type, ":", 3);
@@ -106,11 +106,11 @@ static guint mai_util_add_global_event_listener(GSignalEmissionHook listener,
static void mai_util_remove_global_event_listener(guint remove_listener) {
if (remove_listener > 0) {
MaiUtilListenerInfo *listener_info;
MaiUtilListenerInfo* listener_info;
gint tmp_idx = remove_listener;
listener_info =
(MaiUtilListenerInfo *)g_hash_table_lookup(sListener_list, &tmp_idx);
(MaiUtilListenerInfo*)g_hash_table_lookup(sListener_list, &tmp_idx);
if (listener_info != nullptr) {
if (gail_remove_global_event_listener && listener_info->gail_listenerid) {
@@ -144,8 +144,8 @@ static void mai_util_remove_global_event_listener(guint remove_listener) {
}
}
static AtkKeyEventStruct *atk_key_event_from_gdk_event_key(GdkEventKey *key) {
AtkKeyEventStruct *event = g_new0(AtkKeyEventStruct, 1);
static AtkKeyEventStruct* atk_key_event_from_gdk_event_key(GdkEventKey* key) {
AtkKeyEventStruct* event = g_new0(AtkKeyEventStruct, 1);
switch (key->type) {
case GDK_KEY_PRESS:
event->type = ATK_KEY_EVENT_PRESS;
@@ -173,7 +173,7 @@ static AtkKeyEventStruct *atk_key_event_from_gdk_event_key(GdkEventKey *key) {
}
struct MaiKeyEventInfo {
AtkKeyEventStruct *key_event;
AtkKeyEventStruct* key_event;
gpointer func_data;
};
@@ -183,7 +183,7 @@ union AtkKeySnoopFuncPointer {
};
static gboolean notify_hf(gpointer key, gpointer value, gpointer data) {
MaiKeyEventInfo *info = (MaiKeyEventInfo *)data;
MaiKeyEventInfo* info = (MaiKeyEventInfo*)data;
AtkKeySnoopFuncPointer atkKeySnoop;
atkKeySnoop.data = value;
return (atkKeySnoop.func_ptr)(info->key_event, info->func_data) ? TRUE
@@ -191,20 +191,20 @@ static gboolean notify_hf(gpointer key, gpointer value, gpointer data) {
}
static void insert_hf(gpointer key, gpointer value, gpointer data) {
GHashTable *new_table = (GHashTable *)data;
GHashTable* new_table = (GHashTable*)data;
g_hash_table_insert(new_table, key, value);
}
static GHashTable *sKey_listener_list = nullptr;
static GHashTable* sKey_listener_list = nullptr;
static gint mai_key_snooper(GtkWidget *the_widget, GdkEventKey *event,
static gint mai_key_snooper(GtkWidget* the_widget, GdkEventKey* event,
gpointer func_data) {
/* notify each AtkKeySnoopFunc in turn... */
MaiKeyEventInfo *info = g_new0(MaiKeyEventInfo, 1);
MaiKeyEventInfo* info = g_new0(MaiKeyEventInfo, 1);
gint consumed = 0;
if (sKey_listener_list) {
GHashTable *new_hash = g_hash_table_new(nullptr, nullptr);
GHashTable* new_hash = g_hash_table_new(nullptr, nullptr);
g_hash_table_foreach(sKey_listener_list, insert_hf, new_hash);
info->key_event = atk_key_event_from_gdk_event_key(event);
info->func_data = func_data;
@@ -257,8 +257,8 @@ static void mai_util_remove_key_event_listener(guint remove_listener) {
}
}
static AtkObject *mai_util_get_root() {
ApplicationAccessible *app = ApplicationAcc();
static AtkObject* mai_util_get_root() {
ApplicationAccessible* app = ApplicationAcc();
if (app) return app->GetAtkObject();
// We've shutdown, try to use gail instead
@@ -269,28 +269,28 @@ static AtkObject *mai_util_get_root() {
return nullptr;
}
static const gchar *mai_util_get_toolkit_name() { return MAI_NAME; }
static const gchar* mai_util_get_toolkit_name() { return MAI_NAME; }
static const gchar *mai_util_get_toolkit_version() { return MAI_VERSION; }
static const gchar* mai_util_get_toolkit_version() { return MAI_VERSION; }
static void _listener_info_destroy(gpointer data) { g_free(data); }
static void window_added(AtkObject *atk_obj, guint index, AtkObject *child) {
static void window_added(AtkObject* atk_obj, guint index, AtkObject* child) {
if (!IS_MAI_OBJECT(child)) return;
static guint id = g_signal_lookup("create", MAI_TYPE_ATK_OBJECT);
g_signal_emit(child, id, 0);
}
static void window_removed(AtkObject *atk_obj, guint index, AtkObject *child) {
static void window_removed(AtkObject* atk_obj, guint index, AtkObject* child) {
if (!IS_MAI_OBJECT(child)) return;
static guint id = g_signal_lookup("destroy", MAI_TYPE_ATK_OBJECT);
g_signal_emit(child, id, 0);
}
static void UtilInterfaceInit(MaiUtilClass *klass) {
AtkUtilClass *atk_class;
static void UtilInterfaceInit(MaiUtilClass* klass) {
AtkUtilClass* atk_class;
gpointer data;
data = g_type_class_peek(ATK_TYPE_UTIL);
@@ -314,7 +314,7 @@ static void UtilInterfaceInit(MaiUtilClass *klass) {
sListener_list = g_hash_table_new_full(g_int_hash, g_int_equal, nullptr,
_listener_info_destroy);
// Keep track of added/removed windows.
AtkObject *root = atk_get_root();
AtkObject* root = atk_get_root();
g_signal_connect(root, "children-changed::add", (GCallback)window_added,
nullptr);
g_signal_connect(root, "children-changed::remove", (GCallback)window_removed,

View File

@@ -38,7 +38,7 @@ struct MaiAtkHyperlink {
* The MaiHyperlink whose properties and features are exported via this
* hyperlink instance.
*/
MaiHyperlink *maiHyperlink;
MaiHyperlink* maiHyperlink;
};
struct MaiAtkHyperlinkClass {
@@ -49,23 +49,23 @@ GType mai_atk_hyperlink_get_type(void);
G_BEGIN_DECLS
/* callbacks for AtkHyperlink */
static void classInitCB(AtkHyperlinkClass *aClass);
static void finalizeCB(GObject *aObj);
static void classInitCB(AtkHyperlinkClass* aClass);
static void finalizeCB(GObject* aObj);
/* callbacks for AtkHyperlink virtual functions */
static gchar *getUriCB(AtkHyperlink *aLink, gint aLinkIndex);
static AtkObject *getObjectCB(AtkHyperlink *aLink, gint aLinkIndex);
static gint getEndIndexCB(AtkHyperlink *aLink);
static gint getStartIndexCB(AtkHyperlink *aLink);
static gboolean isValidCB(AtkHyperlink *aLink);
static gint getAnchorCountCB(AtkHyperlink *aLink);
static gchar* getUriCB(AtkHyperlink* aLink, gint aLinkIndex);
static AtkObject* getObjectCB(AtkHyperlink* aLink, gint aLinkIndex);
static gint getEndIndexCB(AtkHyperlink* aLink);
static gint getStartIndexCB(AtkHyperlink* aLink);
static gboolean isValidCB(AtkHyperlink* aLink);
static gint getAnchorCountCB(AtkHyperlink* aLink);
G_END_DECLS
static gpointer parent_class = nullptr;
static MaiHyperlink *GetMaiHyperlink(AtkHyperlink *aHyperlink) {
static MaiHyperlink* GetMaiHyperlink(AtkHyperlink* aHyperlink) {
NS_ENSURE_TRUE(MAI_IS_ATK_HYPERLINK(aHyperlink), nullptr);
MaiHyperlink *maiHyperlink = MAI_ATK_HYPERLINK(aHyperlink)->maiHyperlink;
MaiHyperlink* maiHyperlink = MAI_ATK_HYPERLINK(aHyperlink)->maiHyperlink;
NS_ENSURE_TRUE(maiHyperlink != nullptr, nullptr);
NS_ENSURE_TRUE(maiHyperlink->GetAtkHyperlink() == aHyperlink, nullptr);
return maiHyperlink;
@@ -96,7 +96,7 @@ GType mai_atk_hyperlink_get_type(void) {
MaiHyperlink::MaiHyperlink(AccessibleOrProxy aHyperLink)
: mHyperlink(aHyperLink), mMaiAtkHyperlink(nullptr) {
mMaiAtkHyperlink = reinterpret_cast<AtkHyperlink *>(
mMaiAtkHyperlink = reinterpret_cast<AtkHyperlink*>(
g_object_new(mai_atk_hyperlink_get_type(), nullptr));
NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
if (!mMaiAtkHyperlink) return;
@@ -113,8 +113,8 @@ MaiHyperlink::~MaiHyperlink() {
/* static functions for ATK callbacks */
void classInitCB(AtkHyperlinkClass *aClass) {
GObjectClass *gobject_class = G_OBJECT_CLASS(aClass);
void classInitCB(AtkHyperlinkClass* aClass) {
GObjectClass* gobject_class = G_OBJECT_CLASS(aClass);
parent_class = g_type_class_peek_parent(aClass);
@@ -128,11 +128,11 @@ void classInitCB(AtkHyperlinkClass *aClass) {
gobject_class->finalize = finalizeCB;
}
void finalizeCB(GObject *aObj) {
void finalizeCB(GObject* aObj) {
NS_ASSERTION(MAI_IS_ATK_HYPERLINK(aObj), "Invalid MaiAtkHyperlink");
if (!MAI_IS_ATK_HYPERLINK(aObj)) return;
MaiAtkHyperlink *maiAtkHyperlink = MAI_ATK_HYPERLINK(aObj);
MaiAtkHyperlink* maiAtkHyperlink = MAI_ATK_HYPERLINK(aObj);
maiAtkHyperlink->maiHyperlink = nullptr;
/* call parent finalize function */
@@ -140,12 +140,12 @@ void finalizeCB(GObject *aObj) {
G_OBJECT_CLASS(parent_class)->finalize(aObj);
}
gchar *getUriCB(AtkHyperlink *aLink, gint aLinkIndex) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink);
gchar* getUriCB(AtkHyperlink* aLink, gint aLinkIndex) {
MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) return nullptr;
nsAutoCString cautoStr;
if (Accessible *hyperlink = maiLink->GetAccHyperlink()) {
if (Accessible* hyperlink = maiLink->GetAccHyperlink()) {
nsCOMPtr<nsIURI> uri = hyperlink->AnchorURIAt(aLinkIndex);
if (!uri) return nullptr;
@@ -162,28 +162,28 @@ gchar *getUriCB(AtkHyperlink *aLink, gint aLinkIndex) {
return g_strdup(cautoStr.get());
}
AtkObject *getObjectCB(AtkHyperlink *aLink, gint aLinkIndex) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink);
AtkObject* getObjectCB(AtkHyperlink* aLink, gint aLinkIndex) {
MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) {
return nullptr;
}
if (Accessible *hyperlink = maiLink->GetAccHyperlink()) {
Accessible *anchor = hyperlink->AnchorAt(aLinkIndex);
if (Accessible* hyperlink = maiLink->GetAccHyperlink()) {
Accessible* anchor = hyperlink->AnchorAt(aLinkIndex);
NS_ENSURE_TRUE(anchor, nullptr);
return AccessibleWrap::GetAtkObject(anchor);
}
ProxyAccessible *anchor = maiLink->Proxy()->AnchorAt(aLinkIndex);
ProxyAccessible* anchor = maiLink->Proxy()->AnchorAt(aLinkIndex);
return anchor ? GetWrapperFor(anchor) : nullptr;
}
gint getEndIndexCB(AtkHyperlink *aLink) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink);
gint getEndIndexCB(AtkHyperlink* aLink) {
MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) return false;
if (Accessible *hyperlink = maiLink->GetAccHyperlink())
if (Accessible* hyperlink = maiLink->GetAccHyperlink())
return static_cast<gint>(hyperlink->EndOffset());
bool valid = false;
@@ -191,11 +191,11 @@ gint getEndIndexCB(AtkHyperlink *aLink) {
return valid ? static_cast<gint>(endIdx) : -1;
}
gint getStartIndexCB(AtkHyperlink *aLink) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink);
gint getStartIndexCB(AtkHyperlink* aLink) {
MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) return -1;
if (Accessible *hyperlink = maiLink->GetAccHyperlink())
if (Accessible* hyperlink = maiLink->GetAccHyperlink())
return static_cast<gint>(hyperlink->StartOffset());
bool valid = false;
@@ -203,21 +203,21 @@ gint getStartIndexCB(AtkHyperlink *aLink) {
return valid ? static_cast<gint>(startIdx) : -1;
}
gboolean isValidCB(AtkHyperlink *aLink) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink);
gboolean isValidCB(AtkHyperlink* aLink) {
MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) return false;
if (Accessible *hyperlink = maiLink->GetAccHyperlink())
if (Accessible* hyperlink = maiLink->GetAccHyperlink())
return static_cast<gboolean>(hyperlink->IsLinkValid());
return static_cast<gboolean>(maiLink->Proxy()->IsLinkValid());
}
gint getAnchorCountCB(AtkHyperlink *aLink) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink);
gint getAnchorCountCB(AtkHyperlink* aLink) {
MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) return -1;
if (Accessible *hyperlink = maiLink->GetAccHyperlink())
if (Accessible* hyperlink = maiLink->GetAccHyperlink())
return static_cast<gint>(hyperlink->AnchorCount());
bool valid = false;

View File

@@ -43,16 +43,16 @@ using namespace mozilla;
// nsCoreUtils
////////////////////////////////////////////////////////////////////////////////
bool nsCoreUtils::IsLabelWithControl(nsIContent *aContent) {
dom::HTMLLabelElement *label = dom::HTMLLabelElement::FromNode(aContent);
bool nsCoreUtils::IsLabelWithControl(nsIContent* aContent) {
dom::HTMLLabelElement* label = dom::HTMLLabelElement::FromNode(aContent);
if (label && label->GetControl()) return true;
return false;
}
bool nsCoreUtils::HasClickListener(nsIContent *aContent) {
bool nsCoreUtils::HasClickListener(nsIContent* aContent) {
NS_ENSURE_TRUE(aContent, false);
EventListenerManager *listenerManager =
EventListenerManager* listenerManager =
aContent->GetExistingListenerManager();
return listenerManager &&
@@ -61,13 +61,13 @@ bool nsCoreUtils::HasClickListener(nsIContent *aContent) {
listenerManager->HasListenersFor(nsGkAtoms::onmouseup));
}
void nsCoreUtils::DispatchClickEvent(XULTreeElement *aTree, int32_t aRowIndex,
nsTreeColumn *aColumn,
const nsAString &aPseudoElt) {
void nsCoreUtils::DispatchClickEvent(XULTreeElement* aTree, int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsAString& aPseudoElt) {
RefPtr<dom::Element> tcElm = aTree->GetTreeBody();
if (!tcElm) return;
Document *document = tcElm->GetUncomposedDoc();
Document* document = tcElm->GetUncomposedDoc();
if (!document) return;
RefPtr<PresShell> presShell = document->GetPresShell();
@@ -92,7 +92,7 @@ void nsCoreUtils::DispatchClickEvent(XULTreeElement *aTree, int32_t aRowIndex,
// Dispatch mouse events.
AutoWeakFrame tcFrame = tcElm->GetPrimaryFrame();
nsIFrame *rootFrame = presShell->GetRootFrame();
nsIFrame* rootFrame = presShell->GetRootFrame();
nsPoint offset;
nsCOMPtr<nsIWidget> rootWidget =
@@ -114,9 +114,9 @@ void nsCoreUtils::DispatchClickEvent(XULTreeElement *aTree, int32_t aRowIndex,
}
void nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX,
int32_t aY, nsIContent *aContent,
nsIFrame *aFrame, PresShell *aPresShell,
nsIWidget *aRootWidget) {
int32_t aY, nsIContent* aContent,
nsIFrame* aFrame, PresShell* aPresShell,
nsIWidget* aRootWidget) {
WidgetMouseEvent event(true, aMessage, aRootWidget, WidgetMouseEvent::eReal,
WidgetMouseEvent::eNormal);
@@ -132,10 +132,10 @@ void nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX,
}
void nsCoreUtils::DispatchTouchEvent(EventMessage aMessage, int32_t aX,
int32_t aY, nsIContent *aContent,
nsIFrame *aFrame, PresShell *aPresShell,
nsIWidget *aRootWidget) {
nsIDocShell *docShell = nullptr;
int32_t aY, nsIContent* aContent,
nsIFrame* aFrame, PresShell* aPresShell,
nsIWidget* aRootWidget) {
nsIDocShell* docShell = nullptr;
if (aPresShell->GetDocument()) {
docShell = aPresShell->GetDocument()->GetDocShell();
}
@@ -156,7 +156,7 @@ void nsCoreUtils::DispatchTouchEvent(EventMessage aMessage, int32_t aX,
aPresShell->HandleEventWithTarget(&event, aFrame, aContent, &status);
}
uint32_t nsCoreUtils::GetAccessKeyFor(nsIContent *aContent) {
uint32_t nsCoreUtils::GetAccessKeyFor(nsIContent* aContent) {
// Accesskeys are registered by @accesskey attribute only. At first check
// whether it is presented on the given element to avoid the slow
// EventStateManager::GetRegisteredAccessKey() method.
@@ -164,16 +164,16 @@ uint32_t nsCoreUtils::GetAccessKeyFor(nsIContent *aContent) {
!aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::accesskey))
return 0;
nsPresContext *presContext = aContent->OwnerDoc()->GetPresContext();
nsPresContext* presContext = aContent->OwnerDoc()->GetPresContext();
if (!presContext) return 0;
EventStateManager *esm = presContext->EventStateManager();
EventStateManager* esm = presContext->EventStateManager();
if (!esm) return 0;
return esm->GetRegisteredAccessKey(aContent->AsElement());
}
nsIContent *nsCoreUtils::GetDOMElementFor(nsIContent *aContent) {
nsIContent* nsCoreUtils::GetDOMElementFor(nsIContent* aContent) {
if (aContent->IsElement()) return aContent;
if (aContent->IsText()) return aContent->GetFlattenedTreeParent();
@@ -181,7 +181,7 @@ nsIContent *nsCoreUtils::GetDOMElementFor(nsIContent *aContent) {
return nullptr;
}
nsINode *nsCoreUtils::GetDOMNodeFromDOMPoint(nsINode *aNode, uint32_t aOffset) {
nsINode* nsCoreUtils::GetDOMNodeFromDOMPoint(nsINode* aNode, uint32_t aOffset) {
if (aNode && aNode->IsElement()) {
uint32_t childCount = aNode->GetChildCount();
NS_ASSERTION(aOffset <= childCount, "Wrong offset of the DOM point!");
@@ -195,12 +195,12 @@ nsINode *nsCoreUtils::GetDOMNodeFromDOMPoint(nsINode *aNode, uint32_t aOffset) {
return aNode;
}
bool nsCoreUtils::IsAncestorOf(nsINode *aPossibleAncestorNode,
nsINode *aPossibleDescendantNode,
nsINode *aRootNode) {
bool nsCoreUtils::IsAncestorOf(nsINode* aPossibleAncestorNode,
nsINode* aPossibleDescendantNode,
nsINode* aRootNode) {
NS_ENSURE_TRUE(aPossibleAncestorNode && aPossibleDescendantNode, false);
nsINode *parentNode = aPossibleDescendantNode;
nsINode* parentNode = aPossibleDescendantNode;
while ((parentNode = parentNode->GetParentNode()) &&
parentNode != aRootNode) {
if (parentNode == aPossibleAncestorNode) return true;
@@ -209,7 +209,7 @@ bool nsCoreUtils::IsAncestorOf(nsINode *aPossibleAncestorNode,
return false;
}
nsresult nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame, nsRange *aRange,
nsresult nsCoreUtils::ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
uint32_t aScrollType) {
ScrollAxis vertical, horizontal;
ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
@@ -217,14 +217,14 @@ nsresult nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame, nsRange *aRange,
return ScrollSubstringTo(aFrame, aRange, vertical, horizontal);
}
nsresult nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame, nsRange *aRange,
nsresult nsCoreUtils::ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
ScrollAxis aVertical,
ScrollAxis aHorizontal) {
if (!aFrame || !aRange) {
return NS_ERROR_FAILURE;
}
nsPresContext *presContext = aFrame->PresContext();
nsPresContext* presContext = aFrame->PresContext();
nsCOMPtr<nsISelectionController> selCon;
aFrame->GetSelectionController(presContext, getter_AddRefs(selCon));
@@ -245,10 +245,10 @@ nsresult nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame, nsRange *aRange,
return NS_OK;
}
void nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
nsIFrame *aFrame,
const nsIntPoint &aPoint) {
nsIScrollableFrame *scrollableFrame = do_QueryFrame(aScrollableFrame);
void nsCoreUtils::ScrollFrameToPoint(nsIFrame* aScrollableFrame,
nsIFrame* aFrame,
const nsIntPoint& aPoint) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aScrollableFrame);
if (!scrollableFrame) return;
nsPoint point =
@@ -263,8 +263,8 @@ void nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
}
void nsCoreUtils::ConvertScrollTypeToPercents(uint32_t aScrollType,
ScrollAxis *aVertical,
ScrollAxis *aHorizontal) {
ScrollAxis* aVertical,
ScrollAxis* aHorizontal) {
WhereToScroll whereY, whereX;
WhenToScroll whenY, whenX;
switch (aScrollType) {
@@ -314,7 +314,7 @@ void nsCoreUtils::ConvertScrollTypeToPercents(uint32_t aScrollType,
*aHorizontal = ScrollAxis(whereX, whenX);
}
nsIntPoint nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode) {
nsIntPoint nsCoreUtils::GetScreenCoordsForWindow(nsINode* aNode) {
nsIntPoint coords(0, 0);
nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellFor(aNode));
if (!treeItem) return coords;
@@ -330,14 +330,14 @@ nsIntPoint nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode) {
return coords;
}
already_AddRefed<nsIDocShell> nsCoreUtils::GetDocShellFor(nsINode *aNode) {
already_AddRefed<nsIDocShell> nsCoreUtils::GetDocShellFor(nsINode* aNode) {
if (!aNode) return nullptr;
nsCOMPtr<nsIDocShell> docShell = aNode->OwnerDoc()->GetDocShell();
return docShell.forget();
}
bool nsCoreUtils::IsRootDocument(Document *aDocument) {
bool nsCoreUtils::IsRootDocument(Document* aDocument) {
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aDocument->GetDocShell();
NS_ASSERTION(docShellTreeItem, "No document shell for document!");
@@ -347,14 +347,14 @@ bool nsCoreUtils::IsRootDocument(Document *aDocument) {
return !parentTreeItem;
}
bool nsCoreUtils::IsContentDocument(Document *aDocument) {
bool nsCoreUtils::IsContentDocument(Document* aDocument) {
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aDocument->GetDocShell();
NS_ASSERTION(docShellTreeItem, "No document shell tree item for document!");
return (docShellTreeItem->ItemType() == nsIDocShellTreeItem::typeContent);
}
bool nsCoreUtils::IsTabDocument(Document *aDocumentNode) {
bool nsCoreUtils::IsTabDocument(Document* aDocumentNode) {
nsCOMPtr<nsIDocShellTreeItem> treeItem(aDocumentNode->GetDocShell());
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
@@ -370,8 +370,8 @@ bool nsCoreUtils::IsTabDocument(Document *aDocumentNode) {
return parentTreeItem == rootTreeItem;
}
bool nsCoreUtils::IsErrorPage(Document *aDocument) {
nsIURI *uri = aDocument->GetDocumentURI();
bool nsCoreUtils::IsErrorPage(Document* aDocument) {
nsIURI* uri = aDocument->GetDocumentURI();
bool isAboutScheme = false;
uri->SchemeIs("about", &isAboutScheme);
if (!isAboutScheme) return false;
@@ -385,13 +385,13 @@ bool nsCoreUtils::IsErrorPage(Document *aDocument) {
return StringBeginsWith(path, neterror) || StringBeginsWith(path, certerror);
}
bool nsCoreUtils::GetID(nsIContent *aContent, nsAString &aID) {
bool nsCoreUtils::GetID(nsIContent* aContent, nsAString& aID) {
return aContent->IsElement() &&
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aID);
}
bool nsCoreUtils::GetUIntAttr(nsIContent *aContent, nsAtom *aAttr,
int32_t *aUInt) {
bool nsCoreUtils::GetUIntAttr(nsIContent* aContent, nsAtom* aAttr,
int32_t* aUInt) {
nsAutoString value;
if (!aContent->IsElement()) {
return false;
@@ -409,11 +409,11 @@ bool nsCoreUtils::GetUIntAttr(nsIContent *aContent, nsAtom *aAttr,
return false;
}
void nsCoreUtils::GetLanguageFor(nsIContent *aContent, nsIContent *aRootContent,
nsAString &aLanguage) {
void nsCoreUtils::GetLanguageFor(nsIContent* aContent, nsIContent* aRootContent,
nsAString& aLanguage) {
aLanguage.Truncate();
nsIContent *walkUp = aContent;
nsIContent* walkUp = aContent;
while (walkUp && walkUp != aRootContent &&
(!walkUp->IsElement() ||
!walkUp->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::lang,
@@ -421,9 +421,9 @@ void nsCoreUtils::GetLanguageFor(nsIContent *aContent, nsIContent *aRootContent,
walkUp = walkUp->GetParent();
}
XULTreeElement *nsCoreUtils::GetTree(nsIContent *aContent) {
XULTreeElement* nsCoreUtils::GetTree(nsIContent* aContent) {
// Find DOMNode's parents recursively until reach the <tree> tag
nsIContent *currentContent = aContent;
nsIContent* currentContent = aContent;
while (currentContent) {
if (currentContent->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL)) {
return XULTreeElement::FromNode(currentContent);
@@ -435,7 +435,7 @@ XULTreeElement *nsCoreUtils::GetTree(nsIContent *aContent) {
}
already_AddRefed<nsTreeColumn> nsCoreUtils::GetFirstSensibleColumn(
XULTreeElement *aTree) {
XULTreeElement* aTree) {
RefPtr<nsTreeColumns> cols = aTree->GetColumns();
if (!cols) return nullptr;
@@ -445,13 +445,13 @@ already_AddRefed<nsTreeColumn> nsCoreUtils::GetFirstSensibleColumn(
return column.forget();
}
uint32_t nsCoreUtils::GetSensibleColumnCount(XULTreeElement *aTree) {
uint32_t nsCoreUtils::GetSensibleColumnCount(XULTreeElement* aTree) {
uint32_t count = 0;
RefPtr<nsTreeColumns> cols = aTree->GetColumns();
if (!cols) return count;
nsTreeColumn *column = cols->GetFirstColumn();
nsTreeColumn* column = cols->GetFirstColumn();
while (column) {
if (!IsColumnHidden(column)) count++;
@@ -463,7 +463,7 @@ uint32_t nsCoreUtils::GetSensibleColumnCount(XULTreeElement *aTree) {
}
already_AddRefed<nsTreeColumn> nsCoreUtils::GetSensibleColumnAt(
XULTreeElement *aTree, uint32_t aIndex) {
XULTreeElement* aTree, uint32_t aIndex) {
uint32_t idx = aIndex;
nsCOMPtr<nsTreeColumn> column = GetFirstSensibleColumn(aTree);
@@ -478,7 +478,7 @@ already_AddRefed<nsTreeColumn> nsCoreUtils::GetSensibleColumnAt(
}
already_AddRefed<nsTreeColumn> nsCoreUtils::GetNextSensibleColumn(
nsTreeColumn *aColumn) {
nsTreeColumn* aColumn) {
RefPtr<nsTreeColumn> nextColumn = aColumn->GetNext();
while (nextColumn && IsColumnHidden(nextColumn)) {
@@ -489,7 +489,7 @@ already_AddRefed<nsTreeColumn> nsCoreUtils::GetNextSensibleColumn(
}
already_AddRefed<nsTreeColumn> nsCoreUtils::GetPreviousSensibleColumn(
nsTreeColumn *aColumn) {
nsTreeColumn* aColumn) {
RefPtr<nsTreeColumn> prevColumn = aColumn->GetPrevious();
while (prevColumn && IsColumnHidden(prevColumn)) {
@@ -499,13 +499,13 @@ already_AddRefed<nsTreeColumn> nsCoreUtils::GetPreviousSensibleColumn(
return prevColumn.forget();
}
bool nsCoreUtils::IsColumnHidden(nsTreeColumn *aColumn) {
Element *element = aColumn->Element();
bool nsCoreUtils::IsColumnHidden(nsTreeColumn* aColumn) {
Element* element = aColumn->Element();
return element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
nsGkAtoms::_true, eCaseMatters);
}
void nsCoreUtils::ScrollTo(PresShell *aPresShell, nsIContent *aContent,
void nsCoreUtils::ScrollTo(PresShell* aPresShell, nsIContent* aContent,
uint32_t aScrollType) {
ScrollAxis vertical, horizontal;
ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
@@ -513,7 +513,7 @@ void nsCoreUtils::ScrollTo(PresShell *aPresShell, nsIContent *aContent,
ScrollFlags::ScrollOverflowHidden);
}
bool nsCoreUtils::IsWhitespaceString(const nsAString &aString) {
bool nsCoreUtils::IsWhitespaceString(const nsAString& aString) {
nsAString::const_char_iterator iterBegin, iterEnd;
aString.BeginReading(iterBegin);

View File

@@ -39,13 +39,13 @@ class nsCoreUtils {
/**
* Return true if the given node is a label of a control.
*/
static bool IsLabelWithControl(nsIContent *aContent);
static bool IsLabelWithControl(nsIContent* aContent);
/**
* Return true if the given node has registered click, mousedown or mouseup
* event listeners.
*/
static bool HasClickListener(nsIContent *aContent);
static bool HasClickListener(nsIContent* aContent);
/**
* Dispatch click event to XUL tree cell.
@@ -57,9 +57,9 @@ class nsCoreUtils {
* XULTreeElement for available values
*/
MOZ_CAN_RUN_SCRIPT
static void DispatchClickEvent(mozilla::dom::XULTreeElement *aTree,
int32_t aRowIndex, nsTreeColumn *aColumn,
const nsAString &aPseudoElt = EmptyString());
static void DispatchClickEvent(mozilla::dom::XULTreeElement* aTree,
int32_t aRowIndex, nsTreeColumn* aColumn,
const nsAString& aPseudoElt = EmptyString());
/**
* Send mouse event to the given element.
@@ -74,9 +74,9 @@ class nsCoreUtils {
*/
MOZ_CAN_RUN_SCRIPT
static void DispatchMouseEvent(mozilla::EventMessage aMessage, int32_t aX,
int32_t aY, nsIContent *aContent,
nsIFrame *aFrame, PresShell *aPresShell,
nsIWidget *aRootWidget);
int32_t aY, nsIContent* aContent,
nsIFrame* aFrame, PresShell* aPresShell,
nsIWidget* aRootWidget);
/**
* Send a touch event with a single touch point to the given element.
@@ -91,9 +91,9 @@ class nsCoreUtils {
*/
MOZ_CAN_RUN_SCRIPT
static void DispatchTouchEvent(mozilla::EventMessage aMessage, int32_t aX,
int32_t aY, nsIContent *aContent,
nsIFrame *aFrame, PresShell *aPresShell,
nsIWidget *aRootWidget);
int32_t aY, nsIContent* aContent,
nsIFrame* aFrame, PresShell* aPresShell,
nsIWidget* aRootWidget);
/**
* Return an accesskey registered on the given element by
@@ -101,7 +101,7 @@ class nsCoreUtils {
*
* @param aContent - the given element.
*/
static uint32_t GetAccessKeyFor(nsIContent *aContent);
static uint32_t GetAccessKeyFor(nsIContent* aContent);
/**
* Return DOM element related with the given node, i.e.
@@ -111,12 +111,12 @@ class nsCoreUtils {
*
* @param aNode [in] the given DOM node
*/
static nsIContent *GetDOMElementFor(nsIContent *aContent);
static nsIContent* GetDOMElementFor(nsIContent* aContent);
/**
* Return DOM node for the given DOM point.
*/
static nsINode *GetDOMNodeFromDOMPoint(nsINode *aNode, uint32_t aOffset);
static nsINode* GetDOMNodeFromDOMPoint(nsINode* aNode, uint32_t aOffset);
/**
* Is the first passed in node an ancestor of the second?
@@ -131,9 +131,9 @@ class nsCoreUtils {
* @return true if aPossibleAncestorNode is an ancestor of
* aPossibleDescendantNode
*/
static bool IsAncestorOf(nsINode *aPossibleAncestorNode,
nsINode *aPossibleDescendantNode,
nsINode *aRootNode = nullptr);
static bool IsAncestorOf(nsINode* aPossibleAncestorNode,
nsINode* aPossibleDescendantNode,
nsINode* aRootNode = nullptr);
/**
* Helper method to scroll range into view, used for implementation of
@@ -143,7 +143,7 @@ class nsCoreUtils {
* @param aRange the range to scroll to
* @param aScrollType the place a range should be scrolled to
*/
static nsresult ScrollSubstringTo(nsIFrame *aFrame, nsRange *aRange,
static nsresult ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
uint32_t aScrollType);
/** Helper method to scroll range into view, used for implementation of
@@ -156,7 +156,7 @@ class nsCoreUtils {
* @param aHorizontal how to align horizontally, specified in percents,
* and when.
*/
static nsresult ScrollSubstringTo(nsIFrame *aFrame, nsRange *aRange,
static nsresult ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
mozilla::ScrollAxis aVertical,
mozilla::ScrollAxis aHorizontal);
@@ -168,16 +168,16 @@ class nsCoreUtils {
* @param aFrame the frame to scroll
* @param aPoint the point scroll to
*/
static void ScrollFrameToPoint(nsIFrame *aScrollableFrame, nsIFrame *aFrame,
const nsIntPoint &aPoint);
static void ScrollFrameToPoint(nsIFrame* aScrollableFrame, nsIFrame* aFrame,
const nsIntPoint& aPoint);
/**
* Converts scroll type constant defined in nsIAccessibleScrollType to
* vertical and horizontal parameters.
*/
static void ConvertScrollTypeToPercents(uint32_t aScrollType,
mozilla::ScrollAxis *aVertical,
mozilla::ScrollAxis *aHorizontal);
mozilla::ScrollAxis* aVertical,
mozilla::ScrollAxis* aHorizontal);
/**
* Returns coordinates in device pixels relative screen for the top level
@@ -185,37 +185,37 @@ class nsCoreUtils {
*
* @param aNode the DOM node hosted in the window.
*/
static nsIntPoint GetScreenCoordsForWindow(nsINode *aNode);
static nsIntPoint GetScreenCoordsForWindow(nsINode* aNode);
/**
* Return document shell for the given DOM node.
*/
static already_AddRefed<nsIDocShell> GetDocShellFor(nsINode *aNode);
static already_AddRefed<nsIDocShell> GetDocShellFor(nsINode* aNode);
/**
* Return true if the given document is root document.
*/
static bool IsRootDocument(Document *aDocument);
static bool IsRootDocument(Document* aDocument);
/**
* Return true if the given document is content document (not chrome).
*/
static bool IsContentDocument(Document *aDocument);
static bool IsContentDocument(Document* aDocument);
/**
* Return true if the given document node is for tab document accessible.
*/
static bool IsTabDocument(Document *aDocumentNode);
static bool IsTabDocument(Document* aDocumentNode);
/**
* Return true if the given document is an error page.
*/
static bool IsErrorPage(Document *aDocument);
static bool IsErrorPage(Document* aDocument);
/**
* Return presShell for the document containing the given DOM node.
*/
static PresShell *GetPresShellFor(nsINode *aNode) {
static PresShell* GetPresShellFor(nsINode* aNode) {
return aNode->OwnerDoc()->GetPresShell();
}
@@ -226,13 +226,13 @@ class nsCoreUtils {
* @param aID Where to put ID string
* @return true if there is an ID set for this node
*/
static bool GetID(nsIContent *aContent, nsAString &aID);
static bool GetID(nsIContent* aContent, nsAString& aID);
/**
* Convert attribute value of the given node to positive integer. If no
* attribute or wrong value then false is returned.
*/
static bool GetUIntAttr(nsIContent *aContent, nsAtom *aAttr, int32_t *aUInt);
static bool GetUIntAttr(nsIContent* aContent, nsAtom* aAttr, int32_t* aUInt);
/**
* Returns language for the given node.
@@ -241,59 +241,59 @@ class nsCoreUtils {
* @param aRootContent [in] container of the given node
* @param aLanguage [out] language
*/
static void GetLanguageFor(nsIContent *aContent, nsIContent *aRootContent,
nsAString &aLanguage);
static void GetLanguageFor(nsIContent* aContent, nsIContent* aRootContent,
nsAString& aLanguage);
/**
* Return tree from any levels DOMNode under the XUL tree.
*/
static mozilla::dom::XULTreeElement *GetTree(nsIContent *aContent);
static mozilla::dom::XULTreeElement* GetTree(nsIContent* aContent);
/**
* Return first sensible column for the given tree box object.
*/
static already_AddRefed<nsTreeColumn> GetFirstSensibleColumn(
mozilla::dom::XULTreeElement *aTree);
mozilla::dom::XULTreeElement* aTree);
/**
* Return sensible columns count for the given tree box object.
*/
static uint32_t GetSensibleColumnCount(mozilla::dom::XULTreeElement *aTree);
static uint32_t GetSensibleColumnCount(mozilla::dom::XULTreeElement* aTree);
/**
* Return sensible column at the given index for the given tree box object.
*/
static already_AddRefed<nsTreeColumn> GetSensibleColumnAt(
mozilla::dom::XULTreeElement *aTree, uint32_t aIndex);
mozilla::dom::XULTreeElement* aTree, uint32_t aIndex);
/**
* Return next sensible column for the given column.
*/
static already_AddRefed<nsTreeColumn> GetNextSensibleColumn(
nsTreeColumn *aColumn);
nsTreeColumn* aColumn);
/**
* Return previous sensible column for the given column.
*/
static already_AddRefed<nsTreeColumn> GetPreviousSensibleColumn(
nsTreeColumn *aColumn);
nsTreeColumn* aColumn);
/**
* Return true if the given column is hidden (i.e. not sensible).
*/
static bool IsColumnHidden(nsTreeColumn *aColumn);
static bool IsColumnHidden(nsTreeColumn* aColumn);
/**
* Scroll content into view.
*/
MOZ_CAN_RUN_SCRIPT
static void ScrollTo(PresShell *aPresShell, nsIContent *aContent,
static void ScrollTo(PresShell* aPresShell, nsIContent* aContent,
uint32_t aScrollType);
/**
* Return true if the given node is table header element.
*/
static bool IsHTMLTableHeader(nsIContent *aContent) {
static bool IsHTMLTableHeader(nsIContent* aContent) {
return aContent->NodeInfo()->Equals(nsGkAtoms::th) ||
(aContent->IsElement() && aContent->AsElement()->HasAttr(
kNameSpaceID_None, nsGkAtoms::scope));
@@ -304,7 +304,7 @@ class nsCoreUtils {
* only. In contrast to nsWhitespaceTokenizer class it takes into account
* non-breaking space (0xa0).
*/
static bool IsWhitespaceString(const nsAString &aString);
static bool IsWhitespaceString(const nsAString& aString);
/**
* Returns true if the given character is whitespace symbol.

View File

@@ -48,7 +48,7 @@ class nsTextEquivUtils {
* @param aRule [in] a given name rule
* @return true if the accessible has the rule
*/
static inline bool HasNameRule(Accessible *aAccessible,
static inline bool HasNameRule(Accessible* aAccessible,
ETextEquivRule aRule) {
return (GetRoleRule(aAccessible->Role()) & aRule) == aRule;
}
@@ -59,15 +59,15 @@ class nsTextEquivUtils {
* @param aAccessible [in] the given accessible
* @param aName [out] accessible name
*/
static nsresult GetNameFromSubtree(const Accessible *aAccessible,
nsAString &aName);
static nsresult GetNameFromSubtree(const Accessible* aAccessible,
nsAString& aName);
/**
* Calculates text equivalent from the subtree. Similar to GetNameFromSubtree.
* However it returns not empty result for things like HTML p.
*/
static void GetTextEquivFromSubtree(const Accessible *aAccessible,
nsString &aTextEquiv) {
static void GetTextEquivFromSubtree(const Accessible* aAccessible,
nsString& aTextEquiv) {
aTextEquiv.Truncate();
AppendFromAccessibleChildren(aAccessible, &aTextEquiv);
@@ -82,9 +82,9 @@ class nsTextEquivUtils {
* @param aIDRefsAttr [in] IDRefs attribute on DOM node of the accessible
* @param aTextEquiv [out] result text equivalent
*/
static nsresult GetTextEquivFromIDRefs(const Accessible *aAccessible,
nsAtom *aIDRefsAttr,
nsAString &aTextEquiv);
static nsresult GetTextEquivFromIDRefs(const Accessible* aAccessible,
nsAtom* aIDRefsAttr,
nsAString& aTextEquiv);
/**
* Calculates the text equivalent from the given content and its subtree if
@@ -97,9 +97,9 @@ class nsTextEquivUtils {
* computed from
* @param aString [in, out] the string
*/
static nsresult AppendTextEquivFromContent(const Accessible *aInitiatorAcc,
nsIContent *aContent,
nsAString *aString);
static nsresult AppendTextEquivFromContent(const Accessible* aInitiatorAcc,
nsIContent* aContent,
nsAString* aString);
/**
* Calculates the text equivalent from the given text content (may be text
@@ -108,46 +108,46 @@ class nsTextEquivUtils {
* @param aContent [in] the text content
* @param aString [in, out] the string
*/
static nsresult AppendTextEquivFromTextContent(nsIContent *aContent,
nsAString *aString);
static nsresult AppendTextEquivFromTextContent(nsIContent* aContent,
nsAString* aString);
private:
/**
* Iterates accessible children and calculates text equivalent from each
* child.
*/
static nsresult AppendFromAccessibleChildren(const Accessible *aAccessible,
nsAString *aString);
static nsresult AppendFromAccessibleChildren(const Accessible* aAccessible,
nsAString* aString);
/**
* Calculates text equivalent from the given accessible and its subtree if
* allowed.
*/
static nsresult AppendFromAccessible(Accessible *aAccessible,
nsAString *aString);
static nsresult AppendFromAccessible(Accessible* aAccessible,
nsAString* aString);
/**
* Calculates text equivalent from the value of given accessible.
*/
static nsresult AppendFromValue(Accessible *aAccessible, nsAString *aString);
static nsresult AppendFromValue(Accessible* aAccessible, nsAString* aString);
/**
* Iterates DOM children and calculates text equivalent from each child node.
*/
static nsresult AppendFromDOMChildren(nsIContent *aContent,
nsAString *aString);
static nsresult AppendFromDOMChildren(nsIContent* aContent,
nsAString* aString);
/**
* Calculates text equivalent from the given DOM node and its subtree if
* allowed.
*/
static nsresult AppendFromDOMNode(nsIContent *aContent, nsAString *aString);
static nsresult AppendFromDOMNode(nsIContent* aContent, nsAString* aString);
/**
* Concatenates strings and appends space between them. Returns true if
* text equivalent string was appended.
*/
static bool AppendString(nsAString *aString,
const nsAString &aTextEquivalent);
static bool AppendString(nsAString* aString,
const nsAString& aTextEquivalent);
/**
* Returns the rule (constant of ETextEquivRule) for a given role.

View File

@@ -7,11 +7,11 @@
#include "ISimpleDOM.h"
HRESULT STDMETHODCALLTYPE ISimpleDOMNode_get_localInterface_Proxy(
ISimpleDOMNode *This, void **localInterface) {
ISimpleDOMNode* This, void** localInterface) {
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE ISimpleDOMNode_get_localInterface_Stub(
ISimpleDOMNode *This, IUnknown **localInterface) {
ISimpleDOMNode* This, IUnknown** localInterface) {
return E_NOTIMPL;
}

View File

@@ -14,8 +14,8 @@
namespace mozilla {
namespace a11y {
HandlerTextLeaf::HandlerTextLeaf(IDispatch *aParent, long aIndexInParent,
HWND aHwnd, AccChildData &aData)
HandlerTextLeaf::HandlerTextLeaf(IDispatch* aParent, long aIndexInParent,
HWND aHwnd, AccChildData& aData)
: mParent(aParent),
mIndexInParent(aIndexInParent),
mHwnd(aHwnd),
@@ -39,31 +39,31 @@ IMPL_IUNKNOWN_QUERY_TAIL
/*** IDispatch ***/
HRESULT
HandlerTextLeaf::GetTypeInfoCount(UINT *pctinfo) { return E_NOTIMPL; }
HandlerTextLeaf::GetTypeInfoCount(UINT* pctinfo) { return E_NOTIMPL; }
HRESULT
HandlerTextLeaf::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) {
HandlerTextLeaf::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId) {
HandlerTextLeaf::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames,
LCID lcid, DISPID* rgDispId) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
UINT *puArgErr) {
WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo,
UINT* puArgErr) {
return E_NOTIMPL;
}
/*** IAccessible ***/
HRESULT
HandlerTextLeaf::get_accParent(IDispatch **ppdispParent) {
HandlerTextLeaf::get_accParent(IDispatch** ppdispParent) {
if (!ppdispParent) {
return E_INVALIDARG;
}
@@ -74,7 +74,7 @@ HandlerTextLeaf::get_accParent(IDispatch **ppdispParent) {
}
HRESULT
HandlerTextLeaf::get_accChildCount(long *pcountChildren) {
HandlerTextLeaf::get_accChildCount(long* pcountChildren) {
if (!pcountChildren) {
return E_INVALIDARG;
}
@@ -84,12 +84,12 @@ HandlerTextLeaf::get_accChildCount(long *pcountChildren) {
}
HRESULT
HandlerTextLeaf::get_accChild(VARIANT varChild, IDispatch **ppdispChild) {
HandlerTextLeaf::get_accChild(VARIANT varChild, IDispatch** ppdispChild) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_accName(VARIANT varChild, BSTR *pszName) {
HandlerTextLeaf::get_accName(VARIANT varChild, BSTR* pszName) {
if (varChild.lVal != CHILDID_SELF || !pszName) {
return E_INVALIDARG;
}
@@ -99,17 +99,17 @@ HandlerTextLeaf::get_accName(VARIANT varChild, BSTR *pszName) {
}
HRESULT
HandlerTextLeaf::get_accValue(VARIANT varChild, BSTR *pszValue) {
HandlerTextLeaf::get_accValue(VARIANT varChild, BSTR* pszValue) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_accDescription(VARIANT varChild, BSTR *pszDescription) {
HandlerTextLeaf::get_accDescription(VARIANT varChild, BSTR* pszDescription) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_accRole(VARIANT varChild, VARIANT *pvarRole) {
HandlerTextLeaf::get_accRole(VARIANT varChild, VARIANT* pvarRole) {
if (varChild.lVal != CHILDID_SELF || !pvarRole) {
return E_INVALIDARG;
}
@@ -120,7 +120,7 @@ HandlerTextLeaf::get_accRole(VARIANT varChild, VARIANT *pvarRole) {
}
HRESULT
HandlerTextLeaf::get_accState(VARIANT varChild, VARIANT *pvarState) {
HandlerTextLeaf::get_accState(VARIANT varChild, VARIANT* pvarState) {
if (varChild.lVal != CHILDID_SELF || !pvarState) {
return E_INVALIDARG;
}
@@ -131,31 +131,31 @@ HandlerTextLeaf::get_accState(VARIANT varChild, VARIANT *pvarState) {
}
HRESULT
HandlerTextLeaf::get_accHelp(VARIANT varChild, BSTR *pszHelp) {
HandlerTextLeaf::get_accHelp(VARIANT varChild, BSTR* pszHelp) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_accHelpTopic(BSTR *pszHelpFile, VARIANT varChild,
long *pidTopic) {
HandlerTextLeaf::get_accHelpTopic(BSTR* pszHelpFile, VARIANT varChild,
long* pidTopic) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_accKeyboardShortcut(VARIANT varChild,
BSTR *pszKeyboardShortcut) {
BSTR* pszKeyboardShortcut) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_accFocus(VARIANT *pvarChild) { return E_NOTIMPL; }
HandlerTextLeaf::get_accFocus(VARIANT* pvarChild) { return E_NOTIMPL; }
HRESULT
HandlerTextLeaf::get_accSelection(VARIANT *pvarChildren) { return E_NOTIMPL; }
HandlerTextLeaf::get_accSelection(VARIANT* pvarChildren) { return E_NOTIMPL; }
HRESULT
HandlerTextLeaf::get_accDefaultAction(VARIANT varChild,
BSTR *pszDefaultAction) {
BSTR* pszDefaultAction) {
return E_NOTIMPL;
}
@@ -165,8 +165,8 @@ HandlerTextLeaf::accSelect(long flagsSelect, VARIANT varChild) {
}
HRESULT
HandlerTextLeaf::accLocation(long *pxLeft, long *pyTop, long *pcxWidth,
long *pcyHeight, VARIANT varChild) {
HandlerTextLeaf::accLocation(long* pxLeft, long* pyTop, long* pcxWidth,
long* pcyHeight, VARIANT varChild) {
if (varChild.lVal != CHILDID_SELF || !pxLeft || !pyTop || !pcxWidth ||
!pcyHeight) {
return E_INVALIDARG;
@@ -181,12 +181,12 @@ HandlerTextLeaf::accLocation(long *pxLeft, long *pyTop, long *pcxWidth,
HRESULT
HandlerTextLeaf::accNavigate(long navDir, VARIANT varStart,
VARIANT *pvarEndUpAt) {
VARIANT* pvarEndUpAt) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::accHitTest(long xLeft, long yTop, VARIANT *pvarChild) {
HandlerTextLeaf::accHitTest(long xLeft, long yTop, VARIANT* pvarChild) {
return E_NOTIMPL;
}
@@ -206,23 +206,23 @@ HandlerTextLeaf::put_accValue(VARIANT varChild, BSTR szValue) {
/*** IAccessible2 ***/
HRESULT
HandlerTextLeaf::get_nRelations(long *nRelations) { return E_NOTIMPL; }
HandlerTextLeaf::get_nRelations(long* nRelations) { return E_NOTIMPL; }
HRESULT
HandlerTextLeaf::get_relation(long relationIndex,
IAccessibleRelation **relation) {
IAccessibleRelation** relation) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_relations(long maxRelations,
IAccessibleRelation **relations,
long *nRelations) {
IAccessibleRelation** relations,
long* nRelations) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::role(long *role) {
HandlerTextLeaf::role(long* role) {
if (!role) {
return E_INVALIDARG;
}
@@ -241,13 +241,13 @@ HandlerTextLeaf::scrollToPoint(IA2CoordinateType coordinateType, long x,
}
HRESULT
HandlerTextLeaf::get_groupPosition(long *groupLevel, long *similarItemsInGroup,
long *positionInGroup) {
HandlerTextLeaf::get_groupPosition(long* groupLevel, long* similarItemsInGroup,
long* positionInGroup) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_states(AccessibleStates *states) {
HandlerTextLeaf::get_states(AccessibleStates* states) {
if (!states) {
return E_INVALIDARG;
}
@@ -257,34 +257,34 @@ HandlerTextLeaf::get_states(AccessibleStates *states) {
}
HRESULT
HandlerTextLeaf::get_extendedRole(BSTR *extendedRole) { return E_NOTIMPL; }
HandlerTextLeaf::get_extendedRole(BSTR* extendedRole) { return E_NOTIMPL; }
HRESULT
HandlerTextLeaf::get_localizedExtendedRole(BSTR *localizedExtendedRole) {
HandlerTextLeaf::get_localizedExtendedRole(BSTR* localizedExtendedRole) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_nExtendedStates(long *nExtendedStates) {
HandlerTextLeaf::get_nExtendedStates(long* nExtendedStates) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_extendedStates(long maxExtendedStates,
BSTR **extendedStates,
long *nExtendedStates) {
BSTR** extendedStates,
long* nExtendedStates) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_localizedExtendedStates(long maxLocalizedExtendedStates,
BSTR **localizedExtendedStates,
long *nLocalizedExtendedStates) {
BSTR** localizedExtendedStates,
long* nLocalizedExtendedStates) {
return E_NOTIMPL;
}
HRESULT
HandlerTextLeaf::get_uniqueID(long *uniqueID) {
HandlerTextLeaf::get_uniqueID(long* uniqueID) {
if (!uniqueID) {
return E_INVALIDARG;
}
@@ -294,7 +294,7 @@ HandlerTextLeaf::get_uniqueID(long *uniqueID) {
}
HRESULT
HandlerTextLeaf::get_windowHandle(HWND *windowHandle) {
HandlerTextLeaf::get_windowHandle(HWND* windowHandle) {
if (!windowHandle) {
return E_INVALIDARG;
}
@@ -304,7 +304,7 @@ HandlerTextLeaf::get_windowHandle(HWND *windowHandle) {
}
HRESULT
HandlerTextLeaf::get_indexInParent(long *indexInParent) {
HandlerTextLeaf::get_indexInParent(long* indexInParent) {
if (!indexInParent) {
return E_INVALIDARG;
}
@@ -314,16 +314,16 @@ HandlerTextLeaf::get_indexInParent(long *indexInParent) {
}
HRESULT
HandlerTextLeaf::get_locale(IA2Locale *locale) { return E_NOTIMPL; }
HandlerTextLeaf::get_locale(IA2Locale* locale) { return E_NOTIMPL; }
HRESULT
HandlerTextLeaf::get_attributes(BSTR *attributes) { return E_NOTIMPL; }
HandlerTextLeaf::get_attributes(BSTR* attributes) { return E_NOTIMPL; }
/*** IServiceProvider ***/
HRESULT
HandlerTextLeaf::QueryService(REFGUID aServiceId, REFIID aIid,
void **aOutInterface) {
void** aOutInterface) {
if (aIid == IID_IAccessible2) {
RefPtr<IAccessible2> ia2(this);
ia2.forget(aOutInterface);

View File

@@ -20,80 +20,80 @@ namespace a11y {
class HandlerTextLeaf final : public IAccessible2, public IServiceProvider {
public:
explicit HandlerTextLeaf(IDispatch *aParent, long aIndexInParent, HWND aHwnd,
AccChildData &aData);
explicit HandlerTextLeaf(IDispatch* aParent, long aIndexInParent, HWND aHwnd,
AccChildData& aData);
DECL_IUNKNOWN
// IDispatch
STDMETHODIMP GetTypeInfoCount(UINT *pctinfo) override;
STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) override;
STDMETHODIMP GetTypeInfo(UINT iTInfo, LCID lcid,
ITypeInfo **ppTInfo) override;
STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId) override;
ITypeInfo** ppTInfo) override;
STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames,
LCID lcid, DISPID* rgDispId) override;
STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr) override;
DISPPARAMS* pDispParams, VARIANT* pVarResult,
EXCEPINFO* pExcepInfo, UINT* puArgErr) override;
// IAccessible
STDMETHODIMP get_accParent(IDispatch **ppdispParent) override;
STDMETHODIMP get_accChildCount(long *pcountChildren) override;
STDMETHODIMP get_accChild(VARIANT varChild, IDispatch **ppdispChild) override;
STDMETHODIMP get_accName(VARIANT varChild, BSTR *pszName) override;
STDMETHODIMP get_accValue(VARIANT varChild, BSTR *pszValue) override;
STDMETHODIMP get_accParent(IDispatch** ppdispParent) override;
STDMETHODIMP get_accChildCount(long* pcountChildren) override;
STDMETHODIMP get_accChild(VARIANT varChild, IDispatch** ppdispChild) override;
STDMETHODIMP get_accName(VARIANT varChild, BSTR* pszName) override;
STDMETHODIMP get_accValue(VARIANT varChild, BSTR* pszValue) override;
STDMETHODIMP get_accDescription(VARIANT varChild,
BSTR *pszDescription) override;
STDMETHODIMP get_accRole(VARIANT varChild, VARIANT *pvarRole) override;
STDMETHODIMP get_accState(VARIANT varChild, VARIANT *pvarState) override;
STDMETHODIMP get_accHelp(VARIANT varChild, BSTR *pszHelp) override;
STDMETHODIMP get_accHelpTopic(BSTR *pszHelpFile, VARIANT varChild,
long *pidTopic) override;
BSTR* pszDescription) override;
STDMETHODIMP get_accRole(VARIANT varChild, VARIANT* pvarRole) override;
STDMETHODIMP get_accState(VARIANT varChild, VARIANT* pvarState) override;
STDMETHODIMP get_accHelp(VARIANT varChild, BSTR* pszHelp) override;
STDMETHODIMP get_accHelpTopic(BSTR* pszHelpFile, VARIANT varChild,
long* pidTopic) override;
STDMETHODIMP get_accKeyboardShortcut(VARIANT varChild,
BSTR *pszKeyboardShortcut) override;
STDMETHODIMP get_accFocus(VARIANT *pvarChild) override;
STDMETHODIMP get_accSelection(VARIANT *pvarChildren) override;
BSTR* pszKeyboardShortcut) override;
STDMETHODIMP get_accFocus(VARIANT* pvarChild) override;
STDMETHODIMP get_accSelection(VARIANT* pvarChildren) override;
STDMETHODIMP get_accDefaultAction(VARIANT varChild,
BSTR *pszDefaultAction) override;
BSTR* pszDefaultAction) override;
STDMETHODIMP accSelect(long flagsSelect, VARIANT varChild) override;
STDMETHODIMP accLocation(long *pxLeft, long *pyTop, long *pcxWidth,
long *pcyHeight, VARIANT varChild) override;
STDMETHODIMP accLocation(long* pxLeft, long* pyTop, long* pcxWidth,
long* pcyHeight, VARIANT varChild) override;
STDMETHODIMP accNavigate(long navDir, VARIANT varStart,
VARIANT *pvarEndUpAt) override;
STDMETHODIMP accHitTest(long xLeft, long yTop, VARIANT *pvarChild) override;
VARIANT* pvarEndUpAt) override;
STDMETHODIMP accHitTest(long xLeft, long yTop, VARIANT* pvarChild) override;
STDMETHODIMP accDoDefaultAction(VARIANT varChild) override;
STDMETHODIMP put_accName(VARIANT varChild, BSTR szName) override;
STDMETHODIMP put_accValue(VARIANT varChild, BSTR szValue) override;
// IAccessible2
STDMETHODIMP get_nRelations(long *nRelations) override;
STDMETHODIMP get_nRelations(long* nRelations) override;
STDMETHODIMP get_relation(long relationIndex,
IAccessibleRelation **relation) override;
STDMETHODIMP get_relations(long maxRelations, IAccessibleRelation **relations,
long *nRelations) override;
STDMETHODIMP role(long *role) override;
IAccessibleRelation** relation) override;
STDMETHODIMP get_relations(long maxRelations, IAccessibleRelation** relations,
long* nRelations) override;
STDMETHODIMP role(long* role) override;
STDMETHODIMP scrollTo(IA2ScrollType scrollType) override;
STDMETHODIMP scrollToPoint(IA2CoordinateType coordinateType, long x,
long y) override;
STDMETHODIMP get_groupPosition(long *groupLevel, long *similarItemsInGroup,
long *positionInGroup) override;
STDMETHODIMP get_states(AccessibleStates *states) override;
STDMETHODIMP get_extendedRole(BSTR *extendedRole) override;
STDMETHODIMP get_localizedExtendedRole(BSTR *localizedExtendedRole) override;
STDMETHODIMP get_nExtendedStates(long *nExtendedStates) override;
STDMETHODIMP get_extendedStates(long maxExtendedStates, BSTR **extendedStates,
long *nExtendedStates) override;
STDMETHODIMP get_groupPosition(long* groupLevel, long* similarItemsInGroup,
long* positionInGroup) override;
STDMETHODIMP get_states(AccessibleStates* states) override;
STDMETHODIMP get_extendedRole(BSTR* extendedRole) override;
STDMETHODIMP get_localizedExtendedRole(BSTR* localizedExtendedRole) override;
STDMETHODIMP get_nExtendedStates(long* nExtendedStates) override;
STDMETHODIMP get_extendedStates(long maxExtendedStates, BSTR** extendedStates,
long* nExtendedStates) override;
STDMETHODIMP get_localizedExtendedStates(
long maxLocalizedExtendedStates, BSTR **localizedExtendedStates,
long *nLocalizedExtendedStates) override;
STDMETHODIMP get_uniqueID(long *uniqueID) override;
STDMETHODIMP get_windowHandle(HWND *windowHandle) override;
STDMETHODIMP get_indexInParent(long *indexInParent) override;
STDMETHODIMP get_locale(IA2Locale *locale) override;
STDMETHODIMP get_attributes(BSTR *attributes) override;
long maxLocalizedExtendedStates, BSTR** localizedExtendedStates,
long* nLocalizedExtendedStates) override;
STDMETHODIMP get_uniqueID(long* uniqueID) override;
STDMETHODIMP get_windowHandle(HWND* windowHandle) override;
STDMETHODIMP get_indexInParent(long* indexInParent) override;
STDMETHODIMP get_locale(IA2Locale* locale) override;
STDMETHODIMP get_attributes(BSTR* attributes) override;
// IServiceProvider
STDMETHODIMP QueryService(REFGUID aServiceId, REFIID aIid,
void **aOutInterface) override;
void** aOutInterface) override;
private:
~HandlerTextLeaf();

View File

@@ -18,39 +18,39 @@ namespace a11y {
class ia2AccessibleAction : public IAccessibleAction {
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void **);
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleAction
virtual HRESULT STDMETHODCALLTYPE nActions(
/* [retval][out] */ long *nActions);
/* [retval][out] */ long* nActions);
virtual HRESULT STDMETHODCALLTYPE doAction(
/* [in] */ long actionIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_description(
/* [in] */ long actionIndex,
/* [retval][out] */ BSTR *description);
/* [retval][out] */ BSTR* description);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_keyBinding(
/* [in] */ long actionIndex,
/* [in] */ long nMaxBinding,
/* [length_is][length_is][size_is][size_is][out] */ BSTR **keyBinding,
/* [retval][out] */ long *nBinding);
/* [length_is][length_is][size_is][size_is][out] */ BSTR** keyBinding,
/* [retval][out] */ long* nBinding);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_name(
/* [in] */ long actionIndex,
/* [retval][out] */ BSTR *name);
/* [retval][out] */ BSTR* name);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_localizedName(
/* [in] */ long actionIndex,
/* [retval][out] */ BSTR *localizedName);
/* [retval][out] */ BSTR* localizedName);
};
} // namespace a11y
} // namespace mozilla
#define FORWARD_IACCESSIBLEACTION(Class) \
virtual HRESULT STDMETHODCALLTYPE nActions(long *nActions) { \
virtual HRESULT STDMETHODCALLTYPE nActions(long* nActions) { \
return Class::nActions(nActions); \
} \
\
@@ -59,22 +59,22 @@ class ia2AccessibleAction : public IAccessibleAction {
} \
\
virtual HRESULT STDMETHODCALLTYPE get_description(long actionIndex, \
BSTR *description) { \
BSTR* description) { \
return Class::get_description(actionIndex, description); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_keyBinding( \
long actionIndex, long nMaxBinding, BSTR **keyBinding, long *nBinding) { \
long actionIndex, long nMaxBinding, BSTR** keyBinding, long* nBinding) { \
return Class::get_keyBinding(actionIndex, nMaxBinding, keyBinding, \
nBinding); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_name(long actionIndex, BSTR *name) { \
virtual HRESULT STDMETHODCALLTYPE get_name(long actionIndex, BSTR* name) { \
return Class::get_name(actionIndex, name); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_localizedName(long actionIndex, \
BSTR *localizedName) { \
BSTR* localizedName) { \
return Class::get_localizedName(actionIndex, localizedName); \
}

View File

@@ -16,18 +16,18 @@ namespace a11y {
class ia2AccessibleComponent : public IAccessibleComponent {
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void **);
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleComponent
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_locationInParent(
/* [out] */ long *x,
/* [retval][out] */ long *y);
/* [out] */ long* x,
/* [retval][out] */ long* y);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_foreground(
/* [retval][out] */ IA2Color *foreground);
/* [retval][out] */ IA2Color* foreground);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_background(
/* [retval][out] */ IA2Color *background);
/* [retval][out] */ IA2Color* background);
};
} // namespace a11y

View File

@@ -28,7 +28,7 @@ class ia2AccessibleEditableText : public IAccessibleEditableText {
virtual HRESULT STDMETHODCALLTYPE insertText(
/* [in] */ long offset,
/* [in] */ BSTR *text);
/* [in] */ BSTR* text);
virtual HRESULT STDMETHODCALLTYPE cutText(
/* [in] */ long startOffset,
@@ -41,12 +41,12 @@ class ia2AccessibleEditableText : public IAccessibleEditableText {
virtual HRESULT STDMETHODCALLTYPE replaceText(
/* [in] */ long startOffset,
/* [in] */ long endOffset,
/* [in] */ BSTR *text);
/* [in] */ BSTR* text);
virtual HRESULT STDMETHODCALLTYPE setAttributes(
/* [in] */ long startOffset,
/* [in] */ long endOffset,
/* [in] */ BSTR *attributes);
/* [in] */ BSTR* attributes);
};
} // namespace a11y

View File

@@ -20,27 +20,27 @@ class ia2AccessibleHyperlink : public ia2AccessibleAction,
public IAccessibleHyperlink {
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void **);
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleAction
FORWARD_IACCESSIBLEACTION(ia2AccessibleAction)
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_anchor(
/* [in] */ long index,
/* [retval][out] */ VARIANT *anchor);
/* [retval][out] */ VARIANT* anchor);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_anchorTarget(
/* [in] */ long index,
/* [retval][out] */ VARIANT *anchorTarget);
/* [retval][out] */ VARIANT* anchorTarget);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_startIndex(
/* [retval][out] */ long *index);
/* [retval][out] */ long* index);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_endIndex(
/* [retval][out] */ long *index);
/* [retval][out] */ long* index);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_valid(
/* [retval][out] */ boolean *valid);
/* [retval][out] */ boolean* valid);
};
} // namespace a11y

View File

@@ -16,20 +16,20 @@ namespace a11y {
class ia2AccessibleImage : public IAccessibleImage {
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void **);
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleImage
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_description(
/* [retval][out] */ BSTR *description);
/* [retval][out] */ BSTR* description);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_imagePosition(
/* [in] */ enum IA2CoordinateType coordinateType,
/* [out] */ long *x,
/* [retval][out] */ long *y);
/* [out] */ long* x,
/* [retval][out] */ long* y);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_imageSize(
/* [out] */ long *height,
/* [retval][out] */ long *width);
/* [out] */ long* height,
/* [retval][out] */ long* width);
};
} // namespace a11y

View File

@@ -14,9 +14,9 @@
using namespace mozilla::a11y;
ia2AccessibleRelation::ia2AccessibleRelation(RelationType aType, Relation *aRel)
ia2AccessibleRelation::ia2AccessibleRelation(RelationType aType, Relation* aRel)
: mType(aType) {
Accessible *target = nullptr;
Accessible* target = nullptr;
while ((target = aRel->Next())) mTargets.AppendElement(target);
}
@@ -30,7 +30,7 @@ IMPL_IUNKNOWN_QUERY_TAIL
// IAccessibleRelation
STDMETHODIMP
ia2AccessibleRelation::get_relationType(BSTR *aRelationType) {
ia2AccessibleRelation::get_relationType(BSTR* aRelationType) {
if (!aRelationType) return E_INVALIDARG;
*aRelationType = nullptr;
@@ -48,7 +48,7 @@ ia2AccessibleRelation::get_relationType(BSTR *aRelationType) {
}
STDMETHODIMP
ia2AccessibleRelation::get_localizedRelationType(BSTR *aLocalizedRelationType) {
ia2AccessibleRelation::get_localizedRelationType(BSTR* aLocalizedRelationType) {
if (!aLocalizedRelationType) return E_INVALIDARG;
*aLocalizedRelationType = nullptr;
@@ -56,7 +56,7 @@ ia2AccessibleRelation::get_localizedRelationType(BSTR *aLocalizedRelationType) {
}
STDMETHODIMP
ia2AccessibleRelation::get_nTargets(long *aNTargets) {
ia2AccessibleRelation::get_nTargets(long* aNTargets) {
if (!aNTargets) return E_INVALIDARG;
*aNTargets = mTargets.Length();
@@ -64,22 +64,22 @@ ia2AccessibleRelation::get_nTargets(long *aNTargets) {
}
STDMETHODIMP
ia2AccessibleRelation::get_target(long aTargetIndex, IUnknown **aTarget) {
ia2AccessibleRelation::get_target(long aTargetIndex, IUnknown** aTarget) {
if (aTargetIndex < 0 || (uint32_t)aTargetIndex >= mTargets.Length() ||
!aTarget)
return E_INVALIDARG;
AccessibleWrap *target =
static_cast<AccessibleWrap *>(mTargets[aTargetIndex].get());
*aTarget = static_cast<IAccessible *>(target);
AccessibleWrap* target =
static_cast<AccessibleWrap*>(mTargets[aTargetIndex].get());
*aTarget = static_cast<IAccessible*>(target);
(*aTarget)->AddRef();
return S_OK;
}
STDMETHODIMP
ia2AccessibleRelation::get_targets(long aMaxTargets, IUnknown **aTargets,
long *aNTargets) {
ia2AccessibleRelation::get_targets(long aMaxTargets, IUnknown** aTargets,
long* aNTargets) {
if (!aNTargets || !aTargets) return E_INVALIDARG;
*aNTargets = 0;

View File

@@ -21,10 +21,10 @@ namespace a11y {
class ia2AccessibleRelation final : public IAccessibleRelation {
public:
ia2AccessibleRelation(RelationType aType, Relation *aRel);
ia2AccessibleRelation(RelationType aType, Relation* aRel);
ia2AccessibleRelation(RelationType aType,
nsTArray<RefPtr<Accessible>> &&aTargets)
nsTArray<RefPtr<Accessible>>&& aTargets)
: mType(aType), mTargets(std::move(aTargets)) {}
// IUnknown
@@ -32,29 +32,29 @@ class ia2AccessibleRelation final : public IAccessibleRelation {
// IAccessibleRelation
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relationType(
/* [retval][out] */ BSTR *relationType);
/* [retval][out] */ BSTR* relationType);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_localizedRelationType(
/* [retval][out] */ BSTR *localizedRelationType);
/* [retval][out] */ BSTR* localizedRelationType);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nTargets(
/* [retval][out] */ long *nTargets);
/* [retval][out] */ long* nTargets);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_target(
/* [in] */ long targetIndex,
/* [retval][out] */ IUnknown **target);
/* [retval][out] */ IUnknown** target);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_targets(
/* [in] */ long maxTargets,
/* [length_is][size_is][out] */ IUnknown **target,
/* [retval][out] */ long *nTargets);
/* [length_is][size_is][out] */ IUnknown** target,
/* [retval][out] */ long* nTargets);
inline bool HasTargets() const { return mTargets.Length(); }
private:
ia2AccessibleRelation();
ia2AccessibleRelation(const ia2AccessibleRelation &);
ia2AccessibleRelation &operator=(const ia2AccessibleRelation &);
ia2AccessibleRelation(const ia2AccessibleRelation&);
ia2AccessibleRelation& operator=(const ia2AccessibleRelation&);
RelationType mType;
nsTArray<RefPtr<Accessible>> mTargets;
@@ -64,12 +64,12 @@ class ia2AccessibleRelation final : public IAccessibleRelation {
* Gecko to IAccessible2 relation types map.
*/
const WCHAR *const IA2_RELATION_NULL = L"";
const WCHAR* const IA2_RELATION_NULL = L"";
#define RELATIONTYPE(geckoType, name, atkType, msaaType, ia2Type) \
std::pair<RelationType, const WCHAR *const>(RelationType::geckoType, ia2Type),
std::pair<RelationType, const WCHAR* const>(RelationType::geckoType, ia2Type),
static const std::pair<RelationType, const WCHAR *const> sRelationTypePairs[] =
static const std::pair<RelationType, const WCHAR* const> sRelationTypePairs[] =
{
#include "RelationTypeMap.h"
};

View File

@@ -19,101 +19,101 @@ class TableAccessible;
class ia2AccessibleTable : public IAccessibleTable, public IAccessibleTable2 {
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void **);
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleTable
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_accessibleAt(
/* [in] */ long row,
/* [in] */ long column,
/* [retval][out] */ IUnknown **accessible);
/* [retval][out] */ IUnknown** accessible);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_caption(
/* [retval][out] */ IUnknown **accessible);
/* [retval][out] */ IUnknown** accessible);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_childIndex(
/* [in] */ long rowIndex,
/* [in] */ long columnIndex,
/* [retval][out] */ long *childIndex);
/* [retval][out] */ long* childIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnDescription(
/* [in] */ long column,
/* [retval][out] */ BSTR *description);
/* [retval][out] */ BSTR* description);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnExtentAt(
/* [in] */ long row,
/* [in] */ long column,
/* [retval][out] */ long *nColumnsSpanned);
/* [retval][out] */ long* nColumnsSpanned);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnHeader(
/* [out] */ IAccessibleTable **accessibleTable,
/* [retval][out] */ long *startingRowIndex);
/* [out] */ IAccessibleTable** accessibleTable,
/* [retval][out] */ long* startingRowIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnIndex(
/* [in] */ long childIndex,
/* [retval][out] */ long *columnIndex);
/* [retval][out] */ long* columnIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nColumns(
/* [retval][out] */ long *columnCount);
/* [retval][out] */ long* columnCount);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nRows(
/* [retval][out] */ long *rowCount);
/* [retval][out] */ long* rowCount);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelectedChildren(
/* [retval][out] */ long *childCount);
/* [retval][out] */ long* childCount);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelectedColumns(
/* [retval][out] */ long *columnCount);
/* [retval][out] */ long* columnCount);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelectedRows(
/* [retval][out] */ long *rowCount);
/* [retval][out] */ long* rowCount);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowDescription(
/* [in] */ long row,
/* [retval][out] */ BSTR *description);
/* [retval][out] */ BSTR* description);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowExtentAt(
/* [in] */ long row,
/* [in] */ long column,
/* [retval][out] */ long *nRowsSpanned);
/* [retval][out] */ long* nRowsSpanned);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowHeader(
/* [out] */ IAccessibleTable **accessibleTable,
/* [retval][out] */ long *startingColumnIndex);
/* [out] */ IAccessibleTable** accessibleTable,
/* [retval][out] */ long* startingColumnIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowIndex(
/* [in] */ long childIndex,
/* [retval][out] */ long *rowIndex);
/* [retval][out] */ long* rowIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedChildren(
/* [in] */ long maxChildren,
/* [length_is][length_is][size_is][size_is][out] */ long **children,
/* [retval][out] */ long *nChildren);
/* [length_is][length_is][size_is][size_is][out] */ long** children,
/* [retval][out] */ long* nChildren);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedColumns(
/* [in] */ long maxColumns,
/* [length_is][length_is][size_is][size_is][out] */ long **columns,
/* [retval][out] */ long *nColumns);
/* [length_is][length_is][size_is][size_is][out] */ long** columns,
/* [retval][out] */ long* nColumns);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedRows(
/* [in] */ long maxRows,
/* [length_is][length_is][size_is][size_is][out] */ long **rows,
/* [retval][out] */ long *nRows);
/* [length_is][length_is][size_is][size_is][out] */ long** rows,
/* [retval][out] */ long* nRows);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_summary(
/* [retval][out] */ IUnknown **accessible);
/* [retval][out] */ IUnknown** accessible);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_isColumnSelected(
/* [in] */ long column,
/* [retval][out] */ boolean *isSelected);
/* [retval][out] */ boolean* isSelected);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_isRowSelected(
/* [in] */ long row,
/* [retval][out] */ boolean *isSelected);
/* [retval][out] */ boolean* isSelected);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_isSelected(
/* [in] */ long row,
/* [in] */ long column,
/* [retval][out] */ boolean *isSelected);
/* [retval][out] */ boolean* isSelected);
virtual HRESULT STDMETHODCALLTYPE selectRow(
/* [in] */ long row);
@@ -129,41 +129,41 @@ class ia2AccessibleTable : public IAccessibleTable, public IAccessibleTable2 {
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowColumnExtentsAtIndex(
/* [in] */ long index,
/* [out] */ long *row,
/* [out] */ long *column,
/* [out] */ long *rowExtents,
/* [out] */ long *columnExtents,
/* [retval][out] */ boolean *isSelected);
/* [out] */ long* row,
/* [out] */ long* column,
/* [out] */ long* rowExtents,
/* [out] */ long* columnExtents,
/* [retval][out] */ boolean* isSelected);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_modelChange(
/* [retval][out] */ IA2TableModelChange *modelChange);
/* [retval][out] */ IA2TableModelChange* modelChange);
// IAccessibleTable2
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_cellAt(
/* [in] */ long row,
/* [in] */ long column,
/* [out, retval] */ IUnknown **cell);
/* [out, retval] */ IUnknown** cell);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelectedCells(
/* [out, retval] */ long *cellCount);
/* [out, retval] */ long* cellCount);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedCells(
/* [out, size_is(,*nSelectedCells,)] */ IUnknown ***cells,
/* [out, retval] */ long *nSelectedCells);
/* [out, size_is(,*nSelectedCells,)] */ IUnknown*** cells,
/* [out, retval] */ long* nSelectedCells);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedColumns(
/* [out, size_is(,*nColumns)] */ long **selectedColumns,
/* [out, retval] */ long *nColumns);
/* [out, size_is(,*nColumns)] */ long** selectedColumns,
/* [out, retval] */ long* nColumns);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedRows(
/* [out, size_is(,*nRows)] */ long **selectedRows,
/* [out, retval] */ long *nRows);
/* [out, size_is(,*nRows)] */ long** selectedRows,
/* [out, retval] */ long* nRows);
protected:
ia2AccessibleTable(TableAccessible *aTable) : mTable(aTable) {}
ia2AccessibleTable(TableAccessible* aTable) : mTable(aTable) {}
TableAccessible *mTable;
TableAccessible* mTable;
};
} // namespace a11y

View File

@@ -17,48 +17,48 @@ class TableCellAccessible;
class ia2AccessibleTableCell : public IAccessibleTableCell {
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void **);
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleTableCell
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_table(
/* [out, retval] */ IUnknown **table);
/* [out, retval] */ IUnknown** table);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnExtent(
/* [out, retval] */ long *nColumnsSpanned);
/* [out, retval] */ long* nColumnsSpanned);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnHeaderCells(
/* [out, size_is(,*nColumnHeaderCells,)] */ IUnknown ***cellAccessibles,
/* [out, retval] */ long *nColumnHeaderCells);
/* [out, size_is(,*nColumnHeaderCells,)] */ IUnknown*** cellAccessibles,
/* [out, retval] */ long* nColumnHeaderCells);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnIndex(
/* [out, retval] */ long *columnIndex);
/* [out, retval] */ long* columnIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowExtent(
/* [out, retval] */ long *nRowsSpanned);
/* [out, retval] */ long* nRowsSpanned);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowHeaderCells(
/* [out, size_is(,*nRowHeaderCells,)] */ IUnknown ***cellAccessibles,
/* [out, retval] */ long *nRowHeaderCells);
/* [out, size_is(,*nRowHeaderCells,)] */ IUnknown*** cellAccessibles,
/* [out, retval] */ long* nRowHeaderCells);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowIndex(
/* [out, retval] */ long *rowIndex);
/* [out, retval] */ long* rowIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowColumnExtents(
/* [out] */ long *row,
/* [out] */ long *column,
/* [out] */ long *rowExtents,
/* [out] */ long *columnExtents,
/* [out, retval] */ boolean *isSelected);
/* [out] */ long* row,
/* [out] */ long* column,
/* [out] */ long* rowExtents,
/* [out] */ long* columnExtents,
/* [out, retval] */ boolean* isSelected);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_isSelected(
/* [out, retval] */ boolean *isSelected);
/* [out, retval] */ boolean* isSelected);
protected:
ia2AccessibleTableCell(TableCellAccessible *aTableCell)
ia2AccessibleTableCell(TableCellAccessible* aTableCell)
: mTableCell(aTableCell) {}
TableCellAccessible *mTableCell;
TableCellAccessible* mTableCell;
};
} // namespace a11y

View File

@@ -25,60 +25,60 @@ class ia2AccessibleText : public IAccessibleText {
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_attributes(
/* [in] */ long offset,
/* [out] */ long *startOffset,
/* [out] */ long *endOffset,
/* [retval][out] */ BSTR *textAttributes);
/* [out] */ long* startOffset,
/* [out] */ long* endOffset,
/* [retval][out] */ BSTR* textAttributes);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_caretOffset(
/* [retval][out] */ long *offset);
/* [retval][out] */ long* offset);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_characterExtents(
/* [in] */ long offset,
/* [in] */ enum IA2CoordinateType coordType,
/* [out] */ long *x,
/* [out] */ long *y,
/* [out] */ long *width,
/* [retval][out] */ long *height);
/* [out] */ long* x,
/* [out] */ long* y,
/* [out] */ long* width,
/* [retval][out] */ long* height);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelections(
/* [retval][out] */ long *nSelections);
/* [retval][out] */ long* nSelections);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_offsetAtPoint(
/* [in] */ long x,
/* [in] */ long y,
/* [in] */ enum IA2CoordinateType coordType,
/* [retval][out] */ long *offset);
/* [retval][out] */ long* offset);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selection(
/* [in] */ long selectionIndex,
/* [out] */ long *startOffset,
/* [retval][out] */ long *endOffset);
/* [out] */ long* startOffset,
/* [retval][out] */ long* endOffset);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_text(
/* [in] */ long startOffset,
/* [in] */ long endOffset,
/* [retval][out] */ BSTR *text);
/* [retval][out] */ BSTR* text);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textBeforeOffset(
/* [in] */ long offset,
/* [in] */ enum IA2TextBoundaryType boundaryType,
/* [out] */ long *startOffset,
/* [out] */ long *endOffset,
/* [retval][out] */ BSTR *text);
/* [out] */ long* startOffset,
/* [out] */ long* endOffset,
/* [retval][out] */ BSTR* text);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAfterOffset(
/* [in] */ long offset,
/* [in] */ enum IA2TextBoundaryType boundaryType,
/* [out] */ long *startOffset,
/* [out] */ long *endOffset,
/* [retval][out] */ BSTR *text);
/* [out] */ long* startOffset,
/* [out] */ long* endOffset,
/* [retval][out] */ BSTR* text);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_textAtOffset(
/* [in] */ long offset,
/* [in] */ enum IA2TextBoundaryType boundaryType,
/* [out] */ long *startOffset,
/* [out] */ long *endOffset,
/* [retval][out] */ BSTR *text);
/* [out] */ long* startOffset,
/* [out] */ long* endOffset,
/* [retval][out] */ BSTR* text);
virtual HRESULT STDMETHODCALLTYPE removeSelection(
/* [in] */ long selectionIndex);
@@ -92,7 +92,7 @@ class ia2AccessibleText : public IAccessibleText {
/* [in] */ long endOffset);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nCharacters(
/* [retval][out] */ long *nCharacters);
/* [retval][out] */ long* nCharacters);
virtual HRESULT STDMETHODCALLTYPE scrollSubstringTo(
/* [in] */ long startIndex,
@@ -107,14 +107,14 @@ class ia2AccessibleText : public IAccessibleText {
/* [in] */ long y);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_newText(
/* [retval][out] */ IA2TextSegment *newText);
/* [retval][out] */ IA2TextSegment* newText);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_oldText(
/* [retval][out] */ IA2TextSegment *oldText);
/* [retval][out] */ IA2TextSegment* oldText);
static void InitTextChangeData();
static void UpdateTextChangeData(HyperTextAccessibleWrap *aAcc, bool aInsert,
const nsString &aStr, int32_t aStart,
static void UpdateTextChangeData(HyperTextAccessibleWrap* aAcc, bool aInsert,
const nsString& aStr, int32_t aStart,
uint32_t aLen);
protected:
@@ -125,7 +125,7 @@ class ia2AccessibleText : public IAccessibleText {
static uint32_t sLastTextChangeEnd;
private:
HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment *aNewText);
HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment* aNewText);
AccessibleTextBoundary GetGeckoTextBoundary(
enum IA2TextBoundaryType coordinateType);
};
@@ -140,58 +140,58 @@ class ia2AccessibleText : public IAccessibleText {
} \
\
virtual HRESULT STDMETHODCALLTYPE get_attributes( \
long offset, long *startOffset, long *endOffset, BSTR *textAttributes) { \
long offset, long* startOffset, long* endOffset, BSTR* textAttributes) { \
return Class::get_attributes(offset, startOffset, endOffset, \
textAttributes); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_caretOffset(long *offset) { \
virtual HRESULT STDMETHODCALLTYPE get_caretOffset(long* offset) { \
return Class::get_caretOffset(offset); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_characterExtents( \
long offset, enum IA2CoordinateType coordType, long *x, long *y, \
long *width, long *height) { \
long offset, enum IA2CoordinateType coordType, long* x, long* y, \
long* width, long* height) { \
return Class::get_characterExtents(offset, coordType, x, y, width, \
height); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_nSelections(long *nSelections) { \
virtual HRESULT STDMETHODCALLTYPE get_nSelections(long* nSelections) { \
return Class::get_nSelections(nSelections); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_offsetAtPoint( \
long x, long y, enum IA2CoordinateType coordType, long *offset) { \
long x, long y, enum IA2CoordinateType coordType, long* offset) { \
return Class::get_offsetAtPoint(x, y, coordType, offset); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_selection( \
long selectionIndex, long *startOffset, long *endOffset) { \
long selectionIndex, long* startOffset, long* endOffset) { \
return Class::get_selection(selectionIndex, startOffset, endOffset); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_text(long startOffset, long endOffset, \
BSTR *text) { \
BSTR* text) { \
return Class::get_text(startOffset, endOffset, text); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_textBeforeOffset( \
long offset, enum IA2TextBoundaryType boundaryType, long *startOffset, \
long *endOffset, BSTR *text) { \
long offset, enum IA2TextBoundaryType boundaryType, long* startOffset, \
long* endOffset, BSTR* text) { \
return Class::get_textBeforeOffset(offset, boundaryType, startOffset, \
endOffset, text); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_textAfterOffset( \
long offset, enum IA2TextBoundaryType boundaryType, long *startOffset, \
long *endOffset, BSTR *text) { \
long offset, enum IA2TextBoundaryType boundaryType, long* startOffset, \
long* endOffset, BSTR* text) { \
return Class::get_textAfterOffset(offset, boundaryType, startOffset, \
endOffset, text); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_textAtOffset( \
long offset, enum IA2TextBoundaryType boundaryType, long *startOffset, \
long *endOffset, BSTR *text) { \
long offset, enum IA2TextBoundaryType boundaryType, long* startOffset, \
long* endOffset, BSTR* text) { \
return Class::get_textAtOffset(offset, boundaryType, startOffset, \
endOffset, text); \
} \
@@ -209,7 +209,7 @@ class ia2AccessibleText : public IAccessibleText {
return Class::setSelection(selectionIndex, startOffset, endOffset); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_nCharacters(long *nCharacters) { \
virtual HRESULT STDMETHODCALLTYPE get_nCharacters(long* nCharacters) { \
return Class::get_nCharacters(nCharacters); \
} \
\
@@ -225,11 +225,11 @@ class ia2AccessibleText : public IAccessibleText {
x, y); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_newText(IA2TextSegment *newText) { \
virtual HRESULT STDMETHODCALLTYPE get_newText(IA2TextSegment* newText) { \
return Class::get_newText(newText); \
} \
\
virtual HRESULT STDMETHODCALLTYPE get_oldText(IA2TextSegment *oldText) { \
virtual HRESULT STDMETHODCALLTYPE get_oldText(IA2TextSegment* oldText) { \
return Class::get_oldText(oldText); \
}

View File

@@ -16,20 +16,20 @@ namespace a11y {
class ia2AccessibleValue : public IAccessibleValue {
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void **);
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleValue
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_currentValue(
/* [retval][out] */ VARIANT *currentValue);
/* [retval][out] */ VARIANT* currentValue);
virtual HRESULT STDMETHODCALLTYPE setCurrentValue(
/* [in] */ VARIANT value);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_maximumValue(
/* [retval][out] */ VARIANT *maximumValue);
/* [retval][out] */ VARIANT* maximumValue);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_minimumValue(
/* [retval][out] */ VARIANT *minimumValue);
/* [retval][out] */ VARIANT* minimumValue);
};
} // namespace a11y

View File

@@ -37,92 +37,92 @@ class AccessibleWrap : public Accessible,
public ia2AccessibleHyperlink,
public ia2AccessibleValue {
public: // construction, destruction
AccessibleWrap(nsIContent *aContent, DocAccessible *aDoc);
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
public: // IUnknown methods - see iunknown.h for documentation
STDMETHODIMP QueryInterface(REFIID, void **) override;
STDMETHODIMP QueryInterface(REFIID, void**) override;
// Return the registered OLE class ID of this object's CfDataObj.
CLSID GetClassID() const;
public: // COM interface IAccessible
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent(
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
/* [retval][out] */ IDispatch __RPC_FAR* __RPC_FAR* ppdispParent)
override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChildCount(
/* [retval][out] */ long __RPC_FAR *pcountChildren) override;
/* [retval][out] */ long __RPC_FAR* pcountChildren) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChild(
/* [in] */ VARIANT varChild,
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild) override;
/* [retval][out] */ IDispatch __RPC_FAR* __RPC_FAR* ppdispChild) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accName(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszName) override;
/* [retval][out] */ BSTR __RPC_FAR* pszName) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszValue) override;
/* [retval][out] */ BSTR __RPC_FAR* pszValue) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accDescription(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszDescription) override;
/* [retval][out] */ BSTR __RPC_FAR* pszDescription) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accRole(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ VARIANT __RPC_FAR *pvarRole) override;
/* [retval][out] */ VARIANT __RPC_FAR* pvarRole) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accState(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ VARIANT __RPC_FAR *pvarState) override;
/* [retval][out] */ VARIANT __RPC_FAR* pvarState) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accHelp(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszHelp) override;
/* [retval][out] */ BSTR __RPC_FAR* pszHelp) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accHelpTopic(
/* [out] */ BSTR __RPC_FAR *pszHelpFile,
/* [out] */ BSTR __RPC_FAR* pszHelpFile,
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ long __RPC_FAR *pidTopic) override;
/* [retval][out] */ long __RPC_FAR* pidTopic) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accKeyboardShortcut(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszKeyboardShortcut) override;
/* [retval][out] */ BSTR __RPC_FAR* pszKeyboardShortcut) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accFocus(
/* [retval][out] */ VARIANT __RPC_FAR *pvarChild) override;
/* [retval][out] */ VARIANT __RPC_FAR* pvarChild) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accSelection(
/* [retval][out] */ VARIANT __RPC_FAR *pvarChildren) override;
/* [retval][out] */ VARIANT __RPC_FAR* pvarChildren) override;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accDefaultAction(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszDefaultAction) override;
/* [retval][out] */ BSTR __RPC_FAR* pszDefaultAction) override;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE accSelect(
/* [in] */ long flagsSelect,
/* [optional][in] */ VARIANT varChild) override;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE accLocation(
/* [out] */ long __RPC_FAR *pxLeft,
/* [out] */ long __RPC_FAR *pyTop,
/* [out] */ long __RPC_FAR *pcxWidth,
/* [out] */ long __RPC_FAR *pcyHeight,
/* [out] */ long __RPC_FAR* pxLeft,
/* [out] */ long __RPC_FAR* pyTop,
/* [out] */ long __RPC_FAR* pcxWidth,
/* [out] */ long __RPC_FAR* pcyHeight,
/* [optional][in] */ VARIANT varChild) override;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE accNavigate(
/* [in] */ long navDir,
/* [optional][in] */ VARIANT varStart,
/* [retval][out] */ VARIANT __RPC_FAR *pvarEndUpAt) override;
/* [retval][out] */ VARIANT __RPC_FAR* pvarEndUpAt) override;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE accHitTest(
/* [in] */ long xLeft,
/* [in] */ long yTop,
/* [retval][out] */ VARIANT __RPC_FAR *pvarChild) override;
/* [retval][out] */ VARIANT __RPC_FAR* pvarChild) override;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE accDoDefaultAction(
/* [optional][in] */ VARIANT varChild) override;
@@ -136,32 +136,32 @@ class AccessibleWrap : public Accessible,
/* [in] */ BSTR szValue) override;
// IDispatch (support of scripting languages like VB)
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo) override;
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT* pctinfo) override;
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid,
ITypeInfo **ppTInfo) override;
ITypeInfo** ppTInfo) override;
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid,
LPOLESTR *rgszNames,
LPOLESTR* rgszNames,
UINT cNames, LCID lcid,
DISPID *rgDispId) override;
DISPID* rgDispId) override;
virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid,
LCID lcid, WORD wFlags,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
UINT *puArgErr) override;
DISPPARAMS* pDispParams,
VARIANT* pVarResult,
EXCEPINFO* pExcepInfo,
UINT* puArgErr) override;
// Accessible
virtual nsresult HandleAccEvent(AccEvent *aEvent) override;
virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
virtual void Shutdown() override;
// Helper methods
static int32_t GetChildIDFor(Accessible *aAccessible);
static HWND GetHWNDFor(Accessible *aAccessible);
static int32_t GetChildIDFor(Accessible* aAccessible);
static HWND GetHWNDFor(Accessible* aAccessible);
static void FireWinEvent(Accessible *aTarget, uint32_t aEventType);
static void FireWinEvent(Accessible* aTarget, uint32_t aEventType);
/**
* System caret support: update the Windows caret position.
@@ -170,13 +170,13 @@ class AccessibleWrap : public Accessible,
* We will use an invisible system caret.
* Gecko is still responsible for drawing its own caret
*/
void UpdateSystemCaretFor(Accessible *aAccessible);
static void UpdateSystemCaretFor(ProxyAccessible *aProxy,
const LayoutDeviceIntRect &aCaretRect);
void UpdateSystemCaretFor(Accessible* aAccessible);
static void UpdateSystemCaretFor(ProxyAccessible* aProxy,
const LayoutDeviceIntRect& aCaretRect);
private:
static void UpdateSystemCaretFor(HWND aCaretWnd,
const LayoutDeviceIntRect &aCaretRect);
const LayoutDeviceIntRect& aCaretRect);
public:
/**
@@ -188,11 +188,11 @@ class AccessibleWrap : public Accessible,
* Find an accessible by the given child ID in cached documents.
*/
MOZ_MUST_USE already_AddRefed<IAccessible> GetIAccessibleFor(
const VARIANT &aVarChild, bool *aIsDefunct);
const VARIANT& aVarChild, bool* aIsDefunct);
virtual void GetNativeInterface(void **aOutAccessible) override;
virtual void GetNativeInterface(void** aOutAccessible) override;
static IDispatch *NativeAccessible(Accessible *aAccessible);
static IDispatch* NativeAccessible(Accessible* aAccessible);
uint32_t GetExistingID() const { return mID; }
static const uint32_t kNoID = 0;
@@ -205,11 +205,11 @@ class AccessibleWrap : public Accessible,
static void InvalidateHandlers();
bool DispatchTextChangeToHandler(bool aIsInsert, const nsString &aText,
bool DispatchTextChangeToHandler(bool aIsInsert, const nsString& aText,
int32_t aStart, uint32_t aLen);
static void AssignChildIDTo(NotNull<sdnAccessible *> aSdnAcc);
static void ReleaseChildID(NotNull<sdnAccessible *> aSdnAcc);
static void AssignChildIDTo(NotNull<sdnAccessible*> aSdnAcc);
static void ReleaseChildID(NotNull<sdnAccessible*> aSdnAcc);
protected:
virtual ~AccessibleWrap();
@@ -217,25 +217,25 @@ class AccessibleWrap : public Accessible,
uint32_t mID;
HRESULT
ResolveChild(const VARIANT &aVarChild, IAccessible **aOutInterface);
ResolveChild(const VARIANT& aVarChild, IAccessible** aOutInterface);
/**
* Find a remote accessible by the given child ID.
*/
MOZ_MUST_USE already_AddRefed<IAccessible> GetRemoteIAccessibleFor(
const VARIANT &aVarChild);
const VARIANT& aVarChild);
/**
* Return the wrapper for the document's proxy.
*/
DocProxyAccessibleWrap *DocProxyWrapper() const;
DocProxyAccessibleWrap* DocProxyWrapper() const;
/**
* Creates ITypeInfo for LIBID_Accessibility if it's needed and returns it.
*/
static ITypeInfo *GetTI(LCID lcid);
static ITypeInfo* GetTI(LCID lcid);
static ITypeInfo *gTypeInfo;
static ITypeInfo* gTypeInfo;
static MsaaIdGenerator sIDGen;
@@ -268,21 +268,21 @@ class AccessibleWrap : public Accessible,
};
struct HandlerControllerData final {
HandlerControllerData(DWORD aPid, RefPtr<IHandlerControl> &&aCtrl)
HandlerControllerData(DWORD aPid, RefPtr<IHandlerControl>&& aCtrl)
: mPid(aPid), mCtrl(std::move(aCtrl)) {
mIsProxy = mozilla::mscom::IsProxy(mCtrl);
}
HandlerControllerData(HandlerControllerData &&aOther)
HandlerControllerData(HandlerControllerData&& aOther)
: mPid(aOther.mPid),
mIsProxy(aOther.mIsProxy),
mCtrl(std::move(aOther.mCtrl)) {}
bool operator==(const HandlerControllerData &aOther) const {
bool operator==(const HandlerControllerData& aOther) const {
return mPid == aOther.mPid;
}
bool operator==(const DWORD &aPid) const { return mPid == aPid; }
bool operator==(const DWORD& aPid) const { return mPid == aPid; }
DWORD mPid;
bool mIsProxy;
@@ -292,8 +292,8 @@ class AccessibleWrap : public Accessible,
static StaticAutoPtr<nsTArray<HandlerControllerData>> sHandlerControllers;
};
static inline AccessibleWrap *WrapperFor(const ProxyAccessible *aProxy) {
return reinterpret_cast<AccessibleWrap *>(aProxy->GetWrapper());
static inline AccessibleWrap* WrapperFor(const ProxyAccessible* aProxy) {
return reinterpret_cast<AccessibleWrap*>(aProxy->GetWrapper());
}
} // namespace a11y

View File

@@ -27,20 +27,20 @@ class ApplicationAccessibleWrap : public ApplicationAccessible,
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void **);
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleApplication
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_appName(
/* [retval][out] */ BSTR *name);
/* [retval][out] */ BSTR* name);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_appVersion(
/* [retval][out] */ BSTR *version);
/* [retval][out] */ BSTR* version);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_toolkitName(
/* [retval][out] */ BSTR *name);
/* [retval][out] */ BSTR* name);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_toolkitVersion(
/* [retval][out] */ BSTR *version);
/* [retval][out] */ BSTR* version);
};
} // namespace a11y

View File

@@ -40,7 +40,7 @@ already_AddRefed<IAccessible> LazyInstantiator::GetRootAccessible(HWND aHwnd) {
// To track this, we set the kLazyInstantiatorProp on the HWND with a pointer
// to an existing instance. We only create a new LazyInstatiator if that prop
// has not already been set.
LazyInstantiator *existingInstantiator = reinterpret_cast<LazyInstantiator *>(
LazyInstantiator* existingInstantiator = reinterpret_cast<LazyInstantiator*>(
::GetProp(aHwnd, kLazyInstantiatorProp));
RefPtr<IAccessible> result;
@@ -63,7 +63,7 @@ already_AddRefed<IAccessible> LazyInstantiator::GetRootAccessible(HWND aHwnd) {
}
// a11y is running, so we just resolve the real root accessible.
a11y::Accessible *rootAcc = widget::WinUtils::GetRootAccessibleForHWND(aHwnd);
a11y::Accessible* rootAcc = widget::WinUtils::GetRootAccessibleForHWND(aHwnd);
if (!rootAcc) {
return nullptr;
}
@@ -80,8 +80,8 @@ already_AddRefed<IAccessible> LazyInstantiator::GetRootAccessible(HWND aHwnd) {
// running). We can bypass LazyInstantiator by retrieving the internal
// unknown (which is not wrapped by the LazyInstantiator) and then querying
// that for IID_IAccessible.
a11y::RootAccessibleWrap *rootWrap =
static_cast<a11y::RootAccessibleWrap *>(rootAcc);
a11y::RootAccessibleWrap* rootWrap =
static_cast<a11y::RootAccessibleWrap*>(rootAcc);
RefPtr<IUnknown> punk(rootWrap->GetInternalUnknown());
MOZ_ASSERT(punk);
@@ -103,7 +103,7 @@ already_AddRefed<IAccessible> LazyInstantiator::GetRootAccessible(HWND aHwnd) {
*/
/* static */
void LazyInstantiator::EnableBlindAggregation(HWND aHwnd) {
LazyInstantiator *existingInstantiator = reinterpret_cast<LazyInstantiator *>(
LazyInstantiator* existingInstantiator = reinterpret_cast<LazyInstantiator*>(
::GetProp(aHwnd, kLazyInstantiatorProp));
if (!existingInstantiator) {
@@ -139,7 +139,7 @@ void LazyInstantiator::ClearProp() {
// Remove ourselves as the designated LazyInstantiator for mHwnd
DebugOnly<HANDLE> removedProp = ::RemoveProp(mHwnd, kLazyInstantiatorProp);
MOZ_ASSERT(!removedProp ||
reinterpret_cast<LazyInstantiator *>(removedProp.value) == this);
reinterpret_cast<LazyInstantiator*>(removedProp.value) == this);
}
/**
@@ -160,7 +160,7 @@ LazyInstantiator::GetClientPid(const DWORD aClientTid) {
struct DllBlockInfo {
// The name of the DLL.
const wchar_t *mName;
const wchar_t* mName;
// If mUntilVersion is ALL_VERSIONS, we'll block all versions of this dll.
// Otherwise, we'll block all versions less than the given version, as queried
@@ -184,7 +184,7 @@ static const DllBlockInfo gBlockedInprocDlls[] = {
/**
* This is the blocklist for known "bad" remote clients that instantiate a11y.
*/
static const char *gBlockedRemoteClients[] = {
static const char* gBlockedRemoteClients[] = {
"tbnotifier.exe" // Ask.com Toolbar, bug 1453876
};
@@ -207,7 +207,7 @@ bool LazyInstantiator::IsBlockedInjection() {
for (size_t index = 0, len = ArrayLength(gBlockedInprocDlls); index < len;
++index) {
const DllBlockInfo &blockedDll = gBlockedInprocDlls[index];
const DllBlockInfo& blockedDll = gBlockedInprocDlls[index];
HMODULE module = ::GetModuleHandleW(blockedDll.mName);
if (!module) {
// This dll isn't loaded.
@@ -265,13 +265,13 @@ bool LazyInstantiator::ShouldInstantiate(const DWORD aClientTid) {
return true;
}
RootAccessibleWrap *LazyInstantiator::ResolveRootAccWrap() {
Accessible *acc = widget::WinUtils::GetRootAccessibleForHWND(mHwnd);
RootAccessibleWrap* LazyInstantiator::ResolveRootAccWrap() {
Accessible* acc = widget::WinUtils::GetRootAccessibleForHWND(mHwnd);
if (!acc || !acc->IsRoot()) {
return nullptr;
}
return static_cast<RootAccessibleWrap *>(acc);
return static_cast<RootAccessibleWrap*>(acc);
}
/**
@@ -320,8 +320,7 @@ LazyInstantiator::MaybeResolveRoot() {
}
// Wrap ourselves around the root accessible wrap
mRealRootUnk =
mWeakRootAccWrap->Aggregate(static_cast<IAccessible *>(this));
mRealRootUnk = mWeakRootAccWrap->Aggregate(static_cast<IAccessible*>(this));
if (!mRealRootUnk) {
return E_FAIL;
}
@@ -332,8 +331,8 @@ LazyInstantiator::MaybeResolveRoot() {
// Now obtain mWeakAccessible which we use to forward our incoming calls
// to the real accesssible.
HRESULT hr = mRealRootUnk->QueryInterface(IID_IAccessible,
(void **)&mWeakAccessible);
HRESULT hr =
mRealRootUnk->QueryInterface(IID_IAccessible, (void**)&mWeakAccessible);
if (FAILED(hr)) {
return hr;
}
@@ -366,7 +365,7 @@ LazyInstantiator::MaybeResolveRoot() {
return E_NOTIMPL;
}
hr = mRealRootUnk->QueryInterface(IID_IAccessible, (void **)&mWeakAccessible);
hr = mRealRootUnk->QueryInterface(IID_IAccessible, (void**)&mWeakAccessible);
if (FAILED(hr)) {
return hr;
}
@@ -460,14 +459,14 @@ LazyInstantiator::ResolveDispatch() {
}
// Now create the standard IDispatch for IAccessible
hr = ::CreateStdDispatch(static_cast<IAccessible *>(this),
static_cast<IAccessible *>(this), accTypeInfo,
hr = ::CreateStdDispatch(static_cast<IAccessible*>(this),
static_cast<IAccessible*>(this), accTypeInfo,
getter_AddRefs(mStdDispatch));
if (FAILED(hr)) {
return hr;
}
hr = mStdDispatch->QueryInterface(IID_IDispatch, (void **)&mWeakDispatch);
hr = mStdDispatch->QueryInterface(IID_IDispatch, (void**)&mWeakDispatch);
if (FAILED(hr)) {
return hr;
}
@@ -491,42 +490,42 @@ LazyInstantiator::ResolveDispatch() {
*/
HRESULT
LazyInstantiator::GetTypeInfoCount(UINT *pctinfo) {
LazyInstantiator::GetTypeInfoCount(UINT* pctinfo) {
RESOLVE_IDISPATCH;
return mWeakDispatch->GetTypeInfoCount(pctinfo);
}
HRESULT
LazyInstantiator::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) {
LazyInstantiator::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) {
RESOLVE_IDISPATCH;
return mWeakDispatch->GetTypeInfo(iTInfo, lcid, ppTInfo);
}
HRESULT
LazyInstantiator::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId) {
LazyInstantiator::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames,
LCID lcid, DISPID* rgDispId) {
RESOLVE_IDISPATCH;
return mWeakDispatch->GetIDsOfNames(riid, rgszNames, cNames, lcid, rgDispId);
}
HRESULT
LazyInstantiator::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
UINT *puArgErr) {
WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo,
UINT* puArgErr) {
RESOLVE_IDISPATCH;
return mWeakDispatch->Invoke(dispIdMember, riid, lcid, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
}
HRESULT
LazyInstantiator::get_accParent(IDispatch **ppdispParent) {
LazyInstantiator::get_accParent(IDispatch** ppdispParent) {
RESOLVE_ROOT;
return mWeakAccessible->get_accParent(ppdispParent);
}
HRESULT
LazyInstantiator::get_accChildCount(long *pcountChildren) {
LazyInstantiator::get_accChildCount(long* pcountChildren) {
if (!pcountChildren) {
return E_INVALIDARG;
}
@@ -536,7 +535,7 @@ LazyInstantiator::get_accChildCount(long *pcountChildren) {
}
HRESULT
LazyInstantiator::get_accChild(VARIANT varChild, IDispatch **ppdispChild) {
LazyInstantiator::get_accChild(VARIANT varChild, IDispatch** ppdispChild) {
if (!ppdispChild) {
return E_INVALIDARG;
}
@@ -546,7 +545,7 @@ LazyInstantiator::get_accChild(VARIANT varChild, IDispatch **ppdispChild) {
}
HRESULT
LazyInstantiator::get_accName(VARIANT varChild, BSTR *pszName) {
LazyInstantiator::get_accName(VARIANT varChild, BSTR* pszName) {
if (!pszName) {
return E_INVALIDARG;
}
@@ -556,7 +555,7 @@ LazyInstantiator::get_accName(VARIANT varChild, BSTR *pszName) {
}
HRESULT
LazyInstantiator::get_accValue(VARIANT varChild, BSTR *pszValue) {
LazyInstantiator::get_accValue(VARIANT varChild, BSTR* pszValue) {
if (!pszValue) {
return E_INVALIDARG;
}
@@ -566,7 +565,7 @@ LazyInstantiator::get_accValue(VARIANT varChild, BSTR *pszValue) {
}
HRESULT
LazyInstantiator::get_accDescription(VARIANT varChild, BSTR *pszDescription) {
LazyInstantiator::get_accDescription(VARIANT varChild, BSTR* pszDescription) {
if (!pszDescription) {
return E_INVALIDARG;
}
@@ -576,7 +575,7 @@ LazyInstantiator::get_accDescription(VARIANT varChild, BSTR *pszDescription) {
}
HRESULT
LazyInstantiator::get_accRole(VARIANT varChild, VARIANT *pvarRole) {
LazyInstantiator::get_accRole(VARIANT varChild, VARIANT* pvarRole) {
if (!pvarRole) {
return E_INVALIDARG;
}
@@ -586,7 +585,7 @@ LazyInstantiator::get_accRole(VARIANT varChild, VARIANT *pvarRole) {
}
HRESULT
LazyInstantiator::get_accState(VARIANT varChild, VARIANT *pvarState) {
LazyInstantiator::get_accState(VARIANT varChild, VARIANT* pvarState) {
if (!pvarState) {
return E_INVALIDARG;
}
@@ -596,19 +595,19 @@ LazyInstantiator::get_accState(VARIANT varChild, VARIANT *pvarState) {
}
HRESULT
LazyInstantiator::get_accHelp(VARIANT varChild, BSTR *pszHelp) {
LazyInstantiator::get_accHelp(VARIANT varChild, BSTR* pszHelp) {
return E_NOTIMPL;
}
HRESULT
LazyInstantiator::get_accHelpTopic(BSTR *pszHelpFile, VARIANT varChild,
long *pidTopic) {
LazyInstantiator::get_accHelpTopic(BSTR* pszHelpFile, VARIANT varChild,
long* pidTopic) {
return E_NOTIMPL;
}
HRESULT
LazyInstantiator::get_accKeyboardShortcut(VARIANT varChild,
BSTR *pszKeyboardShortcut) {
BSTR* pszKeyboardShortcut) {
if (!pszKeyboardShortcut) {
return E_INVALIDARG;
}
@@ -619,7 +618,7 @@ LazyInstantiator::get_accKeyboardShortcut(VARIANT varChild,
}
HRESULT
LazyInstantiator::get_accFocus(VARIANT *pvarChild) {
LazyInstantiator::get_accFocus(VARIANT* pvarChild) {
if (!pvarChild) {
return E_INVALIDARG;
}
@@ -629,7 +628,7 @@ LazyInstantiator::get_accFocus(VARIANT *pvarChild) {
}
HRESULT
LazyInstantiator::get_accSelection(VARIANT *pvarChildren) {
LazyInstantiator::get_accSelection(VARIANT* pvarChildren) {
if (!pvarChildren) {
return E_INVALIDARG;
}
@@ -640,7 +639,7 @@ LazyInstantiator::get_accSelection(VARIANT *pvarChildren) {
HRESULT
LazyInstantiator::get_accDefaultAction(VARIANT varChild,
BSTR *pszDefaultAction) {
BSTR* pszDefaultAction) {
if (!pszDefaultAction) {
return E_INVALIDARG;
}
@@ -656,8 +655,8 @@ LazyInstantiator::accSelect(long flagsSelect, VARIANT varChild) {
}
HRESULT
LazyInstantiator::accLocation(long *pxLeft, long *pyTop, long *pcxWidth,
long *pcyHeight, VARIANT varChild) {
LazyInstantiator::accLocation(long* pxLeft, long* pyTop, long* pcxWidth,
long* pcyHeight, VARIANT varChild) {
RESOLVE_ROOT;
return mWeakAccessible->accLocation(pxLeft, pyTop, pcxWidth, pcyHeight,
varChild);
@@ -665,7 +664,7 @@ LazyInstantiator::accLocation(long *pxLeft, long *pyTop, long *pcxWidth,
HRESULT
LazyInstantiator::accNavigate(long navDir, VARIANT varStart,
VARIANT *pvarEndUpAt) {
VARIANT* pvarEndUpAt) {
if (!pvarEndUpAt) {
return E_INVALIDARG;
}
@@ -675,7 +674,7 @@ LazyInstantiator::accNavigate(long navDir, VARIANT varStart,
}
HRESULT
LazyInstantiator::accHitTest(long xLeft, long yTop, VARIANT *pvarChild) {
LazyInstantiator::accHitTest(long xLeft, long yTop, VARIANT* pvarChild) {
if (!pvarChild) {
return E_INVALIDARG;
}
@@ -702,7 +701,7 @@ LazyInstantiator::put_accValue(VARIANT varChild, BSTR szValue) {
HRESULT
LazyInstantiator::QueryService(REFGUID aServiceId, REFIID aServiceIid,
void **aOutInterface) {
void** aOutInterface) {
if (!aOutInterface) {
return E_INVALIDARG;
}

View File

@@ -35,52 +35,52 @@ class LazyInstantiator final : public IAccessible, public IServiceProvider {
static void EnableBlindAggregation(HWND aHwnd);
// IUnknown
STDMETHODIMP QueryInterface(REFIID aIid, void **aOutInterface) override;
STDMETHODIMP QueryInterface(REFIID aIid, void** aOutInterface) override;
STDMETHODIMP_(ULONG) AddRef() override;
STDMETHODIMP_(ULONG) Release() override;
// IDispatch
STDMETHODIMP GetTypeInfoCount(UINT *pctinfo) override;
STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) override;
STDMETHODIMP GetTypeInfo(UINT iTInfo, LCID lcid,
ITypeInfo **ppTInfo) override;
STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId) override;
ITypeInfo** ppTInfo) override;
STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames,
LCID lcid, DISPID* rgDispId) override;
STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr) override;
DISPPARAMS* pDispParams, VARIANT* pVarResult,
EXCEPINFO* pExcepInfo, UINT* puArgErr) override;
// IAccessible
STDMETHODIMP get_accParent(IDispatch **ppdispParent) override;
STDMETHODIMP get_accChildCount(long *pcountChildren) override;
STDMETHODIMP get_accChild(VARIANT varChild, IDispatch **ppdispChild) override;
STDMETHODIMP get_accName(VARIANT varChild, BSTR *pszName) override;
STDMETHODIMP get_accValue(VARIANT varChild, BSTR *pszValue) override;
STDMETHODIMP get_accParent(IDispatch** ppdispParent) override;
STDMETHODIMP get_accChildCount(long* pcountChildren) override;
STDMETHODIMP get_accChild(VARIANT varChild, IDispatch** ppdispChild) override;
STDMETHODIMP get_accName(VARIANT varChild, BSTR* pszName) override;
STDMETHODIMP get_accValue(VARIANT varChild, BSTR* pszValue) override;
STDMETHODIMP get_accDescription(VARIANT varChild,
BSTR *pszDescription) override;
STDMETHODIMP get_accRole(VARIANT varChild, VARIANT *pvarRole) override;
STDMETHODIMP get_accState(VARIANT varChild, VARIANT *pvarState) override;
STDMETHODIMP get_accHelp(VARIANT varChild, BSTR *pszHelp) override;
STDMETHODIMP get_accHelpTopic(BSTR *pszHelpFile, VARIANT varChild,
long *pidTopic) override;
BSTR* pszDescription) override;
STDMETHODIMP get_accRole(VARIANT varChild, VARIANT* pvarRole) override;
STDMETHODIMP get_accState(VARIANT varChild, VARIANT* pvarState) override;
STDMETHODIMP get_accHelp(VARIANT varChild, BSTR* pszHelp) override;
STDMETHODIMP get_accHelpTopic(BSTR* pszHelpFile, VARIANT varChild,
long* pidTopic) override;
STDMETHODIMP get_accKeyboardShortcut(VARIANT varChild,
BSTR *pszKeyboardShortcut) override;
STDMETHODIMP get_accFocus(VARIANT *pvarChild) override;
STDMETHODIMP get_accSelection(VARIANT *pvarChildren) override;
BSTR* pszKeyboardShortcut) override;
STDMETHODIMP get_accFocus(VARIANT* pvarChild) override;
STDMETHODIMP get_accSelection(VARIANT* pvarChildren) override;
STDMETHODIMP get_accDefaultAction(VARIANT varChild,
BSTR *pszDefaultAction) override;
BSTR* pszDefaultAction) override;
STDMETHODIMP accSelect(long flagsSelect, VARIANT varChild) override;
STDMETHODIMP accLocation(long *pxLeft, long *pyTop, long *pcxWidth,
long *pcyHeight, VARIANT varChild) override;
STDMETHODIMP accLocation(long* pxLeft, long* pyTop, long* pcxWidth,
long* pcyHeight, VARIANT varChild) override;
STDMETHODIMP accNavigate(long navDir, VARIANT varStart,
VARIANT *pvarEndUpAt) override;
STDMETHODIMP accHitTest(long xLeft, long yTop, VARIANT *pvarChild) override;
VARIANT* pvarEndUpAt) override;
STDMETHODIMP accHitTest(long xLeft, long yTop, VARIANT* pvarChild) override;
STDMETHODIMP accDoDefaultAction(VARIANT varChild) override;
STDMETHODIMP put_accName(VARIANT varChild, BSTR szName) override;
STDMETHODIMP put_accValue(VARIANT varChild, BSTR szValue) override;
// IServiceProvider
STDMETHODIMP QueryService(REFGUID aServiceId, REFIID aServiceIid,
void **aOutInterface) override;
void** aOutInterface) override;
private:
explicit LazyInstantiator(HWND aHwnd);
@@ -101,7 +101,7 @@ class LazyInstantiator final : public IAccessible, public IServiceProvider {
*/
HRESULT ResolveDispatch();
RootAccessibleWrap *ResolveRootAccWrap();
RootAccessibleWrap* ResolveRootAccWrap();
void TransplantRefCnt();
void ClearProp();
@@ -118,9 +118,9 @@ class LazyInstantiator final : public IAccessible, public IServiceProvider {
* references to them, we would be holding strong references to ourselves,
* creating a cycle.
*/
RootAccessibleWrap *mWeakRootAccWrap;
IAccessible *mWeakAccessible;
IDispatch *mWeakDispatch;
RootAccessibleWrap* mWeakRootAccWrap;
IAccessible* mWeakAccessible;
IDispatch* mWeakDispatch;
};
} // namespace a11y

View File

@@ -17,7 +17,7 @@ namespace a11y {
class sdnDocAccessible final : public ISimpleDOMDocument {
public:
explicit sdnDocAccessible(DocAccessibleWrap *aAccessible)
explicit sdnDocAccessible(DocAccessibleWrap* aAccessible)
: mAccessible(aAccessible){};
~sdnDocAccessible(){};
@@ -25,23 +25,23 @@ class sdnDocAccessible final : public ISimpleDOMDocument {
// ISimpleDOMDocument
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_URL(
/* [out] */ BSTR __RPC_FAR *url);
/* [out] */ BSTR __RPC_FAR* url);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_title(
/* [out] */ BSTR __RPC_FAR *title);
/* [out] */ BSTR __RPC_FAR* title);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mimeType(
/* [out] */ BSTR __RPC_FAR *mimeType);
/* [out] */ BSTR __RPC_FAR* mimeType);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_docType(
/* [out] */ BSTR __RPC_FAR *docType);
/* [out] */ BSTR __RPC_FAR* docType);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nameSpaceURIForID(
/* [in] */ short nameSpaceID,
/* [out] */ BSTR __RPC_FAR *nameSpaceURI);
/* [out] */ BSTR __RPC_FAR* nameSpaceURI);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE put_alternateViewMediaTypes(
/* [in] */ BSTR __RPC_FAR *commaSeparatedMediaTypes);
/* [in] */ BSTR __RPC_FAR* commaSeparatedMediaTypes);
protected:
RefPtr<DocAccessibleWrap> mAccessible;

View File

@@ -14,21 +14,21 @@
using namespace mozilla::a11y;
nsAccessibleRelation::nsAccessibleRelation(uint32_t aType, Relation *aRel)
nsAccessibleRelation::nsAccessibleRelation(uint32_t aType, Relation* aRel)
: mType(aType) {
mTargets = do_CreateInstance(NS_ARRAY_CONTRACTID);
Accessible *targetAcc = nullptr;
Accessible* targetAcc = nullptr;
while ((targetAcc = aRel->Next()))
mTargets->AppendElement(static_cast<nsIAccessible *>(ToXPC(targetAcc)));
mTargets->AppendElement(static_cast<nsIAccessible*>(ToXPC(targetAcc)));
}
nsAccessibleRelation::nsAccessibleRelation(
uint32_t aType, const nsTArray<ProxyAccessible *> *aTargets)
uint32_t aType, const nsTArray<ProxyAccessible*>* aTargets)
: mType(aType) {
mTargets = do_CreateInstance(NS_ARRAY_CONTRACTID);
for (uint32_t idx = 0; idx < aTargets->Length(); ++idx) {
mTargets->AppendElement(
static_cast<nsIAccessible *>(ToXPC(aTargets->ElementAt(idx))));
static_cast<nsIAccessible*>(ToXPC(aTargets->ElementAt(idx))));
}
}
@@ -39,21 +39,21 @@ NS_IMPL_ISUPPORTS(nsAccessibleRelation, nsIAccessibleRelation)
// nsIAccessibleRelation
NS_IMETHODIMP
nsAccessibleRelation::GetRelationType(uint32_t *aType) {
nsAccessibleRelation::GetRelationType(uint32_t* aType) {
NS_ENSURE_ARG_POINTER(aType);
*aType = mType;
return NS_OK;
}
NS_IMETHODIMP
nsAccessibleRelation::GetTargetsCount(uint32_t *aCount) {
nsAccessibleRelation::GetTargetsCount(uint32_t* aCount) {
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
return mTargets->GetLength(aCount);
}
NS_IMETHODIMP
nsAccessibleRelation::GetTarget(uint32_t aIndex, nsIAccessible **aTarget) {
nsAccessibleRelation::GetTarget(uint32_t aIndex, nsIAccessible** aTarget) {
NS_ENSURE_ARG_POINTER(aTarget);
nsresult rv = NS_OK;
nsCOMPtr<nsIAccessible> target = do_QueryElementAt(mTargets, aIndex, &rv);
@@ -62,7 +62,7 @@ nsAccessibleRelation::GetTarget(uint32_t aIndex, nsIAccessible **aTarget) {
}
NS_IMETHODIMP
nsAccessibleRelation::GetTargets(nsIArray **aTargets) {
nsAccessibleRelation::GetTargets(nsIArray** aTargets) {
NS_ENSURE_ARG_POINTER(aTargets);
NS_ADDREF(*aTargets = mTargets);
return NS_OK;

View File

@@ -18,7 +18,7 @@ class AboutRedirector : public nsIAboutModule {
AboutRedirector() {}
static nsresult Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
protected:
virtual ~AboutRedirector() {}

View File

@@ -34,8 +34,8 @@ NS_IMPL_ISUPPORTS(DirectoryProvider, nsIDirectoryServiceProvider,
nsIDirectoryServiceProvider2)
NS_IMETHODIMP
DirectoryProvider::GetFile(const char *aKey, bool *aPersist,
nsIFile **aResult) {
DirectoryProvider::GetFile(const char* aKey, bool* aPersist,
nsIFile** aResult) {
return NS_ERROR_FAILURE;
}
@@ -56,8 +56,8 @@ DirectoryProvider::GetFile(const char *aKey, bool *aPersist,
// "distribution.searchplugins.defaultLocale"
// which specifies a default locale to use.
static void AppendDistroSearchDirs(nsIProperties *aDirSvc,
nsCOMArray<nsIFile> &array) {
static void AppendDistroSearchDirs(nsIProperties* aDirSvc,
nsCOMArray<nsIFile>& array) {
nsCOMPtr<nsIFile> searchPlugins;
nsresult rv = aDirSvc->Get(XRE_APP_DISTRIBUTION_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(searchPlugins));
@@ -118,7 +118,7 @@ static void AppendDistroSearchDirs(nsIProperties *aDirSvc,
}
NS_IMETHODIMP
DirectoryProvider::GetFiles(const char *aKey, nsISimpleEnumerator **aResult) {
DirectoryProvider::GetFiles(const char* aKey, nsISimpleEnumerator** aResult) {
if (!strcmp(aKey, NS_APP_DISTRIBUTION_SEARCH_DIR_LIST)) {
nsCOMPtr<nsIProperties> dirSvc(
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
@@ -134,13 +134,13 @@ DirectoryProvider::GetFiles(const char *aKey, nsISimpleEnumerator **aResult) {
}
NS_IMETHODIMP
DirectoryProvider::AppendingEnumerator::HasMoreElements(bool *aResult) {
DirectoryProvider::AppendingEnumerator::HasMoreElements(bool* aResult) {
*aResult = mNext ? true : false;
return NS_OK;
}
NS_IMETHODIMP
DirectoryProvider::AppendingEnumerator::GetNext(nsISupports **aResult) {
DirectoryProvider::AppendingEnumerator::GetNext(nsISupports** aResult) {
if (aResult) NS_ADDREF(*aResult = mNext);
mNext = nullptr;
@@ -160,7 +160,7 @@ DirectoryProvider::AppendingEnumerator::GetNext(nsISupports **aResult) {
nextbase->Clone(getter_AddRefs(mNext));
if (!mNext) continue;
char const *const *i = mAppendList;
char const* const* i = mAppendList;
while (*i) {
mNext->AppendNative(nsDependentCString(*i));
++i;
@@ -177,7 +177,7 @@ DirectoryProvider::AppendingEnumerator::GetNext(nsISupports **aResult) {
}
DirectoryProvider::AppendingEnumerator::AppendingEnumerator(
nsISimpleEnumerator *aBase, char const *const *aAppendList)
nsISimpleEnumerator* aBase, char const* const* aAppendList)
: mBase(aBase), mAppendList(aAppendList) {
// Initialize mNext to begin.
GetNext(nullptr);

View File

@@ -30,14 +30,14 @@ class DirectoryProvider final : public nsIDirectoryServiceProvider2 {
public:
NS_DECL_NSISIMPLEENUMERATOR
AppendingEnumerator(nsISimpleEnumerator *aBase,
char const *const *aAppendList);
AppendingEnumerator(nsISimpleEnumerator* aBase,
char const* const* aAppendList);
private:
~AppendingEnumerator() override = default;
nsCOMPtr<nsISimpleEnumerator> mBase;
char const *const *const mAppendList;
char const* const* const mAppendList;
nsCOMPtr<nsIFile> mNext;
};
};

View File

@@ -44,13 +44,13 @@
using namespace mozilla;
struct ProtocolAssociation {
const char *name;
const char* name;
bool essential;
};
struct MimeTypeAssociation {
const char *mimeType;
const char *extensions;
const char* mimeType;
const char* extensions;
};
static const ProtocolAssociation appProtocols[] = {
@@ -115,15 +115,15 @@ NS_IMPL_ISUPPORTS(nsGNOMEShellService, nsIGNOMEShellService, nsIShellService,
nsIToolkitShellService)
bool nsGNOMEShellService::GetAppPathFromLauncher() {
gchar *tmp;
gchar* tmp;
const char *launcher = PR_GetEnv("MOZ_APP_LAUNCHER");
const char* launcher = PR_GetEnv("MOZ_APP_LAUNCHER");
if (!launcher) return false;
if (g_path_is_absolute(launcher)) {
mAppPath = launcher;
tmp = g_path_get_basename(launcher);
gchar *fullpath = g_find_program_in_path(tmp);
gchar* fullpath = g_find_program_in_path(tmp);
if (fullpath && mAppPath.Equals(fullpath)) mAppIsInPath = true;
g_free(fullpath);
} else {
@@ -137,10 +137,10 @@ bool nsGNOMEShellService::GetAppPathFromLauncher() {
return true;
}
bool nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const {
gchar *commandPath;
bool nsGNOMEShellService::KeyMatchesAppName(const char* aKeyValue) const {
gchar* commandPath;
if (mUseLocaleFilenames) {
gchar *nativePath =
gchar* nativePath =
g_filename_from_utf8(aKeyValue, -1, nullptr, nullptr, nullptr);
if (!nativePath) {
NS_ERROR("Error converting path to filesystem encoding");
@@ -161,9 +161,9 @@ bool nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const {
}
bool nsGNOMEShellService::CheckHandlerMatchesAppName(
const nsACString &handler) const {
const nsACString& handler) const {
gint argc;
gchar **argv;
gchar** argv;
nsAutoCString command(handler);
// The string will be something of the form: [/path/to/]browser "%s"
@@ -182,17 +182,17 @@ bool nsGNOMEShellService::CheckHandlerMatchesAppName(
NS_IMETHODIMP
nsGNOMEShellService::IsDefaultBrowser(bool aForAllTypes,
bool *aIsDefaultBrowser) {
bool* aIsDefaultBrowser) {
*aIsDefaultBrowser = false;
if (IsRunningAsASnap()) {
const gchar *argv[] = {"xdg-settings", "check", "default-web-browser",
const gchar* argv[] = {"xdg-settings", "check", "default-web-browser",
"firefox.desktop", nullptr};
GSpawnFlags flags = static_cast<GSpawnFlags>(G_SPAWN_SEARCH_PATH |
G_SPAWN_STDERR_TO_DEV_NULL);
gchar *output = nullptr;
gchar* output = nullptr;
gint exit_status = 0;
if (!g_spawn_sync(nullptr, (gchar **)argv, nullptr, flags, nullptr, nullptr,
if (!g_spawn_sync(nullptr, (gchar**)argv, nullptr, flags, nullptr, nullptr,
&output, nullptr, &exit_status, nullptr)) {
return NS_OK;
}
@@ -243,12 +243,12 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers) {
#endif
if (IsRunningAsASnap()) {
const gchar *argv[] = {"xdg-settings", "set", "default-web-browser",
const gchar* argv[] = {"xdg-settings", "set", "default-web-browser",
"firefox.desktop", nullptr};
GSpawnFlags flags = static_cast<GSpawnFlags>(G_SPAWN_SEARCH_PATH |
G_SPAWN_STDOUT_TO_DEV_NULL |
G_SPAWN_STDERR_TO_DEV_NULL);
g_spawn_sync(nullptr, (gchar **)argv, nullptr, flags, nullptr, nullptr,
g_spawn_sync(nullptr, (gchar**)argv, nullptr, flags, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr);
return NS_OK;
}
@@ -312,16 +312,16 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers) {
}
NS_IMETHODIMP
nsGNOMEShellService::GetCanSetDesktopBackground(bool *aResult) {
nsGNOMEShellService::GetCanSetDesktopBackground(bool* aResult) {
// setting desktop background is currently only supported
// for Gnome or desktops using the same GSettings keys
const char *currentDesktop = getenv("XDG_CURRENT_DESKTOP");
const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP");
if (currentDesktop && strstr(currentDesktop, "GNOME") != nullptr) {
*aResult = true;
return NS_OK;
}
const char *gnomeSession = getenv("GNOME_DESKTOP_SESSION_ID");
const char* gnomeSession = getenv("GNOME_DESKTOP_SESSION_ID");
if (gnomeSession) {
*aResult = true;
} else {
@@ -331,7 +331,7 @@ nsGNOMEShellService::GetCanSetDesktopBackground(bool *aResult) {
return NS_OK;
}
static nsresult WriteImage(const nsCString &aPath, imgIContainer *aImage) {
static nsresult WriteImage(const nsCString& aPath, imgIContainer* aImage) {
#if !defined(MOZ_WIDGET_GTK)
return NS_ERROR_NOT_AVAILABLE;
#else
@@ -339,7 +339,7 @@ static nsresult WriteImage(const nsCString &aPath, imgIContainer *aImage) {
do_GetService("@mozilla.org/widget/image-to-gdk-pixbuf;1");
if (!imgToPixbuf) return NS_ERROR_NOT_AVAILABLE;
GdkPixbuf *pixbuf = imgToPixbuf->ConvertImageToPixbuf(aImage);
GdkPixbuf* pixbuf = imgToPixbuf->ConvertImageToPixbuf(aImage);
if (!pixbuf) return NS_ERROR_NOT_AVAILABLE;
gboolean res = gdk_pixbuf_save(pixbuf, aPath.get(), "png", nullptr, nullptr);
@@ -350,9 +350,9 @@ static nsresult WriteImage(const nsCString &aPath, imgIContainer *aImage) {
}
NS_IMETHODIMP
nsGNOMEShellService::SetDesktopBackground(dom::Element *aElement,
nsGNOMEShellService::SetDesktopBackground(dom::Element* aElement,
int32_t aPosition,
const nsACString &aImageName) {
const nsACString& aImageName) {
nsresult rv;
nsCOMPtr<nsIImageLoadingContent> imageContent =
do_QueryInterface(aElement, &rv);
@@ -415,7 +415,7 @@ nsGNOMEShellService::SetDesktopBackground(dom::Element *aElement,
gsettings->GetCollectionForSchema(NS_LITERAL_CSTRING(kDesktopBGSchema),
getter_AddRefs(background_settings));
if (background_settings) {
gchar *file_uri = g_filename_to_uri(filePath.get(), nullptr, nullptr);
gchar* file_uri = g_filename_to_uri(filePath.get(), nullptr, nullptr);
if (!file_uri) return NS_ERROR_FAILURE;
background_settings->SetString(NS_LITERAL_CSTRING(kDesktopOptionGSKey),
@@ -437,7 +437,7 @@ nsGNOMEShellService::SetDesktopBackground(dom::Element *aElement,
#define COLOR_8_TO_16_BIT(_c) ((_c) << 8 | (_c))
NS_IMETHODIMP
nsGNOMEShellService::GetDesktopBackgroundColor(uint32_t *aColor) {
nsGNOMEShellService::GetDesktopBackgroundColor(uint32_t* aColor) {
nsCOMPtr<nsIGSettingsService> gsettings =
do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
nsCOMPtr<nsIGSettingsCollection> background_settings;
@@ -467,10 +467,10 @@ nsGNOMEShellService::GetDesktopBackgroundColor(uint32_t *aColor) {
return NS_OK;
}
static void ColorToCString(uint32_t aColor, nsCString &aResult) {
static void ColorToCString(uint32_t aColor, nsCString& aResult) {
// The #rrrrggggbbbb format is used to match gdk_color_to_string()
aResult.SetLength(13);
char *buf = aResult.BeginWriting();
char* buf = aResult.BeginWriting();
if (!buf) return;
uint16_t red = COLOR_8_TO_16_BIT((aColor >> 16) & 0xff);
@@ -523,8 +523,8 @@ nsGNOMEShellService::OpenApplication(int32_t aApplication) {
}
NS_IMETHODIMP
nsGNOMEShellService::OpenApplicationWithURI(nsIFile *aApplication,
const nsACString &aURI) {
nsGNOMEShellService::OpenApplicationWithURI(nsIFile* aApplication,
const nsACString& aURI) {
nsresult rv;
nsCOMPtr<nsIProcess> process =
do_CreateInstance("@mozilla.org/process/util;1", &rv);
@@ -534,6 +534,6 @@ nsGNOMEShellService::OpenApplicationWithURI(nsIFile *aApplication,
if (NS_FAILED(rv)) return rv;
const nsCString spec(aURI);
const char *specStr = spec.get();
const char* specStr = spec.get();
return process->Run(false, &specStr, 1);
}

View File

@@ -5,7 +5,7 @@
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv) {
int main(int argc, char** argv) {
if (argc != 2) return 1;
uid_t realuser = getuid();
@@ -14,5 +14,5 @@ int main(int argc, char **argv) {
uidstring[19] = '\0';
return execl("/usr/sbin/chown", "/usr/sbin/chown", "-R", "-h", uidstring,
argv[1], (char *)0);
argv[1], (char*)0);
}

View File

@@ -4,9 +4,9 @@
#include <unistd.h>
int main(int argc, char **argv) {
int main(int argc, char** argv) {
if (argc != 2) return 1;
return execl("/usr/sbin/chown", "/usr/sbin/chown", "-R", "-h", "root:admin",
argv[1], (char *)0);
argv[1], (char*)0);
}

View File

@@ -8,7 +8,7 @@
#include "elfxx.h"
template <class endian, typename R, typename T>
void Elf_Ehdr_Traits::swap(T &t, R &r) {
void Elf_Ehdr_Traits::swap(T& t, R& r) {
memcpy(r.e_ident, t.e_ident, sizeof(r.e_ident));
r.e_type = endian::swap(t.e_type);
r.e_machine = endian::swap(t.e_machine);
@@ -26,7 +26,7 @@ void Elf_Ehdr_Traits::swap(T &t, R &r) {
}
template <class endian, typename R, typename T>
void Elf_Phdr_Traits::swap(T &t, R &r) {
void Elf_Phdr_Traits::swap(T& t, R& r) {
r.p_type = endian::swap(t.p_type);
r.p_offset = endian::swap(t.p_offset);
r.p_vaddr = endian::swap(t.p_vaddr);
@@ -38,7 +38,7 @@ void Elf_Phdr_Traits::swap(T &t, R &r) {
}
template <class endian, typename R, typename T>
void Elf_Shdr_Traits::swap(T &t, R &r) {
void Elf_Shdr_Traits::swap(T& t, R& r) {
r.sh_name = endian::swap(t.sh_name);
r.sh_type = endian::swap(t.sh_type);
r.sh_flags = endian::swap(t.sh_flags);
@@ -52,13 +52,13 @@ void Elf_Shdr_Traits::swap(T &t, R &r) {
}
template <class endian, typename R, typename T>
void Elf_Dyn_Traits::swap(T &t, R &r) {
void Elf_Dyn_Traits::swap(T& t, R& r) {
r.d_tag = endian::swap(t.d_tag);
r.d_un.d_val = endian::swap(t.d_un.d_val);
}
template <class endian, typename R, typename T>
void Elf_Sym_Traits::swap(T &t, R &r) {
void Elf_Sym_Traits::swap(T& t, R& r) {
r.st_name = endian::swap(t.st_name);
r.st_value = endian::swap(t.st_value);
r.st_size = endian::swap(t.st_size);
@@ -69,26 +69,26 @@ void Elf_Sym_Traits::swap(T &t, R &r) {
template <class endian>
struct _Rel_info {
static inline void swap(Elf32_Word &t, Elf32_Word &r) { r = endian::swap(t); }
static inline void swap(Elf64_Xword &t, Elf64_Xword &r) {
static inline void swap(Elf32_Word& t, Elf32_Word& r) { r = endian::swap(t); }
static inline void swap(Elf64_Xword& t, Elf64_Xword& r) {
r = endian::swap(t);
}
static inline void swap(Elf64_Xword &t, Elf32_Word &r) {
static inline void swap(Elf64_Xword& t, Elf32_Word& r) {
r = endian::swap(ELF32_R_INFO(ELF64_R_SYM(t), ELF64_R_TYPE(t)));
}
static inline void swap(Elf32_Word &t, Elf64_Xword &r) {
static inline void swap(Elf32_Word& t, Elf64_Xword& r) {
r = endian::swap(ELF64_R_INFO(ELF32_R_SYM(t), ELF32_R_TYPE(t)));
}
};
template <class endian, typename R, typename T>
void Elf_Rel_Traits::swap(T &t, R &r) {
void Elf_Rel_Traits::swap(T& t, R& r) {
r.r_offset = endian::swap(t.r_offset);
_Rel_info<endian>::swap(t.r_info, r.r_info);
}
template <class endian, typename R, typename T>
void Elf_Rela_Traits::swap(T &t, R &r) {
void Elf_Rela_Traits::swap(T& t, R& r) {
r.r_offset = endian::swap(t.r_offset);
_Rel_info<endian>::swap(t.r_info, r.r_info);
r.r_addend = endian::swap(t.r_addend);
@@ -99,13 +99,13 @@ static const Elf32_Shdr null32_section = {0, SHT_NULL, 0, 0, 0,
Elf_Shdr null_section(null32_section);
Elf_Ehdr::Elf_Ehdr(std::ifstream &file, char ei_class, char ei_data)
Elf_Ehdr::Elf_Ehdr(std::ifstream& file, char ei_class, char ei_data)
: serializable<Elf_Ehdr_Traits>(file, ei_class, ei_data),
ElfSection(null_section, nullptr, nullptr) {
shdr.sh_size = Elf_Ehdr::size(ei_class);
}
Elf::Elf(std::ifstream &file) {
Elf::Elf(std::ifstream& file) {
if (!file.is_open()) throw std::runtime_error("Error opening file");
file.exceptions(std::ifstream::eofbit | std::ifstream::failbit |
@@ -152,7 +152,7 @@ Elf::Elf(std::ifstream &file) {
"unsupported ELF inconsistency: ehdr->e_phentsize != sizeof(phdr)");
// Read section headers
Elf_Shdr **shdr = new Elf_Shdr *[ehdr->e_shnum];
Elf_Shdr** shdr = new Elf_Shdr*[ehdr->e_shnum];
file.seekg(ehdr->e_shoff);
for (int i = 0; i < ehdr->e_shnum; i++)
shdr[i] = new Elf_Shdr(file, e_ident[EI_CLASS], e_ident[EI_DATA]);
@@ -177,7 +177,7 @@ Elf::Elf(std::ifstream &file) {
tmp_file = &file;
// Fill sections list
sections = new ElfSection *[ehdr->e_shnum];
sections = new ElfSection*[ehdr->e_shnum];
for (int i = 0; i < ehdr->e_shnum; i++) sections[i] = nullptr;
for (int i = 1; i < ehdr->e_shnum; i++) {
if (sections[i] != nullptr) continue;
@@ -223,7 +223,7 @@ Elf::Elf(std::ifstream &file) {
for (int i = 0; i < ehdr->e_shnum; i++) delete shdr[i];
delete[] shdr;
eh_shstrndx = (ElfStrtab_Section *)sections[ehdr->e_shstrndx];
eh_shstrndx = (ElfStrtab_Section*)sections[ehdr->e_shstrndx];
// Skip reading program headers if there aren't any
if (ehdr->e_phnum == 0) return;
@@ -242,7 +242,7 @@ Elf::Elf(std::ifstream &file) {
if ((ehdr->e_machine == EM_X86_64) && (phdr.p_align == 0x200000))
phdr.p_align = 0x1000;
}
ElfSegment *segment = new ElfSegment(&phdr);
ElfSegment* segment = new ElfSegment(&phdr);
// Some segments aren't entirely filled (if at all) by sections
// For those, we use fake sections
if ((phdr.p_type == PT_LOAD) && (phdr.p_offset == 0)) {
@@ -286,20 +286,20 @@ Elf::Elf(std::ifstream &file) {
}
Elf::~Elf() {
for (std::vector<ElfSegment *>::iterator seg = segments.begin();
for (std::vector<ElfSegment*>::iterator seg = segments.begin();
seg != segments.end(); seg++)
delete *seg;
delete[] sections;
ElfSection *section = ehdr;
ElfSection* section = ehdr;
while (section != nullptr) {
ElfSection *next = section->getNext();
ElfSection* next = section->getNext();
delete section;
section = next;
}
}
// TODO: This shouldn't fail after inserting sections
ElfSection *Elf::getSection(int index) {
ElfSection* Elf::getSection(int index) {
if ((index < -1) || (index >= ehdr->e_shnum))
throw std::runtime_error("Section index out of bounds");
if (index == -1)
@@ -308,9 +308,9 @@ ElfSection *Elf::getSection(int index) {
// Special case: the section at index 0 is void
if (index == 0) return nullptr;
// Infinite recursion guard
if (sections[index] == (ElfSection *)this) return nullptr;
if (sections[index] == (ElfSection*)this) return nullptr;
if (sections[index] == nullptr) {
sections[index] = (ElfSection *)this;
sections[index] = (ElfSection*)this;
switch (tmp_shdr[index]->sh_type) {
case SHT_DYNAMIC:
sections[index] =
@@ -340,9 +340,9 @@ ElfSection *Elf::getSection(int index) {
return sections[index];
}
ElfSection *Elf::getSectionAt(unsigned int offset) {
ElfSection* Elf::getSectionAt(unsigned int offset) {
for (int i = 1; i < ehdr->e_shnum; i++) {
ElfSection *section = getSection(i);
ElfSection* section = getSection(i);
if ((section != nullptr) && (section->getFlags() & SHF_ALLOC) &&
!(section->getFlags() & SHF_TLS) && (offset >= section->getAddr()) &&
(offset < section->getAddr() + section->getSize()))
@@ -351,8 +351,8 @@ ElfSection *Elf::getSectionAt(unsigned int offset) {
return nullptr;
}
ElfSegment *Elf::getSegmentByType(unsigned int type, ElfSegment *last) {
std::vector<ElfSegment *>::iterator seg;
ElfSegment* Elf::getSegmentByType(unsigned int type, ElfSegment* last) {
std::vector<ElfSegment*>::iterator seg;
if (last) {
seg = std::find(segments.begin(), segments.end(), last);
++seg;
@@ -363,22 +363,22 @@ ElfSegment *Elf::getSegmentByType(unsigned int type, ElfSegment *last) {
return nullptr;
}
void Elf::removeSegment(ElfSegment *segment) {
void Elf::removeSegment(ElfSegment* segment) {
if (!segment) return;
std::vector<ElfSegment *>::iterator seg;
std::vector<ElfSegment*>::iterator seg;
seg = std::find(segments.begin(), segments.end(), segment);
if (seg == segments.end()) return;
segment->clear();
segments.erase(seg);
}
ElfDynamic_Section *Elf::getDynSection() {
for (std::vector<ElfSegment *>::iterator seg = segments.begin();
ElfDynamic_Section* Elf::getDynSection() {
for (std::vector<ElfSegment*>::iterator seg = segments.begin();
seg != segments.end(); seg++)
if (((*seg)->getType() == PT_DYNAMIC) &&
((*seg)->getFirstSection() != nullptr) &&
(*seg)->getFirstSection()->getType() == SHT_DYNAMIC)
return (ElfDynamic_Section *)(*seg)->getFirstSection();
return (ElfDynamic_Section*)(*seg)->getFirstSection();
return nullptr;
}
@@ -386,7 +386,7 @@ ElfDynamic_Section *Elf::getDynSection() {
void Elf::normalize() {
// fixup section headers sh_name; TODO: that should be done by sections
// themselves
for (ElfSection *section = ehdr; section != nullptr;
for (ElfSection* section = ehdr; section != nullptr;
section = section->getNext()) {
if (section->getIndex() == 0)
continue;
@@ -397,10 +397,10 @@ void Elf::normalize() {
ehdr->markDirty();
// Check segments consistency
int i = 0;
for (std::vector<ElfSegment *>::iterator seg = segments.begin();
for (std::vector<ElfSegment*>::iterator seg = segments.begin();
seg != segments.end(); seg++, i++) {
std::list<ElfSection *>::iterator it = (*seg)->begin();
for (ElfSection *last = *(it++); it != (*seg)->end(); last = *(it++)) {
std::list<ElfSection*>::iterator it = (*seg)->begin();
for (ElfSection* last = *(it++); it != (*seg)->end(); last = *(it++)) {
if (((*it)->getType() != SHT_NOBITS) &&
((*it)->getAddr() - last->getAddr()) !=
((*it)->getOffset() - last->getOffset())) {
@@ -409,8 +409,8 @@ void Elf::normalize() {
}
}
ElfSegment *prevLoad = nullptr;
for (auto &it : segments) {
ElfSegment* prevLoad = nullptr;
for (auto& it : segments) {
if (it->getType() == PT_LOAD) {
if (prevLoad) {
size_t alignedPrevEnd = (prevLoad->getAddr() + prevLoad->getMemSize() +
@@ -442,7 +442,7 @@ void Elf::normalize() {
// Check sections consistency
unsigned int minOffset = 0;
for (ElfSection *section = ehdr; section != nullptr;
for (ElfSection* section = ehdr; section != nullptr;
section = section->getNext()) {
unsigned int offset = section->getOffset();
if (offset < minOffset) {
@@ -454,13 +454,13 @@ void Elf::normalize() {
}
}
void Elf::write(std::ofstream &file) {
void Elf::write(std::ofstream& file) {
normalize();
for (ElfSection *section = ehdr; section != nullptr;
for (ElfSection* section = ehdr; section != nullptr;
section = section->getNext()) {
file.seekp(section->getOffset());
if (section == phdr_section) {
for (std::vector<ElfSegment *>::iterator seg = segments.begin();
for (std::vector<ElfSegment*>::iterator seg = segments.begin();
seg != segments.end(); seg++) {
Elf_Phdr phdr;
phdr.p_type = (*seg)->getType();
@@ -476,7 +476,7 @@ void Elf::write(std::ofstream &file) {
} else if (section == shdr_section) {
null_section.serialize(file, ehdr->e_ident[EI_CLASS],
ehdr->e_ident[EI_DATA]);
for (ElfSection *sec = ehdr; sec != nullptr; sec = sec->getNext()) {
for (ElfSection* sec = ehdr; sec != nullptr; sec = sec->getNext()) {
if (sec->getType() != SHT_NULL)
sec->getShdr().serialize(file, ehdr->e_ident[EI_CLASS],
ehdr->e_ident[EI_DATA]);
@@ -486,7 +486,7 @@ void Elf::write(std::ofstream &file) {
}
}
ElfSection::ElfSection(Elf_Shdr &s, std::ifstream *file, Elf *parent)
ElfSection::ElfSection(Elf_Shdr& s, std::ifstream* file, Elf* parent)
: shdr(s),
link(shdr.sh_link == SHN_UNDEF ? nullptr
: parent->getSection(shdr.sh_link)),
@@ -497,7 +497,7 @@ ElfSection::ElfSection(Elf_Shdr &s, std::ifstream *file, Elf *parent)
(shdr.sh_type == SHT_NOBITS))
data = nullptr;
else {
data = static_cast<char *>(malloc(shdr.sh_size));
data = static_cast<char*>(malloc(shdr.sh_size));
if (!data) {
throw std::runtime_error("Could not malloc ElfSection data");
}
@@ -509,7 +509,7 @@ ElfSection::ElfSection(Elf_Shdr &s, std::ifstream *file, Elf *parent)
if (shdr.sh_name == 0)
name = nullptr;
else {
ElfStrtab_Section *strtab = (ElfStrtab_Section *)parent->getSection(-1);
ElfStrtab_Section* strtab = (ElfStrtab_Section*)parent->getSection(-1);
// Special case (see elfgeneric.cpp): if strtab is nullptr, the
// section being created is the strtab.
if (strtab == nullptr)
@@ -548,8 +548,8 @@ unsigned int ElfSection::getOffset() {
unsigned int offset = previous->getOffset();
ElfSegment *ptload = getSegmentByType(PT_LOAD);
ElfSegment *prev_ptload = previous->getSegmentByType(PT_LOAD);
ElfSegment* ptload = getSegmentByType(PT_LOAD);
ElfSegment* prev_ptload = previous->getSegmentByType(PT_LOAD);
if (ptload && (ptload == prev_ptload)) {
offset += getAddr() - previous->getAddr();
@@ -559,7 +559,7 @@ unsigned int ElfSection::getOffset() {
if (previous->getType() != SHT_NOBITS) offset += previous->getSize();
Elf32_Word align = 0x1000;
for (std::vector<ElfSegment *>::iterator seg = segments.begin();
for (std::vector<ElfSegment*>::iterator seg = segments.begin();
seg != segments.end(); seg++)
align = std::max(align, (*seg)->getAlign());
@@ -581,7 +581,7 @@ unsigned int ElfSection::getOffset() {
int ElfSection::getIndex() {
if (index != -1) return index;
if (getType() == SHT_NULL) return (index = 0);
ElfSection *reference;
ElfSection* reference;
for (reference = previous;
(reference != nullptr) && (reference->getType() == SHT_NULL);
reference = reference->getPrevious())
@@ -590,7 +590,7 @@ int ElfSection::getIndex() {
return (index = reference->getIndex() + 1);
}
Elf_Shdr &ElfSection::getShdr() {
Elf_Shdr& ElfSection::getShdr() {
getOffset();
if (shdr.sh_link == (Elf32_Word)-1)
shdr.sh_link = getLink() ? getLink()->getIndex() : 0;
@@ -602,7 +602,7 @@ Elf_Shdr &ElfSection::getShdr() {
return shdr;
}
ElfSegment::ElfSegment(Elf_Phdr *phdr)
ElfSegment::ElfSegment(Elf_Phdr* phdr)
: type(phdr->p_type),
v_p_diff(phdr->p_paddr - phdr->p_vaddr),
flags(phdr->p_flags),
@@ -611,19 +611,19 @@ ElfSegment::ElfSegment(Elf_Phdr *phdr)
filesz(phdr->p_filesz),
memsz(phdr->p_memsz) {}
void ElfSegment::addSection(ElfSection *section) {
void ElfSegment::addSection(ElfSection* section) {
// Make sure all sections in PT_GNU_RELRO won't be moved by elfhack
assert(!((type == PT_GNU_RELRO) && (section->isRelocatable())));
// TODO: Check overlapping sections
std::list<ElfSection *>::iterator i;
std::list<ElfSection*>::iterator i;
for (i = sections.begin(); i != sections.end(); ++i)
if ((*i)->getAddr() > section->getAddr()) break;
sections.insert(i, section);
section->addToSegment(this);
}
void ElfSegment::removeSection(ElfSection *section) {
void ElfSegment::removeSection(ElfSection* section) {
sections.remove(section);
section->removeFromSegment(this);
}
@@ -633,7 +633,7 @@ unsigned int ElfSegment::getFileSize() {
if (sections.empty()) return 0;
// Search the last section that is not SHT_NOBITS
std::list<ElfSection *>::reverse_iterator i;
std::list<ElfSection*>::reverse_iterator i;
for (i = sections.rbegin();
(i != sections.rend()) && ((*i)->getType() == SHT_NOBITS); ++i)
;
@@ -674,25 +674,25 @@ unsigned int ElfSegment::getAddr() {
}
void ElfSegment::clear() {
for (std::list<ElfSection *>::iterator i = sections.begin();
for (std::list<ElfSection*>::iterator i = sections.begin();
i != sections.end(); ++i)
(*i)->removeFromSegment(this);
sections.clear();
}
ElfValue *ElfDynamic_Section::getValueForType(unsigned int tag) {
ElfValue* ElfDynamic_Section::getValueForType(unsigned int tag) {
for (unsigned int i = 0; i < shdr.sh_size / shdr.sh_entsize; i++)
if (dyns[i].tag == tag) return dyns[i].value;
return nullptr;
}
ElfSection *ElfDynamic_Section::getSectionForType(unsigned int tag) {
ElfValue *value = getValueForType(tag);
ElfSection* ElfDynamic_Section::getSectionForType(unsigned int tag) {
ElfValue* value = getValueForType(tag);
return value ? value->getSection() : nullptr;
}
bool ElfDynamic_Section::setValueForType(unsigned int tag, ElfValue *val) {
bool ElfDynamic_Section::setValueForType(unsigned int tag, ElfValue* val) {
unsigned int i;
unsigned int shnum = shdr.sh_size / shdr.sh_entsize;
for (i = 0; (i < shnum) && (dyns[i].tag != DT_NULL); i++)
@@ -711,8 +711,8 @@ bool ElfDynamic_Section::setValueForType(unsigned int tag, ElfValue *val) {
return true;
}
ElfDynamic_Section::ElfDynamic_Section(Elf_Shdr &s, std::ifstream *file,
Elf *parent)
ElfDynamic_Section::ElfDynamic_Section(Elf_Shdr& s, std::ifstream* file,
Elf* parent)
: ElfSection(s, file, parent) {
int pos = file->tellg();
dyns.resize(s.sh_size / s.sh_entsize);
@@ -802,7 +802,7 @@ ElfDynamic_Section::~ElfDynamic_Section() {
delete dyns[i].value;
}
void ElfDynamic_Section::serialize(std::ofstream &file, char ei_class,
void ElfDynamic_Section::serialize(std::ofstream& file, char ei_class,
char ei_data) {
for (unsigned int i = 0; i < shdr.sh_size / shdr.sh_entsize; i++) {
Elf_Dyn dyn;
@@ -812,19 +812,19 @@ void ElfDynamic_Section::serialize(std::ofstream &file, char ei_class,
}
}
ElfSymtab_Section::ElfSymtab_Section(Elf_Shdr &s, std::ifstream *file,
Elf *parent)
ElfSymtab_Section::ElfSymtab_Section(Elf_Shdr& s, std::ifstream* file,
Elf* parent)
: ElfSection(s, file, parent) {
int pos = file->tellg();
syms.resize(s.sh_size / s.sh_entsize);
ElfStrtab_Section *strtab = (ElfStrtab_Section *)getLink();
ElfStrtab_Section* strtab = (ElfStrtab_Section*)getLink();
file->seekg(shdr.sh_offset);
for (unsigned int i = 0; i < shdr.sh_size / shdr.sh_entsize; i++) {
Elf_Sym sym(*file, parent->getClass(), parent->getData());
syms[i].name = strtab->getStr(sym.st_name);
syms[i].info = sym.st_info;
syms[i].other = sym.st_other;
ElfSection *section =
ElfSection* section =
(sym.st_shndx == SHN_ABS) ? nullptr : parent->getSection(sym.st_shndx);
new (&syms[i].value)
ElfLocation(section, sym.st_value, ElfLocation::ABSOLUTE);
@@ -834,16 +834,16 @@ ElfSymtab_Section::ElfSymtab_Section(Elf_Shdr &s, std::ifstream *file,
file->seekg(pos);
}
void ElfSymtab_Section::serialize(std::ofstream &file, char ei_class,
void ElfSymtab_Section::serialize(std::ofstream& file, char ei_class,
char ei_data) {
ElfStrtab_Section *strtab = (ElfStrtab_Section *)getLink();
ElfStrtab_Section* strtab = (ElfStrtab_Section*)getLink();
for (unsigned int i = 0; i < shdr.sh_size / shdr.sh_entsize; i++) {
Elf_Sym sym;
sym.st_name = strtab->getStrIndex(syms[i].name);
sym.st_info = syms[i].info;
sym.st_other = syms[i].other;
sym.st_value = syms[i].value.getValue();
ElfSection *section = syms[i].value.getSection();
ElfSection* section = syms[i].value.getSection();
if (syms[i].defined)
sym.st_shndx = section ? section->getIndex() : SHN_ABS;
else
@@ -853,7 +853,7 @@ void ElfSymtab_Section::serialize(std::ofstream &file, char ei_class,
}
}
Elf_SymValue *ElfSymtab_Section::lookup(const char *name,
Elf_SymValue* ElfSymtab_Section::lookup(const char* name,
unsigned int type_filter) {
for (std::vector<Elf_SymValue>::iterator sym = syms.begin();
sym != syms.end(); sym++) {
@@ -865,7 +865,7 @@ Elf_SymValue *ElfSymtab_Section::lookup(const char *name,
return nullptr;
}
const char *ElfStrtab_Section::getStr(unsigned int index) {
const char* ElfStrtab_Section::getStr(unsigned int index) {
for (std::vector<table_storage>::iterator t = table.begin(); t != table.end();
t++) {
if (index < t->used) return t->buf + index;
@@ -875,7 +875,7 @@ const char *ElfStrtab_Section::getStr(unsigned int index) {
return nullptr;
}
const char *ElfStrtab_Section::getStr(const char *string) {
const char* ElfStrtab_Section::getStr(const char* string) {
if (string == nullptr) return nullptr;
// If the given string is within the section, return it
@@ -891,7 +891,7 @@ const char *ElfStrtab_Section::getStr(const char *string) {
if (table.back().size - table.back().used < len)
table.resize(table.size() + 1);
char *alloc_str = table.back().buf + table.back().used;
char* alloc_str = table.back().buf + table.back().used;
memcpy(alloc_str, string, len);
table.back().used += len;
@@ -901,7 +901,7 @@ const char *ElfStrtab_Section::getStr(const char *string) {
return alloc_str;
}
unsigned int ElfStrtab_Section::getStrIndex(const char *string) {
unsigned int ElfStrtab_Section::getStrIndex(const char* string) {
if (string == nullptr) return 0;
unsigned int index = 0;
@@ -917,7 +917,7 @@ unsigned int ElfStrtab_Section::getStrIndex(const char *string) {
return 0;
}
void ElfStrtab_Section::serialize(std::ofstream &file, char ei_class,
void ElfStrtab_Section::serialize(std::ofstream& file, char ei_class,
char ei_data) {
file.seekp(getOffset());
for (std::vector<table_storage>::iterator t = table.begin(); t != table.end();

View File

@@ -27,7 +27,7 @@
# define R_ARM_THM_JUMP24 0x1e
#endif
char *rundir = nullptr;
char* rundir = nullptr;
template <typename T>
struct wrapped {
@@ -40,7 +40,7 @@ class Elf_Addr_Traits {
typedef wrapped<Elf64_Addr> Type64;
template <class endian, typename R, typename T>
static inline void swap(T &t, R &r) {
static inline void swap(T& t, R& r) {
r.value = endian::swap(t.value);
}
};
@@ -53,7 +53,7 @@ class Elf_RelHack_Traits {
typedef Elf32_Rel Type64;
template <class endian, typename R, typename T>
static inline void swap(T &t, R &r) {
static inline void swap(T& t, R& r) {
r.r_offset = endian::swap(t.r_offset);
r.r_info = endian::swap(t.r_info);
}
@@ -63,11 +63,11 @@ typedef serializable<Elf_RelHack_Traits> Elf_RelHack;
class ElfRelHack_Section : public ElfSection {
public:
ElfRelHack_Section(Elf_Shdr &s) : ElfSection(s, nullptr, nullptr) {
ElfRelHack_Section(Elf_Shdr& s) : ElfSection(s, nullptr, nullptr) {
name = elfhack_data;
};
void serialize(std::ofstream &file, char ei_class, char ei_data) {
void serialize(std::ofstream& file, char ei_class, char ei_data) {
for (std::vector<Elf_RelHack>::iterator i = rels.begin(); i != rels.end();
++i)
(*i).serialize(file, ei_class, ei_data);
@@ -75,7 +75,7 @@ class ElfRelHack_Section : public ElfSection {
bool isRelocatable() { return true; }
void push_back(Elf_RelHack &r) {
void push_back(Elf_RelHack& r) {
rels.push_back(r);
shdr.sh_size = rels.size() * shdr.sh_entsize;
}
@@ -86,8 +86,8 @@ class ElfRelHack_Section : public ElfSection {
class ElfRelHackCode_Section : public ElfSection {
public:
ElfRelHackCode_Section(Elf_Shdr &s, Elf &e,
ElfRelHack_Section &relhack_section, unsigned int init,
ElfRelHackCode_Section(Elf_Shdr& s, Elf& e,
ElfRelHack_Section& relhack_section, unsigned int init,
unsigned int mprotect_cb, unsigned int sysconf_cb)
: ElfSection(s, nullptr, nullptr),
parent(e),
@@ -120,13 +120,13 @@ class ElfRelHackCode_Section : public ElfSection {
throw std::runtime_error(
"architecture of object for injected code doesn't match");
ElfSymtab_Section *symtab = nullptr;
ElfSymtab_Section* symtab = nullptr;
// Find the symbol table.
for (ElfSection *section = elf->getSection(1); section != nullptr;
for (ElfSection* section = elf->getSection(1); section != nullptr;
section = section->getNext()) {
if (section->getType() == SHT_SYMTAB)
symtab = (ElfSymtab_Section *)section;
symtab = (ElfSymtab_Section*)section;
}
if (symtab == nullptr)
throw std::runtime_error(
@@ -139,7 +139,7 @@ class ElfRelHackCode_Section : public ElfSection {
std::string symbol = "init";
if (!init) symbol += "_noinit";
if (relro) symbol += "_relro";
Elf_SymValue *sym = symtab->lookup(symbol.c_str());
Elf_SymValue* sym = symtab->lookup(symbol.c_str());
if (!sym)
throw std::runtime_error(
"Couldn't find an 'init' symbol in the injected code");
@@ -155,7 +155,7 @@ class ElfRelHackCode_Section : public ElfSection {
// is the virtual address of the instruction that calls the original init,
// but we don't have it at this point, so punt to just init.
if (init > 0xffffff && parent.getMachine() == EM_ARM) {
Elf_SymValue *trampoline = symtab->lookup("init_trampoline");
Elf_SymValue* trampoline = symtab->lookup("init_trampoline");
if (!trampoline) {
throw std::runtime_error(
"Couldn't find an 'init_trampoline' symbol in the injected code");
@@ -166,9 +166,9 @@ class ElfRelHackCode_Section : public ElfSection {
}
// Adjust code sections offsets according to their size
std::vector<ElfSection *>::iterator c = code.begin();
std::vector<ElfSection*>::iterator c = code.begin();
(*c)->getShdr().sh_addr = 0;
for (ElfSection *last = *(c++); c != code.end(); ++c) {
for (ElfSection* last = *(c++); c != code.end(); ++c) {
unsigned int addr = last->getShdr().sh_addr + last->getSize();
if (addr & ((*c)->getAddrAlign() - 1))
addr = (addr | ((*c)->getAddrAlign() - 1)) + 1;
@@ -180,11 +180,11 @@ class ElfRelHackCode_Section : public ElfSection {
last = *c;
}
shdr.sh_size = code.back()->getAddr() + code.back()->getSize();
data = static_cast<char *>(malloc(shdr.sh_size));
data = static_cast<char*>(malloc(shdr.sh_size));
if (!data) {
throw std::runtime_error("Could not malloc ElfSection data");
}
char *buf = data;
char* buf = data;
for (c = code.begin(); c != code.end(); ++c) {
memcpy(buf, (*c)->getData(), (*c)->getSize());
buf += (*c)->getSize();
@@ -194,23 +194,23 @@ class ElfRelHackCode_Section : public ElfSection {
~ElfRelHackCode_Section() { delete elf; }
void serialize(std::ofstream &file, char ei_class, char ei_data) {
void serialize(std::ofstream& file, char ei_class, char ei_data) {
// Readjust code offsets
for (std::vector<ElfSection *>::iterator c = code.begin(); c != code.end();
for (std::vector<ElfSection*>::iterator c = code.begin(); c != code.end();
++c)
(*c)->getShdr().sh_addr += getAddr();
// Apply relocations
for (std::vector<ElfSection *>::iterator c = code.begin(); c != code.end();
for (std::vector<ElfSection*>::iterator c = code.begin(); c != code.end();
++c) {
for (ElfSection *rel = elf->getSection(1); rel != nullptr;
for (ElfSection* rel = elf->getSection(1); rel != nullptr;
rel = rel->getNext())
if (((rel->getType() == SHT_REL) || (rel->getType() == SHT_RELA)) &&
(rel->getInfo().section == *c)) {
if (rel->getType() == SHT_REL)
apply_relocations((ElfRel_Section<Elf_Rel> *)rel, *c);
apply_relocations((ElfRel_Section<Elf_Rel>*)rel, *c);
else
apply_relocations((ElfRel_Section<Elf_Rela> *)rel, *c);
apply_relocations((ElfRel_Section<Elf_Rela>*)rel, *c);
}
}
@@ -221,7 +221,7 @@ class ElfRelHackCode_Section : public ElfSection {
unsigned int getEntryPoint() { return entry_point; }
void insertBefore(ElfSection *section, bool dirty = true) override {
void insertBefore(ElfSection* section, bool dirty = true) override {
// Adjust the address so that this section is adjacent to the one it's
// being inserted before. This avoids creating holes which subsequently
// might lead the PHDR-adjusting code to create unnecessary additional
@@ -232,7 +232,7 @@ class ElfRelHackCode_Section : public ElfSection {
}
private:
void add_code_section(ElfSection *section) {
void add_code_section(ElfSection* section) {
if (section) {
/* Don't add section if it's already been added in the past */
for (auto s = code.begin(); s != code.end(); ++s) {
@@ -245,23 +245,23 @@ class ElfRelHackCode_Section : public ElfSection {
/* Look at the relocations associated to the given section to find other
* sections that it requires */
void find_code(ElfSection *section) {
for (ElfSection *s = elf->getSection(1); s != nullptr; s = s->getNext()) {
void find_code(ElfSection* section) {
for (ElfSection* s = elf->getSection(1); s != nullptr; s = s->getNext()) {
if (((s->getType() == SHT_REL) || (s->getType() == SHT_RELA)) &&
(s->getInfo().section == section)) {
if (s->getType() == SHT_REL)
scan_relocs_for_code((ElfRel_Section<Elf_Rel> *)s);
scan_relocs_for_code((ElfRel_Section<Elf_Rel>*)s);
else
scan_relocs_for_code((ElfRel_Section<Elf_Rela> *)s);
scan_relocs_for_code((ElfRel_Section<Elf_Rela>*)s);
}
}
}
template <typename Rel_Type>
void scan_relocs_for_code(ElfRel_Section<Rel_Type> *rel) {
ElfSymtab_Section *symtab = (ElfSymtab_Section *)rel->getLink();
void scan_relocs_for_code(ElfRel_Section<Rel_Type>* rel) {
ElfSymtab_Section* symtab = (ElfSymtab_Section*)rel->getLink();
for (auto r = rel->rels.begin(); r != rel->rels.end(); ++r) {
ElfSection *section =
ElfSection* section =
symtab->syms[ELF32_R_SYM(r->r_info)].value.getSection();
add_code_section(section);
}
@@ -349,7 +349,7 @@ class ElfRelHackCode_Section : public ElfSection {
};
template <class relocation_type>
void apply_relocation(ElfSection *the_code, char *base, Elf_Rel *r,
void apply_relocation(ElfSection* the_code, char* base, Elf_Rel* r,
unsigned int addr) {
relocation_type relocation;
Elf32_Addr value;
@@ -359,7 +359,7 @@ class ElfRelHackCode_Section : public ElfSection {
}
template <class relocation_type>
void apply_relocation(ElfSection *the_code, char *base, Elf_Rela *r,
void apply_relocation(ElfSection* the_code, char* base, Elf_Rela* r,
unsigned int addr) {
relocation_type relocation;
Elf32_Addr value =
@@ -368,22 +368,22 @@ class ElfRelHackCode_Section : public ElfSection {
}
template <typename Rel_Type>
void apply_relocations(ElfRel_Section<Rel_Type> *rel, ElfSection *the_code) {
void apply_relocations(ElfRel_Section<Rel_Type>* rel, ElfSection* the_code) {
assert(rel->getType() == Rel_Type::sh_type);
char *buf = data + (the_code->getAddr() - code.front()->getAddr());
char* buf = data + (the_code->getAddr() - code.front()->getAddr());
// TODO: various checks on the sections
ElfSymtab_Section *symtab = (ElfSymtab_Section *)rel->getLink();
ElfSymtab_Section* symtab = (ElfSymtab_Section*)rel->getLink();
for (typename std::vector<Rel_Type>::iterator r = rel->rels.begin();
r != rel->rels.end(); ++r) {
// TODO: various checks on the symbol
const char *name = symtab->syms[ELF32_R_SYM(r->r_info)].name;
const char* name = symtab->syms[ELF32_R_SYM(r->r_info)].name;
unsigned int addr;
if (symtab->syms[ELF32_R_SYM(r->r_info)].value.getSection() == nullptr) {
if (strcmp(name, "relhack") == 0) {
addr = relhack_section.getAddr();
} else if (strcmp(name, "elf_header") == 0) {
// TODO: change this ungly hack to something better
ElfSection *ehdr = parent.getSection(1)->getPrevious()->getPrevious();
ElfSection* ehdr = parent.getSection(1)->getPrevious()->getPrevious();
addr = ehdr->getAddr();
} else if (strcmp(name, "original_init") == 0) {
if (init_trampoline) {
@@ -412,7 +412,7 @@ class ElfRelHackCode_Section : public ElfSection {
throw std::runtime_error("Unsupported symbol in relocation");
}
} else {
ElfSection *section =
ElfSection* section =
symtab->syms[ELF32_R_SYM(r->r_info)].value.getSection();
assert((section->getType() == SHT_PROGBITS) &&
(section->getFlags() & SHF_EXECINSTR));
@@ -452,44 +452,44 @@ class ElfRelHackCode_Section : public ElfSection {
}
Elf *elf, &parent;
ElfRelHack_Section &relhack_section;
std::vector<ElfSection *> code;
ElfRelHack_Section& relhack_section;
std::vector<ElfSection*> code;
unsigned int init;
ElfSection *init_trampoline;
ElfSection* init_trampoline;
unsigned int mprotect_cb;
unsigned int sysconf_cb;
int entry_point;
ElfSegment *relro;
ElfSegment* relro;
};
unsigned int get_addend(Elf_Rel *rel, Elf *elf) {
unsigned int get_addend(Elf_Rel* rel, Elf* elf) {
ElfLocation loc(rel->r_offset, elf);
Elf_Addr addr(loc.getBuffer(), Elf_Addr::size(elf->getClass()),
elf->getClass(), elf->getData());
return addr.value;
}
unsigned int get_addend(Elf_Rela *rel, Elf *elf) { return rel->r_addend; }
unsigned int get_addend(Elf_Rela* rel, Elf* elf) { return rel->r_addend; }
void set_relative_reloc(Elf_Rel *rel, Elf *elf, unsigned int value) {
void set_relative_reloc(Elf_Rel* rel, Elf* elf, unsigned int value) {
ElfLocation loc(rel->r_offset, elf);
Elf_Addr addr;
addr.value = value;
addr.serialize(const_cast<char *>(loc.getBuffer()),
addr.serialize(const_cast<char*>(loc.getBuffer()),
Elf_Addr::size(elf->getClass()), elf->getClass(),
elf->getData());
}
void set_relative_reloc(Elf_Rela *rel, Elf *elf, unsigned int value) {
void set_relative_reloc(Elf_Rela* rel, Elf* elf, unsigned int value) {
// ld puts the value of relocated relocations both in the addend and
// at r_offset. For consistency, keep it that way.
set_relative_reloc((Elf_Rel *)rel, elf, value);
set_relative_reloc((Elf_Rel*)rel, elf, value);
rel->r_addend = value;
}
void maybe_split_segment(Elf *elf, ElfSegment *segment) {
std::list<ElfSection *>::iterator it = segment->begin();
for (ElfSection *last = *(it++); it != segment->end(); last = *(it++)) {
void maybe_split_segment(Elf* elf, ElfSegment* segment) {
std::list<ElfSection*>::iterator it = segment->begin();
for (ElfSection* last = *(it++); it != segment->end(); last = *(it++)) {
// When two consecutive non-SHT_NOBITS sections are apart by more
// than the alignment of the section, the second can be moved closer
// to the first, but this requires the segment to be split.
@@ -505,7 +505,7 @@ void maybe_split_segment(Elf *elf, ElfSegment *segment) {
phdr.p_align = segment->getAlign();
phdr.p_filesz = (unsigned int)-1;
phdr.p_memsz = (unsigned int)-1;
ElfSegment *newSegment = new ElfSegment(&phdr);
ElfSegment* newSegment = new ElfSegment(&phdr);
elf->insertSegmentAfter(segment, newSegment);
for (; it != segment->end(); ++it) {
newSegment->addSection(*it);
@@ -540,7 +540,7 @@ static char encoding_data_size(char encoding) { return encoding & 0x07; }
// Advance `step` bytes in the buffer at `data` with size `size`, returning
// the advanced buffer pointer and remaining size.
// Returns true if step <= size.
static bool advance_buffer(char **data, size_t *size, size_t step) {
static bool advance_buffer(char** data, size_t* size, size_t step) {
if (step > *size) return false;
*data += step;
@@ -550,7 +550,7 @@ static bool advance_buffer(char **data, size_t *size, size_t step) {
// Advance in the given buffer, skipping the full length of the variable-length
// encoded LEB128 type in CIE/FDE data.
static bool skip_LEB128(char **data, size_t *size) {
static bool skip_LEB128(char** data, size_t* size) {
if (!*size) return false;
while (*size && (*(*data)++ & (char)0x80)) {
@@ -561,7 +561,7 @@ static bool skip_LEB128(char **data, size_t *size) {
// Advance in the given buffer, skipping the full length of a pointer encoded
// with the given encoding.
static bool skip_eh_frame_pointer(char **data, size_t *size, char encoding) {
static bool skip_eh_frame_pointer(char** data, size_t* size, char encoding) {
switch (encoding_data_size(encoding)) {
case DW_EH_PE_data2:
return advance_buffer(data, size, 2);
@@ -577,9 +577,9 @@ static bool skip_eh_frame_pointer(char **data, size_t *size, char encoding) {
// Specialized implementations for adjust_eh_frame_pointer().
template <typename T>
static bool adjust_eh_frame_sized_pointer(char **data, size_t *size,
ElfSection *eh_frame,
unsigned int origAddr, Elf *elf) {
static bool adjust_eh_frame_sized_pointer(char** data, size_t* size,
ElfSection* eh_frame,
unsigned int origAddr, Elf* elf) {
if (*size < sizeof(T)) return false;
serializable<FixedSizeData<T>> pointer(*data, *size, elf->getClass(),
@@ -602,9 +602,9 @@ static bool adjust_eh_frame_sized_pointer(char **data, size_t *size,
// In the given eh_frame section, adjust the pointer with the given encoding,
// pointed to by the given buffer (`data`, `size`), considering the eh_frame
// section was originally at `origAddr`. Also advances in the buffer.
static bool adjust_eh_frame_pointer(char **data, size_t *size, char encoding,
ElfSection *eh_frame, unsigned int origAddr,
Elf *elf) {
static bool adjust_eh_frame_pointer(char** data, size_t* size, char encoding,
ElfSection* eh_frame, unsigned int origAddr,
Elf* elf) {
if ((encoding & 0x70) != DW_EH_PE_pcrel)
return skip_eh_frame_pointer(data, size, encoding);
@@ -640,12 +640,12 @@ static bool adjust_eh_frame_pointer(char **data, size_t *size, char encoding,
// The eh_frame section may contain "PC"-relative pointers. If we move the
// section, those need to be adjusted. Other type of pointers are relative to
// sections we don't touch.
static void adjust_eh_frame(ElfSection *eh_frame, unsigned int origAddr,
Elf *elf) {
static void adjust_eh_frame(ElfSection* eh_frame, unsigned int origAddr,
Elf* elf) {
if (eh_frame->getAddr() == origAddr) // nothing to do;
return;
char *data = const_cast<char *>(eh_frame->getData());
char* data = const_cast<char*>(eh_frame->getData());
size_t size = eh_frame->getSize();
char LSDAencoding = DW_EH_PE_omit;
char FDEencoding = DW_EH_PE_absptr;
@@ -659,7 +659,7 @@ static void adjust_eh_frame(ElfSection *eh_frame, unsigned int origAddr,
data, size, elf->getClass(), elf->getData());
if (!advance_buffer(&data, &size, sizeof(uint32_t))) goto malformed;
char *cursor = data;
char* cursor = data;
size_t length = entryLength.value;
if (length == 0) {
@@ -686,7 +686,7 @@ static void adjust_eh_frame(ElfSection *eh_frame, unsigned int origAddr,
throw std::runtime_error("Unsupported eh_frame version");
}
// NUL terminated string.
const char *augmentationString = cursor;
const char* augmentationString = cursor;
size_t l = strnlen(augmentationString, length - 1);
if (l == length - 1) goto malformed;
if (!advance_buffer(&cursor, &length, l + 1)) goto malformed;
@@ -759,16 +759,16 @@ malformed:
}
template <typename Rel_Type>
int do_relocation_section(Elf *elf, unsigned int rel_type,
int do_relocation_section(Elf* elf, unsigned int rel_type,
unsigned int rel_type2, bool force) {
ElfDynamic_Section *dyn = elf->getDynSection();
ElfDynamic_Section* dyn = elf->getDynSection();
if (dyn == nullptr) {
fprintf(stderr, "Couldn't find SHT_DYNAMIC section\n");
return -1;
}
ElfRel_Section<Rel_Type> *section =
(ElfRel_Section<Rel_Type> *)dyn->getSectionForType(Rel_Type::d_tag);
ElfRel_Section<Rel_Type>* section =
(ElfRel_Section<Rel_Type>*)dyn->getSectionForType(Rel_Type::d_tag);
if (section == nullptr) {
fprintf(stderr, "No relocations\n");
return -1;
@@ -814,9 +814,9 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
// The binary may have .ctors instead of DT_INIT_ARRAY, for its init
// functions, but this falls into the second case above, since .ctors
// are actually run by DT_INIT code.
ElfValue *value = dyn->getValueForType(DT_INIT);
ElfValue* value = dyn->getValueForType(DT_INIT);
unsigned int original_init = value ? value->getValue() : 0;
ElfSection *init_array = nullptr;
ElfSection* init_array = nullptr;
if (!value || !value->getValue()) {
value = dyn->getValueForType(DT_INIT_ARRAYSZ);
if (value && value->getValue() >= entry_sz)
@@ -825,10 +825,10 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
Elf_Shdr relhack_section(relhack32_section);
Elf_Shdr relhackcode_section(relhackcode32_section);
ElfRelHack_Section *relhack = new ElfRelHack_Section(relhack_section);
ElfRelHack_Section* relhack = new ElfRelHack_Section(relhack_section);
ElfSymtab_Section *symtab = (ElfSymtab_Section *)section->getLink();
Elf_SymValue *sym = symtab->lookup("__cxa_pure_virtual");
ElfSymtab_Section* symtab = (ElfSymtab_Section*)section->getLink();
Elf_SymValue* sym = symtab->lookup("__cxa_pure_virtual");
std::vector<Rel_Type> new_rels;
Elf_RelHack relhack_entry;
@@ -856,7 +856,7 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
Elf_Addr addr(loc.getBuffer(), entry_sz, elf->getClass(),
elf->getData());
if (addr.value == sym->value.getValue()) {
memset((char *)loc.getBuffer(), 0, entry_sz);
memset((char*)loc.getBuffer(), 0, entry_sz);
continue;
}
}
@@ -866,7 +866,7 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
// have absolute relocations (rel_type2) for it.
if ((ELF32_R_TYPE(i->r_info) == rel_type2) &&
(sym == &symtab->syms[ELF32_R_SYM(i->r_info)])) {
memset((char *)loc.getBuffer(), 0, entry_sz);
memset((char*)loc.getBuffer(), 0, entry_sz);
continue;
}
}
@@ -892,7 +892,7 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
unsigned int addend = get_addend(&*i, elf);
if (addr.value == 0) {
addr.value = addend;
addr.serialize(const_cast<char *>(loc.getBuffer()), entry_sz,
addr.serialize(const_cast<char*>(loc.getBuffer()), entry_sz,
elf->getClass(), elf->getData());
} else if (addr.value != addend) {
fprintf(stderr,
@@ -928,21 +928,21 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
// before any other). Otherwise, replace the first entry and keep the
// original pointer.
std::sort(init_array_relocs.begin(), init_array_relocs.end(),
[](Rel_Type &a, Rel_Type &b) { return a.r_offset < b.r_offset; });
[](Rel_Type& a, Rel_Type& b) { return a.r_offset < b.r_offset; });
size_t expected = init_array->getAddr();
const size_t zero = 0;
const size_t all = SIZE_MAX;
const char *data = init_array->getData();
const char* data = init_array->getData();
size_t length = Elf_Addr::size(elf->getClass());
size_t off = 0;
for (; off < init_array_relocs.size(); off++) {
auto &r = init_array_relocs[off];
auto& r = init_array_relocs[off];
if (r.r_offset >= expected + length &&
(memcmp(data + off * length, &zero, length) == 0 ||
memcmp(data + off * length, &all, length) == 0)) {
// We found a hole, move the preceding entries.
while (off) {
auto &p = init_array_relocs[--off];
auto& p = init_array_relocs[--off];
if (ELF32_R_TYPE(p.r_info) == rel_type) {
unsigned int addend = get_addend(&p, elf);
p.r_offset += length;
@@ -970,12 +970,12 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
} else {
// Use relocated value of DT_INIT_ARRAY's first entry for the
// function to be called by the injected code.
auto &rel = init_array_relocs[0];
auto& rel = init_array_relocs[0];
unsigned int addend = get_addend(&rel, elf);
if (ELF32_R_TYPE(rel.r_info) == rel_type) {
original_init = addend;
} else if (ELF32_R_TYPE(rel.r_info) == rel_type2) {
ElfSymtab_Section *symtab = (ElfSymtab_Section *)section->getLink();
ElfSymtab_Section* symtab = (ElfSymtab_Section*)section->getLink();
original_init =
symtab->syms[ELF32_R_SYM(rel.r_info)].value.getValue() + addend;
} else {
@@ -1005,15 +1005,15 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
// section temporarily (it will be restored to a null value before any code
// can actually use it)
if (elf->getSegmentByType(PT_GNU_RELRO)) {
ElfSection *gnu_versym = dyn->getSectionForType(DT_VERSYM);
auto lookup = [&symtab, &gnu_versym](const char *symbol) {
Elf_SymValue *sym_value = symtab->lookup(symbol, STT(FUNC));
ElfSection* gnu_versym = dyn->getSectionForType(DT_VERSYM);
auto lookup = [&symtab, &gnu_versym](const char* symbol) {
Elf_SymValue* sym_value = symtab->lookup(symbol, STT(FUNC));
if (!sym_value) {
symtab->syms.emplace_back();
sym_value = &symtab->syms.back();
symtab->grow(symtab->syms.size() * symtab->getEntSize());
sym_value->name =
((ElfStrtab_Section *)symtab->getLink())->getStr(symbol);
((ElfStrtab_Section*)symtab->getLink())->getStr(symbol);
sym_value->info = ELF32_ST_INFO(STB_GLOBAL, STT_FUNC);
sym_value->other = STV_DEFAULT;
new (&sym_value->value) ElfLocation(nullptr, 0, ElfLocation::ABSOLUTE);
@@ -1031,14 +1031,14 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
return sym_value;
};
Elf_SymValue *mprotect = lookup("mprotect");
Elf_SymValue *sysconf = lookup("sysconf");
Elf_SymValue* mprotect = lookup("mprotect");
Elf_SymValue* sysconf = lookup("sysconf");
// Add relocations for the mprotect and sysconf symbols.
auto add_relocation_to = [&new_rels, &symtab, rel_type2](
Elf_SymValue *symbol, unsigned int location) {
Elf_SymValue* symbol, unsigned int location) {
new_rels.emplace_back();
Rel_Type &rel = new_rels.back();
Rel_Type& rel = new_rels.back();
memset(&rel, 0, sizeof(rel));
rel.r_info = ELF32_R_INFO(
std::distance(symtab->syms.begin(),
@@ -1050,7 +1050,7 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
// Find the beginning of the bss section, and use an aligned location in
// there for the relocation.
for (ElfSection *s = elf->getSection(1); s != nullptr; s = s->getNext()) {
for (ElfSection* s = elf->getSection(1); s != nullptr; s = s->getNext()) {
if (s->getType() != SHT_NOBITS ||
(s->getFlags() & (SHF_TLS | SHF_WRITE)) != SHF_WRITE) {
continue;
@@ -1076,13 +1076,13 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
section->rels.assign(new_rels.begin(), new_rels.end());
section->shrink(new_rels.size() * section->getEntSize());
ElfRelHackCode_Section *relhackcode =
ElfRelHackCode_Section* relhackcode =
new ElfRelHackCode_Section(relhackcode_section, *elf, *relhack,
original_init, mprotect_cb, sysconf_cb);
// Find the first executable section, and insert the relhack code before
// that. The relhack data is inserted between .rel.dyn and .rel.plt.
ElfSection *first_executable = nullptr;
for (ElfSection *s = elf->getSection(1); s != nullptr; s = s->getNext()) {
ElfSection* first_executable = nullptr;
for (ElfSection* s = elf->getSection(1); s != nullptr; s = s->getNext()) {
if (s->getFlags() & SHF_EXECINSTR) {
first_executable = s;
break;
@@ -1115,13 +1115,13 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
// PT_LOAD for just both of them because they are not considered relocatable.
// But they are, in fact, kind of relocatable, albeit with some manual work.
// Which we'll do here.
ElfSegment *eh_frame_segment = elf->getSegmentByType(PT_GNU_EH_FRAME);
ElfSection *eh_frame_hdr =
ElfSegment* eh_frame_segment = elf->getSegmentByType(PT_GNU_EH_FRAME);
ElfSection* eh_frame_hdr =
eh_frame_segment ? eh_frame_segment->getFirstSection() : nullptr;
// The .eh_frame section usually follows the eh_frame_hdr section.
ElfSection *eh_frame = eh_frame_hdr ? eh_frame_hdr->getNext() : nullptr;
ElfSection *first = eh_frame_hdr;
ElfSection *second = eh_frame;
ElfSection* eh_frame = eh_frame_hdr ? eh_frame_hdr->getNext() : nullptr;
ElfSection* first = eh_frame_hdr;
ElfSection* second = eh_frame;
if (eh_frame && strcmp(eh_frame->getName(), ".eh_frame")) {
// But sometimes it appears *before* the eh_frame_hdr section.
eh_frame = eh_frame_hdr->getPrevious();
@@ -1140,7 +1140,7 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
// this would save.
unsigned int distance = second->getAddr() - first->getAddr();
unsigned int origAddr = eh_frame->getAddr();
ElfSection *previous = first->getPrevious();
ElfSection* previous = first->getPrevious();
first->getShdr().sh_addr = (previous->getAddr() + previous->getSize() +
first->getAddrAlign() - 1) &
~(first->getAddrAlign() - 1);
@@ -1160,20 +1160,20 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
}
// Adjust PT_LOAD segments
for (ElfSegment *segment = elf->getSegmentByType(PT_LOAD); segment;
for (ElfSegment* segment = elf->getSegmentByType(PT_LOAD); segment;
segment = elf->getSegmentByType(PT_LOAD, segment)) {
maybe_split_segment(elf, segment);
}
// Ensure Elf sections will be at their final location.
elf->normalize();
ElfLocation *init =
ElfLocation* init =
new ElfLocation(relhackcode, relhackcode->getEntryPoint());
if (init_array) {
// Adjust the first DT_INIT_ARRAY entry to point at the injected code
// by transforming its relocation into a relative one pointing to the
// address of the injected code.
Rel_Type *rel = &section->rels[init_array_insert];
Rel_Type* rel = &section->rels[init_array_insert];
rel->r_info = ELF32_R_INFO(0, rel_type); // Set as a relative relocation
set_relative_reloc(rel, elf, init->getValue());
} else if (!dyn->setValueForType(DT_INIT, init)) {
@@ -1188,13 +1188,13 @@ int do_relocation_section(Elf *elf, unsigned int rel_type,
return 0;
}
static inline int backup_file(const char *name) {
static inline int backup_file(const char* name) {
std::string fname(name);
fname += ".bak";
return rename(name, fname.c_str());
}
void do_file(const char *name, bool backup = false, bool force = false) {
void do_file(const char* name, bool backup = false, bool force = false) {
std::ifstream file(name, std::ios::in | std::ios::binary);
Elf elf(file);
unsigned int size = elf.getSize();
@@ -1204,7 +1204,7 @@ void do_file(const char *name, bool backup = false, bool force = false) {
return;
}
for (ElfSection *section = elf.getSection(1); section != nullptr;
for (ElfSection* section = elf.getSection(1); section != nullptr;
section = section->getNext()) {
if (section->getName() &&
(strncmp(section->getName(), ".elfhack.", 9) == 0)) {
@@ -1242,7 +1242,7 @@ void do_file(const char *name, bool backup = false, bool force = false) {
}
}
void undo_file(const char *name, bool backup = false) {
void undo_file(const char* name, bool backup = false) {
std::ifstream file(name, std::ios::in | std::ios::binary);
Elf elf(file);
unsigned int size = elf.getSize();
@@ -1253,7 +1253,7 @@ void undo_file(const char *name, bool backup = false) {
}
ElfSection *data = nullptr, *text = nullptr;
for (ElfSection *section = elf.getSection(1); section != nullptr;
for (ElfSection* section = elf.getSection(1); section != nullptr;
section = section->getNext()) {
if (section->getName() && (strcmp(section->getName(), elfhack_data) == 0))
data = section;
@@ -1270,8 +1270,8 @@ void undo_file(const char *name, bool backup = false) {
// the segment that contains them both and the following segment.
// When the elfhack sections are in separate segments, try to merge
// those segments.
ElfSegment *first = data->getSegmentByType(PT_LOAD);
ElfSegment *second = text->getSegmentByType(PT_LOAD);
ElfSegment* first = data->getSegmentByType(PT_LOAD);
ElfSegment* second = text->getSegmentByType(PT_LOAD);
if (first == second) {
second = elf.getSegmentByType(PT_LOAD, first);
}
@@ -1283,7 +1283,7 @@ void undo_file(const char *name, bool backup = false) {
}
// Move sections from the second PT_LOAD to the first, and remove the
// second PT_LOAD segment.
for (std::list<ElfSection *>::iterator section = second->begin();
for (std::list<ElfSection*>::iterator section = second->begin();
section != second->end(); ++section)
first->addSection(*section);
@@ -1300,12 +1300,12 @@ void undo_file(const char *name, bool backup = false) {
}
}
int main(int argc, char *argv[]) {
int main(int argc, char* argv[]) {
int arg;
bool backup = false;
bool force = false;
bool revert = false;
char *lastSlash = rindex(argv[0], '/');
char* lastSlash = rindex(argv[0], '/');
if (lastSlash != nullptr) rundir = strndup(argv[0], lastSlash - argv[0]);
for (arg = 1; arg < argc; arg++) {
if (strcmp(argv[arg], "-f") == 0)

View File

@@ -59,7 +59,7 @@ class FixedSizeData {
typedef Wrapper Type64;
template <class endian, typename R, typename T>
static void swap(T &t, R &r) {
static void swap(T& t, R& r) {
r.value = endian::swap(t.value);
}
};
@@ -70,7 +70,7 @@ class Elf_Ehdr_Traits {
typedef Elf64_Ehdr Type64;
template <class endian, typename R, typename T>
static void swap(T &t, R &r);
static void swap(T& t, R& r);
};
class Elf_Phdr_Traits {
@@ -79,7 +79,7 @@ class Elf_Phdr_Traits {
typedef Elf64_Phdr Type64;
template <class endian, typename R, typename T>
static void swap(T &t, R &r);
static void swap(T& t, R& r);
};
class Elf_Shdr_Traits {
@@ -88,7 +88,7 @@ class Elf_Shdr_Traits {
typedef Elf64_Shdr Type64;
template <class endian, typename R, typename T>
static void swap(T &t, R &r);
static void swap(T& t, R& r);
};
class Elf_Dyn_Traits {
@@ -97,7 +97,7 @@ class Elf_Dyn_Traits {
typedef Elf64_Dyn Type64;
template <class endian, typename R, typename T>
static void swap(T &t, R &r);
static void swap(T& t, R& r);
};
class Elf_Sym_Traits {
@@ -106,7 +106,7 @@ class Elf_Sym_Traits {
typedef Elf64_Sym Type64;
template <class endian, typename R, typename T>
static void swap(T &t, R &r);
static void swap(T& t, R& r);
};
class Elf_Rel_Traits {
@@ -115,7 +115,7 @@ class Elf_Rel_Traits {
typedef Elf64_Rel Type64;
template <class endian, typename R, typename T>
static void swap(T &t, R &r);
static void swap(T& t, R& r);
};
class Elf_Rela_Traits {
@@ -124,13 +124,13 @@ class Elf_Rela_Traits {
typedef Elf64_Rela Type64;
template <class endian, typename R, typename T>
static void swap(T &t, R &r);
static void swap(T& t, R& r);
};
class ElfValue {
public:
virtual unsigned int getValue() { return 0; }
virtual ElfSection *getSection() { return nullptr; }
virtual ElfSection* getSection() { return nullptr; }
};
class ElfPlainValue : public ElfValue {
@@ -142,47 +142,47 @@ class ElfPlainValue : public ElfValue {
};
class ElfLocation : public ElfValue {
ElfSection *section;
ElfSection* section;
unsigned int offset;
public:
enum position { ABSOLUTE, RELATIVE };
ElfLocation() : section(nullptr), offset(0){};
ElfLocation(ElfSection *section, unsigned int off,
ElfLocation(ElfSection* section, unsigned int off,
enum position pos = RELATIVE);
ElfLocation(unsigned int location, Elf *elf);
ElfLocation(unsigned int location, Elf* elf);
unsigned int getValue();
ElfSection *getSection() { return section; }
const char *getBuffer();
ElfSection* getSection() { return section; }
const char* getBuffer();
};
class ElfSize : public ElfValue {
ElfSection *section;
ElfSection* section;
public:
ElfSize(ElfSection *s) : section(s){};
ElfSize(ElfSection* s) : section(s){};
unsigned int getValue();
ElfSection *getSection() { return section; }
ElfSection* getSection() { return section; }
};
class ElfEntSize : public ElfValue {
ElfSection *section;
ElfSection* section;
public:
ElfEntSize(ElfSection *s) : section(s){};
ElfEntSize(ElfSection* s) : section(s){};
unsigned int getValue();
ElfSection *getSection() { return section; }
ElfSection* getSection() { return section; }
};
template <typename T>
class serializable : public T::Type32 {
public:
serializable(){};
serializable(const typename T::Type32 &p) : T::Type32(p){};
serializable(const typename T::Type32& p) : T::Type32(p){};
private:
template <typename R>
void init(const char *buf, size_t len, char ei_data) {
void init(const char* buf, size_t len, char ei_data) {
R e;
assert(len >= sizeof(e));
memcpy(&e, buf, sizeof(e));
@@ -197,20 +197,20 @@ class serializable : public T::Type32 {
}
template <typename R>
void serialize(const char *buf, size_t len, char ei_data) {
void serialize(const char* buf, size_t len, char ei_data) {
assert(len >= sizeof(R));
if (ei_data == ELFDATA2LSB) {
T::template swap<little_endian>(*this, *(R *)buf);
T::template swap<little_endian>(*this, *(R*)buf);
return;
} else if (ei_data == ELFDATA2MSB) {
T::template swap<big_endian>(*this, *(R *)buf);
T::template swap<big_endian>(*this, *(R*)buf);
return;
}
throw std::runtime_error("Unsupported ELF data encoding");
}
public:
serializable(const char *buf, size_t len, char ei_class, char ei_data) {
serializable(const char* buf, size_t len, char ei_class, char ei_data) {
if (ei_class == ELFCLASS32) {
init<typename T::Type32>(buf, len, ei_data);
return;
@@ -221,37 +221,37 @@ class serializable : public T::Type32 {
throw std::runtime_error("Unsupported ELF class");
}
serializable(std::ifstream &file, char ei_class, char ei_data) {
serializable(std::ifstream& file, char ei_class, char ei_data) {
if (ei_class == ELFCLASS32) {
typename T::Type32 e;
file.read((char *)&e, sizeof(e));
init<typename T::Type32>((char *)&e, sizeof(e), ei_data);
file.read((char*)&e, sizeof(e));
init<typename T::Type32>((char*)&e, sizeof(e), ei_data);
return;
} else if (ei_class == ELFCLASS64) {
typename T::Type64 e;
file.read((char *)&e, sizeof(e));
init<typename T::Type64>((char *)&e, sizeof(e), ei_data);
file.read((char*)&e, sizeof(e));
init<typename T::Type64>((char*)&e, sizeof(e), ei_data);
return;
}
throw std::runtime_error("Unsupported ELF class or data encoding");
}
void serialize(std::ofstream &file, char ei_class, char ei_data) {
void serialize(std::ofstream& file, char ei_class, char ei_data) {
if (ei_class == ELFCLASS32) {
typename T::Type32 e;
serialize<typename T::Type32>((char *)&e, sizeof(e), ei_data);
file.write((char *)&e, sizeof(e));
serialize<typename T::Type32>((char*)&e, sizeof(e), ei_data);
file.write((char*)&e, sizeof(e));
return;
} else if (ei_class == ELFCLASS64) {
typename T::Type64 e;
serialize<typename T::Type64>((char *)&e, sizeof(e), ei_data);
file.write((char *)&e, sizeof(e));
serialize<typename T::Type64>((char*)&e, sizeof(e), ei_data);
file.write((char*)&e, sizeof(e));
return;
}
throw std::runtime_error("Unsupported ELF class or data encoding");
}
void serialize(char *buf, size_t len, char ei_class, char ei_data) {
void serialize(char* buf, size_t len, char ei_class, char ei_data) {
if (ei_class == ELFCLASS32) {
serialize<typename T::Type32>(buf, len, ei_data);
return;
@@ -275,20 +275,20 @@ typedef serializable<Elf_Shdr_Traits> Elf_Shdr;
class Elf {
public:
Elf(std::ifstream &file);
Elf(std::ifstream& file);
~Elf();
/* index == -1 is treated as index == ehdr.e_shstrndx */
ElfSection *getSection(int index);
ElfSection* getSection(int index);
ElfSection *getSectionAt(unsigned int offset);
ElfSection* getSectionAt(unsigned int offset);
ElfSegment *getSegmentByType(unsigned int type, ElfSegment *last = nullptr);
ElfSegment* getSegmentByType(unsigned int type, ElfSegment* last = nullptr);
ElfDynamic_Section *getDynSection();
ElfDynamic_Section* getDynSection();
void normalize();
void write(std::ofstream &file);
void write(std::ofstream& file);
char getClass();
char getData();
@@ -296,46 +296,46 @@ class Elf {
char getMachine();
unsigned int getSize();
void insertSegmentAfter(ElfSegment *previous, ElfSegment *segment) {
std::vector<ElfSegment *>::iterator prev =
void insertSegmentAfter(ElfSegment* previous, ElfSegment* segment) {
std::vector<ElfSegment*>::iterator prev =
std::find(segments.begin(), segments.end(), previous);
segments.insert(prev + 1, segment);
}
void removeSegment(ElfSegment *segment);
void removeSegment(ElfSegment* segment);
private:
Elf_Ehdr *ehdr;
Elf_Ehdr* ehdr;
ElfLocation eh_entry;
ElfStrtab_Section *eh_shstrndx;
ElfSection **sections;
std::vector<ElfSegment *> segments;
ElfStrtab_Section* eh_shstrndx;
ElfSection** sections;
std::vector<ElfSegment*> segments;
ElfSection *shdr_section, *phdr_section;
/* Values used only during initialization */
Elf_Shdr **tmp_shdr;
std::ifstream *tmp_file;
Elf_Shdr** tmp_shdr;
std::ifstream* tmp_file;
};
class ElfSection {
public:
typedef union {
ElfSection *section;
ElfSection* section;
int index;
} SectionInfo;
ElfSection(Elf_Shdr &s, std::ifstream *file, Elf *parent);
ElfSection(Elf_Shdr& s, std::ifstream* file, Elf* parent);
virtual ~ElfSection() { free(data); }
const char *getName() { return name; }
const char* getName() { return name; }
unsigned int getType() { return shdr.sh_type; }
unsigned int getFlags() { return shdr.sh_flags; }
unsigned int getAddr();
unsigned int getSize() { return shdr.sh_size; }
unsigned int getAddrAlign() { return shdr.sh_addralign; }
unsigned int getEntSize() { return shdr.sh_entsize; }
const char *getData() { return data; }
ElfSection *getLink() { return link; }
const char* getData() { return data; }
ElfSection* getLink() { return link; }
SectionInfo getInfo() { return info; }
void shrink(unsigned int newsize) {
@@ -347,7 +347,7 @@ class ElfSection {
void grow(unsigned int newsize) {
if (newsize > shdr.sh_size) {
data = static_cast<char *>(realloc(data, newsize));
data = static_cast<char*>(realloc(data, newsize));
memset(data + shdr.sh_size, 0, newsize - shdr.sh_size);
shdr.sh_size = newsize;
markDirty();
@@ -356,10 +356,10 @@ class ElfSection {
unsigned int getOffset();
int getIndex();
Elf_Shdr &getShdr();
Elf_Shdr& getShdr();
ElfSection *getNext() { return next; }
ElfSection *getPrevious() { return previous; }
ElfSection* getNext() { return next; }
ElfSection* getPrevious() { return previous; }
virtual bool isRelocatable() {
return ((getType() == SHT_SYMTAB) || (getType() == SHT_STRTAB) ||
@@ -371,7 +371,7 @@ class ElfSection {
(getFlags() & SHF_ALLOC);
}
void insertAfter(ElfSection *section, bool dirty = true) {
void insertAfter(ElfSection* section, bool dirty = true) {
if (previous != nullptr) previous->next = next;
if (next != nullptr) next->previous = previous;
previous = section;
@@ -385,7 +385,7 @@ class ElfSection {
insertInSegments(section->segments);
}
virtual void insertBefore(ElfSection *section, bool dirty = true) {
virtual void insertBefore(ElfSection* section, bool dirty = true) {
if (previous != nullptr) previous->next = next;
if (next != nullptr) next->previous = previous;
next = section;
@@ -407,49 +407,49 @@ class ElfSection {
if (next) next->markDirty();
}
virtual void serialize(std::ofstream &file, char ei_class, char ei_data) {
virtual void serialize(std::ofstream& file, char ei_class, char ei_data) {
if (getType() == SHT_NOBITS) return;
file.seekp(getOffset());
file.write(data, getSize());
}
ElfSegment *getSegmentByType(unsigned int type);
ElfSegment* getSegmentByType(unsigned int type);
private:
friend class ElfSegment;
void addToSegment(ElfSegment *segment) { segments.push_back(segment); }
void addToSegment(ElfSegment* segment) { segments.push_back(segment); }
void removeFromSegment(ElfSegment *segment) {
std::vector<ElfSegment *>::iterator i =
void removeFromSegment(ElfSegment* segment) {
std::vector<ElfSegment*>::iterator i =
std::find(segments.begin(), segments.end(), segment);
segments.erase(i, i + 1);
}
void insertInSegments(std::vector<ElfSegment *> &segs);
void insertInSegments(std::vector<ElfSegment*>& segs);
protected:
Elf_Shdr shdr;
char *data;
const char *name;
char* data;
const char* name;
private:
ElfSection *link;
ElfSection* link;
SectionInfo info;
ElfSection *next, *previous;
int index;
std::vector<ElfSegment *> segments;
std::vector<ElfSegment*> segments;
};
class ElfSegment {
public:
ElfSegment(Elf_Phdr *phdr);
ElfSegment(Elf_Phdr* phdr);
unsigned int getType() { return type; }
unsigned int getFlags() { return flags; }
unsigned int getAlign() { return align; }
ElfSection *getFirstSection() {
ElfSection* getFirstSection() {
return sections.empty() ? nullptr : sections.front();
}
int getVPDiff() { return v_p_diff; }
@@ -458,11 +458,11 @@ class ElfSegment {
unsigned int getOffset();
unsigned int getAddr();
void addSection(ElfSection *section);
void removeSection(ElfSection *section);
void addSection(ElfSection* section);
void removeSection(ElfSection* section);
std::list<ElfSection *>::iterator begin() { return sections.begin(); }
std::list<ElfSection *>::iterator end() { return sections.end(); }
std::list<ElfSection*>::iterator begin() { return sections.begin(); }
std::list<ElfSection*>::iterator end() { return sections.end(); }
void clear();
@@ -471,7 +471,7 @@ class ElfSegment {
int v_p_diff; // Difference between physical and virtual address
unsigned int flags;
unsigned int align;
std::list<ElfSection *> sections;
std::list<ElfSection*> sections;
// The following are only really used for PT_GNU_RELRO until something
// better is found.
unsigned int vaddr;
@@ -480,8 +480,8 @@ class ElfSegment {
class Elf_Ehdr : public serializable<Elf_Ehdr_Traits>, public ElfSection {
public:
Elf_Ehdr(std::ifstream &file, char ei_class, char ei_data);
void serialize(std::ofstream &file, char ei_class, char ei_data) {
Elf_Ehdr(std::ifstream& file, char ei_class, char ei_data);
void serialize(std::ofstream& file, char ei_class, char ei_data) {
serializable<Elf_Ehdr_Traits>::serialize(file, ei_class, ei_data);
}
};
@@ -489,9 +489,9 @@ class Elf_Ehdr : public serializable<Elf_Ehdr_Traits>, public ElfSection {
class Elf_Phdr : public serializable<Elf_Phdr_Traits> {
public:
Elf_Phdr(){};
Elf_Phdr(std::ifstream &file, char ei_class, char ei_data)
Elf_Phdr(std::ifstream& file, char ei_class, char ei_data)
: serializable<Elf_Phdr_Traits>(file, ei_class, ei_data){};
bool contains(ElfSection *section) {
bool contains(ElfSection* section) {
unsigned int size = section->getSize();
unsigned int addr = section->getAddr();
// This may be biased, but should work in most cases
@@ -510,19 +510,19 @@ typedef serializable<Elf_Dyn_Traits> Elf_Dyn;
struct Elf_DynValue {
unsigned int tag;
ElfValue *value;
ElfValue* value;
};
class ElfDynamic_Section : public ElfSection {
public:
ElfDynamic_Section(Elf_Shdr &s, std::ifstream *file, Elf *parent);
ElfDynamic_Section(Elf_Shdr& s, std::ifstream* file, Elf* parent);
~ElfDynamic_Section();
void serialize(std::ofstream &file, char ei_class, char ei_data);
void serialize(std::ofstream& file, char ei_class, char ei_data);
ElfValue *getValueForType(unsigned int tag);
ElfSection *getSectionForType(unsigned int tag);
bool setValueForType(unsigned int tag, ElfValue *val);
ElfValue* getValueForType(unsigned int tag);
ElfSection* getSectionForType(unsigned int tag);
bool setValueForType(unsigned int tag, ElfValue* val);
private:
std::vector<Elf_DynValue> dyns;
@@ -531,7 +531,7 @@ class ElfDynamic_Section : public ElfSection {
typedef serializable<Elf_Sym_Traits> Elf_Sym;
struct Elf_SymValue {
const char *name;
const char* name;
unsigned char info;
unsigned char other;
ElfLocation value;
@@ -543,11 +543,11 @@ struct Elf_SymValue {
class ElfSymtab_Section : public ElfSection {
public:
ElfSymtab_Section(Elf_Shdr &s, std::ifstream *file, Elf *parent);
ElfSymtab_Section(Elf_Shdr& s, std::ifstream* file, Elf* parent);
void serialize(std::ofstream &file, char ei_class, char ei_data);
void serialize(std::ofstream& file, char ei_class, char ei_data);
Elf_SymValue *lookup(const char *name,
Elf_SymValue* lookup(const char* name,
unsigned int type_filter = STT(OBJECT) | STT(FUNC));
// private: // Until we have a real API
@@ -558,7 +558,7 @@ class Elf_Rel : public serializable<Elf_Rel_Traits> {
public:
Elf_Rel() : serializable<Elf_Rel_Traits>(){};
Elf_Rel(std::ifstream &file, char ei_class, char ei_data)
Elf_Rel(std::ifstream& file, char ei_class, char ei_data)
: serializable<Elf_Rel_Traits>(file, ei_class, ei_data){};
static const unsigned int sh_type = SHT_REL;
@@ -570,7 +570,7 @@ class Elf_Rela : public serializable<Elf_Rela_Traits> {
public:
Elf_Rela() : serializable<Elf_Rela_Traits>(){};
Elf_Rela(std::ifstream &file, char ei_class, char ei_data)
Elf_Rela(std::ifstream& file, char ei_class, char ei_data)
: serializable<Elf_Rela_Traits>(file, ei_class, ei_data){};
static const unsigned int sh_type = SHT_RELA;
@@ -581,7 +581,7 @@ class Elf_Rela : public serializable<Elf_Rela_Traits> {
template <class Rel>
class ElfRel_Section : public ElfSection {
public:
ElfRel_Section(Elf_Shdr &s, std::ifstream *file, Elf *parent)
ElfRel_Section(Elf_Shdr& s, std::ifstream* file, Elf* parent)
: ElfSection(s, file, parent) {
int pos = file->tellg();
file->seekg(shdr.sh_offset);
@@ -592,7 +592,7 @@ class ElfRel_Section : public ElfSection {
file->seekg(pos);
}
void serialize(std::ofstream &file, char ei_class, char ei_data) {
void serialize(std::ofstream& file, char ei_class, char ei_data) {
for (typename std::vector<Rel>::iterator i = rels.begin(); i != rels.end();
++i)
(*i).serialize(file, ei_class, ei_data);
@@ -603,7 +603,7 @@ class ElfRel_Section : public ElfSection {
class ElfStrtab_Section : public ElfSection {
public:
ElfStrtab_Section(Elf_Shdr &s, std::ifstream *file, Elf *parent)
ElfStrtab_Section(Elf_Shdr& s, std::ifstream* file, Elf* parent)
: ElfSection(s, file, parent) {
table.push_back(table_storage(data, shdr.sh_size));
}
@@ -614,22 +614,22 @@ class ElfStrtab_Section : public ElfSection {
delete[] t->buf;
}
const char *getStr(unsigned int index);
const char* getStr(unsigned int index);
const char *getStr(const char *string);
const char* getStr(const char* string);
unsigned int getStrIndex(const char *string);
unsigned int getStrIndex(const char* string);
void serialize(std::ofstream &file, char ei_class, char ei_data);
void serialize(std::ofstream& file, char ei_class, char ei_data);
private:
struct table_storage {
unsigned int size, used;
char *buf;
char* buf;
table_storage() : size(4096), used(0), buf(new char[4096]) {}
table_storage(const char *data, unsigned int sz)
: size(sz), used(sz), buf(const_cast<char *>(data)) {}
table_storage(const char* data, unsigned int sz)
: size(sz), used(sz), buf(const_cast<char*>(data)) {}
};
std::vector<table_storage> table;
};
@@ -643,28 +643,28 @@ inline char Elf::getType() { return ehdr->e_type; }
inline char Elf::getMachine() { return ehdr->e_machine; }
inline unsigned int Elf::getSize() {
ElfSection *section;
ElfSection* section;
for (section = shdr_section /* It's usually not far from the end */;
section->getNext() != nullptr; section = section->getNext())
;
return section->getOffset() + section->getSize();
}
inline ElfSegment *ElfSection::getSegmentByType(unsigned int type) {
for (std::vector<ElfSegment *>::iterator seg = segments.begin();
inline ElfSegment* ElfSection::getSegmentByType(unsigned int type) {
for (std::vector<ElfSegment*>::iterator seg = segments.begin();
seg != segments.end(); ++seg)
if ((*seg)->getType() == type) return *seg;
return nullptr;
}
inline void ElfSection::insertInSegments(std::vector<ElfSegment *> &segs) {
for (std::vector<ElfSegment *>::iterator it = segs.begin(); it != segs.end();
inline void ElfSection::insertInSegments(std::vector<ElfSegment*>& segs) {
for (std::vector<ElfSegment*>::iterator it = segs.begin(); it != segs.end();
++it) {
(*it)->addSection(this);
}
}
inline ElfLocation::ElfLocation(ElfSection *section, unsigned int off,
inline ElfLocation::ElfLocation(ElfSection* section, unsigned int off,
enum position pos)
: section(section) {
if ((pos == ABSOLUTE) && section)
@@ -673,7 +673,7 @@ inline ElfLocation::ElfLocation(ElfSection *section, unsigned int off,
offset = off;
}
inline ElfLocation::ElfLocation(unsigned int location, Elf *elf) {
inline ElfLocation::ElfLocation(unsigned int location, Elf* elf) {
section = elf->getSectionAt(location);
offset = location - (section ? section->getAddr() : 0);
}
@@ -682,7 +682,7 @@ inline unsigned int ElfLocation::getValue() {
return (section ? section->getAddr() : 0) + offset;
}
inline const char *ElfLocation::getBuffer() {
inline const char* ElfLocation::getBuffer() {
return section ? section->getData() + offset : nullptr;
}

View File

@@ -30,7 +30,7 @@
// trampoline, corresponding to the code GCC generates with long_call.
#ifdef __arm__
__attribute__((section(".text._init_trampoline"), naked)) int init_trampoline(
int argc, char **argv, char **env) {
int argc, char** argv, char** env) {
__asm__ __volatile__(
// thumb doesn't allow to use r12/ip with ldr, and thus would require an
// additional push/pop to save/restore the modified register, which would
@@ -46,13 +46,13 @@ __attribute__((section(".text._init_trampoline"), naked)) int init_trampoline(
#endif
extern __attribute__((visibility("hidden"))) void original_init(int argc,
char **argv,
char **env);
char** argv,
char** env);
extern __attribute__((visibility("hidden"))) Elf32_Rel relhack[];
extern __attribute__((visibility("hidden"))) Elf_Ehdr elf_header;
extern __attribute__((visibility("hidden"))) int (*mprotect_cb)(void *addr,
extern __attribute__((visibility("hidden"))) int (*mprotect_cb)(void* addr,
size_t len,
int prot);
extern __attribute__((visibility("hidden"))) long (*sysconf_cb)(int name);
@@ -60,24 +60,24 @@ extern __attribute__((visibility("hidden"))) char relro_start[];
extern __attribute__((visibility("hidden"))) char relro_end[];
static inline __attribute__((always_inline)) void do_relocations(void) {
Elf32_Rel *rel;
Elf32_Rel* rel;
Elf_Addr *ptr, *start;
for (rel = relhack; rel->r_offset; rel++) {
start = (Elf_Addr *)((intptr_t)&elf_header + rel->r_offset);
start = (Elf_Addr*)((intptr_t)&elf_header + rel->r_offset);
for (ptr = start; ptr < &start[rel->r_info]; ptr++)
*ptr += (intptr_t)&elf_header;
}
}
__attribute__((section(".text._init_noinit"))) int init_noinit(int argc,
char **argv,
char **env) {
char** argv,
char** env) {
do_relocations();
return 0;
}
__attribute__((section(".text._init"))) int init(int argc, char **argv,
char **env) {
__attribute__((section(".text._init"))) int init(int argc, char** argv,
char** env) {
do_relocations();
original_init(argc, argv, env);
// Ensure there is no tail-call optimization, avoiding the use of the
@@ -96,12 +96,12 @@ static inline __attribute__((always_inline)) void do_relocations_with_relro(
// By the time the injected code runs, the relro segment is read-only. But
// we want to apply relocations in it, so we set it r/w first. We'll restore
// it to read-only in relro_post.
mprotect_cb((void *)aligned_relro_start,
mprotect_cb((void*)aligned_relro_start,
aligned_relro_end - aligned_relro_start, PROT_READ | PROT_WRITE);
do_relocations();
mprotect_cb((void *)aligned_relro_start,
mprotect_cb((void*)aligned_relro_start,
aligned_relro_end - aligned_relro_start, PROT_READ);
// mprotect_cb and sysconf_cb are allocated in .bss, so we need to restore
// them to a NULL value.
@@ -110,14 +110,14 @@ static inline __attribute__((always_inline)) void do_relocations_with_relro(
}
__attribute__((section(".text._init_noinit_relro"))) int init_noinit_relro(
int argc, char **argv, char **env) {
int argc, char** argv, char** env) {
do_relocations_with_relro();
return 0;
}
__attribute__((section(".text._init_relro"))) int init_relro(int argc,
char **argv,
char **env) {
char** argv,
char** env) {
do_relocations_with_relro();
original_init(argc, argv, env);
return 0;

View File

@@ -91,7 +91,7 @@ DEF(times)
# include "test.c"
# undef DEF
const char *strings[] = {
const char* strings[] = {
# define DEF(w) str_##w,
# include "test.c"
# include "test.c"
@@ -101,7 +101,7 @@ const char *strings[] = {
/* Create a hole between two zones of relative relocations */
const int hole[] = {42, 42, 42, 42};
const char *strings2[] = {
const char* strings2[] = {
# include "test.c"
# include "test.c"
# include "test.c"

View File

@@ -46,7 +46,7 @@ class NullPrincipalURI final : public nsIURI, public nsISizeOf {
private:
NullPrincipalURI();
NullPrincipalURI(const NullPrincipalURI &aOther);
NullPrincipalURI(const NullPrincipalURI& aOther);
~NullPrincipalURI() {}
@@ -54,22 +54,22 @@ class NullPrincipalURI final : public nsIURI, public nsISizeOf {
nsAutoCStringN<NSID_LENGTH> mPath;
nsresult Clone(nsIURI **aURI);
nsresult SetSpecInternal(const nsACString &input);
nsresult SetScheme(const nsACString &input);
nsresult SetUserPass(const nsACString &input);
nsresult SetUsername(const nsACString &input);
nsresult SetPassword(const nsACString &input);
nsresult SetHostPort(const nsACString &aValue);
nsresult SetHost(const nsACString &input);
nsresult Clone(nsIURI** aURI);
nsresult SetSpecInternal(const nsACString& input);
nsresult SetScheme(const nsACString& input);
nsresult SetUserPass(const nsACString& input);
nsresult SetUsername(const nsACString& input);
nsresult SetPassword(const nsACString& input);
nsresult SetHostPort(const nsACString& aValue);
nsresult SetHost(const nsACString& input);
nsresult SetPort(int32_t port);
nsresult SetPathQueryRef(const nsACString &input);
nsresult SetRef(const nsACString &input);
nsresult SetFilePath(const nsACString &input);
nsresult SetQuery(const nsACString &input);
nsresult SetQueryWithEncoding(const nsACString &input,
const Encoding *encoding);
bool Deserialize(const mozilla::ipc::URIParams &);
nsresult SetPathQueryRef(const nsACString& input);
nsresult SetRef(const nsACString& input);
nsresult SetFilePath(const nsACString& input);
nsresult SetQuery(const nsACString& input);
nsresult SetQueryWithEncoding(const nsACString& input,
const Encoding* encoding);
bool Deserialize(const mozilla::ipc::URIParams&);
public:
class Mutator final : public nsIURIMutator,
@@ -77,17 +77,17 @@ class NullPrincipalURI final : public nsIURI, public nsISizeOf {
NS_DECL_ISUPPORTS
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
NS_IMETHOD Deserialize(const mozilla::ipc::URIParams &aParams) override {
NS_IMETHOD Deserialize(const mozilla::ipc::URIParams& aParams) override {
return InitFromIPCParams(aParams);
}
NS_IMETHOD Finalize(nsIURI **aURI) override {
NS_IMETHOD Finalize(nsIURI** aURI) override {
mURI.forget(aURI);
return NS_OK;
}
NS_IMETHOD SetSpec(const nsACString &aSpec,
nsIURIMutator **aMutator) override {
NS_IMETHOD SetSpec(const nsACString& aSpec,
nsIURIMutator** aMutator) override {
if (aMutator) {
nsCOMPtr<nsIURIMutator> mutator = this;
mutator.forget(aMutator);

View File

@@ -9,7 +9,7 @@
using mozilla::OriginAttributes;
using mozilla::Preferences;
static void TestSuffix(const OriginAttributes &attrs) {
static void TestSuffix(const OriginAttributes& attrs) {
nsAutoCString suffix;
attrs.CreateSuffix(suffix);
@@ -20,7 +20,7 @@ static void TestSuffix(const OriginAttributes &attrs) {
EXPECT_EQ(attrs, attrsFromSuffix);
}
static void TestFPD(const nsAString &spec, const nsAString &fpd) {
static void TestFPD(const nsAString& spec, const nsAString& fpd) {
OriginAttributes attrs;
nsCOMPtr<nsIURI> url;
ASSERT_EQ(NS_NewURI(getter_AddRefs(url), spec), NS_OK);

View File

@@ -38,41 +38,41 @@ NS_IMPL_ISUPPORTS(nsChromeProtocolHandler, nsIProtocolHandler,
// nsIProtocolHandler methods:
NS_IMETHODIMP
nsChromeProtocolHandler::GetScheme(nsACString &result) {
nsChromeProtocolHandler::GetScheme(nsACString& result) {
result.AssignLiteral("chrome");
return NS_OK;
}
NS_IMETHODIMP
nsChromeProtocolHandler::GetDefaultPort(int32_t *result) {
nsChromeProtocolHandler::GetDefaultPort(int32_t* result) {
*result = -1; // no port for chrome: URLs
return NS_OK;
}
NS_IMETHODIMP
nsChromeProtocolHandler::AllowPort(int32_t port, const char *scheme,
bool *_retval) {
nsChromeProtocolHandler::AllowPort(int32_t port, const char* scheme,
bool* _retval) {
// don't override anything.
*_retval = false;
return NS_OK;
}
NS_IMETHODIMP
nsChromeProtocolHandler::GetProtocolFlags(uint32_t *result) {
nsChromeProtocolHandler::GetProtocolFlags(uint32_t* result) {
*result = URI_STD | URI_IS_UI_RESOURCE | URI_IS_LOCAL_RESOURCE;
return NS_OK;
}
NS_IMETHODIMP
nsChromeProtocolHandler::NewURI(const nsACString &aSpec, const char *aCharset,
nsIURI *aBaseURI, nsIURI **result) {
nsChromeProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
nsIURI* aBaseURI, nsIURI** result) {
return nsChromeProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI,
result);
}
/* static */ nsresult nsChromeProtocolHandler::CreateNewURI(
const nsACString &aSpec, const char *aCharset, nsIURI *aBaseURI,
nsIURI **result) {
const nsACString& aSpec, const char* aCharset, nsIURI* aBaseURI,
nsIURI** result) {
// Chrome: URLs (currently) have no additional structure beyond that provided
// by standard URLs, so there is no "outer" given to CreateInstance
nsresult rv;
@@ -99,8 +99,8 @@ nsChromeProtocolHandler::NewURI(const nsACString &aSpec, const char *aCharset,
}
NS_IMETHODIMP
nsChromeProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
nsIChannel **aResult) {
nsChromeProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
nsIChannel** aResult) {
nsresult rv;
NS_ENSURE_ARG_POINTER(aURI);

View File

@@ -27,8 +27,8 @@ class nsChromeProtocolHandler final : public nsIProtocolHandler,
// nsChromeProtocolHandler methods:
nsChromeProtocolHandler() {}
static nsresult CreateNewURI(const nsACString &aSpec, const char *aCharset,
nsIURI *aBaseURI, nsIURI **result);
static nsresult CreateNewURI(const nsACString& aSpec, const char* aCharset,
nsIURI* aBaseURI, nsIURI** result);
private:
~nsChromeProtocolHandler() {}

View File

@@ -62,8 +62,8 @@ static void usage(void) {
exit(2);
}
static int mkdirs(char *path, mode_t mode) {
char *cp;
static int mkdirs(char* path, mode_t mode) {
char* cp;
struct stat sb;
int res;
int l;
@@ -91,10 +91,10 @@ static int mkdirs(char *path, mode_t mode) {
return res;
}
static uid_t touid(char *owner) {
struct passwd *pw;
static uid_t touid(char* owner) {
struct passwd* pw;
uid_t uid;
char *cp;
char* cp;
pw = getpwnam(owner);
if (pw) return pw->pw_uid;
@@ -103,10 +103,10 @@ static uid_t touid(char *owner) {
return uid;
}
static gid_t togid(char *group) {
struct group *gr;
static gid_t togid(char* group) {
struct group* gr;
gid_t gid;
char *cp;
char* cp;
gr = getgrnam(group);
if (gr) return gr->gr_gid;
@@ -115,8 +115,8 @@ static gid_t togid(char *group) {
return gid;
}
static void copyfile(char *name, char *toname, mode_t mode, char *group,
char *owner, int dotimes, uid_t uid, gid_t gid) {
static void copyfile(char* name, char* toname, mode_t mode, char* group,
char* owner, int dotimes, uid_t uid, gid_t gid) {
int fromfd, tofd = -1, cc, wc, exists;
char buf[BUFSIZ], *bp;
struct stat sb, tosb;
@@ -181,10 +181,10 @@ static void copyfile(char *name, char *toname, mode_t mode, char *group,
#endif
}
static void copydir(char *from, char *to, mode_t mode, char *group, char *owner,
static void copydir(char* from, char* to, mode_t mode, char* group, char* owner,
int dotimes, uid_t uid, gid_t gid) {
DIR *dir;
struct dirent *ep;
DIR* dir;
struct dirent* ep;
struct stat sb;
char *base, *destdir, *direntry, *destentry;
@@ -226,7 +226,7 @@ static void copydir(char *from, char *to, mode_t mode, char *group, char *owner,
closedir(dir);
}
int main(int argc, char **argv) {
int main(int argc, char** argv) {
int onlydir, dodir, dolink, dorelsymlink, dotimes, opt, len, lplen, tdlen,
bnlen, exists;
mode_t mode = 0755;

View File

@@ -27,9 +27,9 @@
# include "sunos4.h"
#endif
char *program;
char* program;
void fail(const char *format, ...) {
void fail(const char* format, ...) {
int error;
va_list ap;
@@ -55,7 +55,7 @@ void fail(const char *format, ...) {
exit(1);
}
char *getcomponent(char *path, char *name) {
char* getcomponent(char* path, char* name) {
if (*path == '\0') return 0;
if (*path == '/') {
*name++ = '/';
@@ -74,19 +74,19 @@ char *getcomponent(char *path, char *name) {
/*
** The static buffer in Unixware's readdir is too small.
*/
struct dirent *readdir(DIR *d) {
static struct dirent *buf = NULL;
struct dirent* readdir(DIR* d) {
static struct dirent* buf = NULL;
if (buf == NULL)
buf = (struct dirent *)malloc(sizeof(struct dirent) + MAXPATHLEN);
buf = (struct dirent*)malloc(sizeof(struct dirent) + MAXPATHLEN);
return (readdir_r(d, buf));
}
#endif
char *ino2name(ino_t ino) {
DIR *dp;
struct dirent *ep;
char *name;
char* ino2name(ino_t ino) {
DIR* dp;
struct dirent* ep;
char* name;
dp = opendir("..");
if (!dp) fail("cannot read parent directory");
@@ -99,27 +99,27 @@ char *ino2name(ino_t ino) {
return name;
}
void *xmalloc(size_t size) {
void *p = malloc(size);
void* xmalloc(size_t size) {
void* p = malloc(size);
if (!p) fail("cannot allocate %u bytes", size);
return p;
}
char *xstrdup(char *s) { return strcpy(xmalloc(strlen(s) + 1), s); }
char* xstrdup(char* s) { return strcpy(xmalloc(strlen(s) + 1), s); }
char *xbasename(char *path) {
char *cp;
char* xbasename(char* path) {
char* cp;
while ((cp = strrchr(path, '/')) && cp[1] == '\0') *cp = '\0';
if (!cp) return path;
return cp + 1;
}
void xchdir(const char *dir) {
void xchdir(const char* dir) {
if (chdir(dir) < 0) fail("cannot change directory to %s", dir);
}
int relatepaths(char *from, char *to, char *outpath) {
int relatepaths(char* from, char* to, char* outpath) {
char *cp, *cp2;
int len;
char buf[NAME_MAX];
@@ -149,7 +149,7 @@ int relatepaths(char *from, char *to, char *outpath) {
return len;
}
void reversepath(char *inpath, char *name, int len, char *outpath) {
void reversepath(char* inpath, char* name, int len, char* outpath) {
char *cp, *cp2;
char buf[NAME_MAX];
struct stat sb;

View File

@@ -23,20 +23,20 @@
#undef NAME_MAX
#define NAME_MAX 256
extern char *program;
extern char* program;
extern void fail(const char *format, ...);
extern char *getcomponent(char *path, char *name);
extern char *ino2name(ino_t ino);
extern void *xmalloc(size_t size);
extern char *xstrdup(char *s);
extern char *xbasename(char *path);
extern void xchdir(const char *dir);
extern void fail(const char* format, ...);
extern char* getcomponent(char* path, char* name);
extern char* ino2name(ino_t ino);
extern void* xmalloc(size_t size);
extern char* xstrdup(char* s);
extern char* xbasename(char* path);
extern void xchdir(const char* dir);
/* Relate absolute pathnames from and to returning the result in outpath. */
extern int relatepaths(char *from, char *to, char *outpath);
extern int relatepaths(char* from, char* to, char* outpath);
/* XXX changes current working directory -- caveat emptor */
extern void reversepath(char *inpath, char *name, int len, char *outpath);
extern void reversepath(char* inpath, char* name, int len, char* outpath);
#endif /* pathsub_h___ */

View File

@@ -62,7 +62,7 @@ nsJSInspector::~nsJSInspector() {
NS_IMETHODIMP
nsJSInspector::EnterNestedEventLoop(JS::Handle<JS::Value> requestor,
uint32_t *out) {
uint32_t* out) {
nsresult rv = NS_OK;
mLastRequestor = requestor;
@@ -88,7 +88,7 @@ nsJSInspector::EnterNestedEventLoop(JS::Handle<JS::Value> requestor,
}
NS_IMETHODIMP
nsJSInspector::ExitNestedEventLoop(uint32_t *out) {
nsJSInspector::ExitNestedEventLoop(uint32_t* out) {
if (mNestedLoopLevel > 0) {
mRequestors.RemoveElementAt(--mNestedLoopLevel);
if (mNestedLoopLevel > 0)
@@ -105,7 +105,7 @@ nsJSInspector::ExitNestedEventLoop(uint32_t *out) {
}
NS_IMETHODIMP
nsJSInspector::GetEventLoopNestLevel(uint32_t *out) {
nsJSInspector::GetEventLoopNestLevel(uint32_t* out) {
*out = mNestedLoopLevel;
return NS_OK;
}

View File

@@ -39,7 +39,7 @@ namespace dom {
using places::History;
#endif
Link::Link(Element *aElement)
Link::Link(Element* aElement)
: mElement(aElement),
mLinkState(eLinkState_NotLink),
mNeedsRegistration(false),
@@ -95,10 +95,10 @@ void Link::CancelDNSPrefetch(nsWrapperCache::FlagsType aDeferredFlag,
}
}
void Link::GetContentPolicyMimeTypeMedia(nsAttrValue &aAsAttr,
nsContentPolicyType &aPolicyType,
nsString &aMimeType,
nsAString &aMedia) {
void Link::GetContentPolicyMimeTypeMedia(nsAttrValue& aAsAttr,
nsContentPolicyType& aPolicyType,
nsString& aMimeType,
nsAString& aMedia) {
nsAutoString as;
mElement->GetAttr(kNameSpaceID_None, nsGkAtoms::as, as);
Link::ParseAsValue(as, aAsAttr);
@@ -185,8 +185,8 @@ void Link::TryDNSPrefetchOrPreconnectOrPrefetchOrPreloadOrPrerender() {
}
}
void Link::UpdatePreload(nsAtom *aName, const nsAttrValue *aValue,
const nsAttrValue *aOldValue) {
void Link::UpdatePreload(nsAtom* aName, const nsAttrValue* aValue,
const nsAttrValue* aOldValue) {
MOZ_ASSERT(mElement->IsInComposedDoc());
if (!ElementHasHref()) {
@@ -340,9 +340,9 @@ void Link::SetLinkState(nsLinkState aState) {
EventStates Link::LinkState() const {
// We are a constant method, but we are just lazily doing things and have to
// track that state. Cast away that constness!
Link *self = const_cast<Link *>(this);
Link* self = const_cast<Link*>(this);
Element *element = self->mElement;
Element* element = self->mElement;
// If we have not yet registered for notifications and need to,
// due to our href changing, register now!
@@ -362,7 +362,7 @@ EventStates Link::LinkState() const {
#ifdef ANDROID
nsCOMPtr<IHistory> history = services::GetHistoryService();
#elif defined(MOZ_PLACES)
History *history = History::GetService();
History* history = History::GetService();
#else
nsCOMPtr<IHistory> history;
#endif
@@ -390,21 +390,21 @@ EventStates Link::LinkState() const {
return EventStates();
}
nsIURI *Link::GetURI() const {
nsIURI* Link::GetURI() const {
// If we have this URI cached, use it.
if (mCachedURI) {
return mCachedURI;
}
// Otherwise obtain it.
Link *self = const_cast<Link *>(this);
Element *element = self->mElement;
Link* self = const_cast<Link*>(this);
Element* element = self->mElement;
mCachedURI = element->GetHrefURI();
return mCachedURI;
}
void Link::SetProtocol(const nsAString &aProtocol) {
void Link::SetProtocol(const nsAString& aProtocol) {
nsCOMPtr<nsIURI> uri(GetURI());
if (!uri) {
// Ignore failures to be compatible with NS4.
@@ -426,7 +426,7 @@ void Link::SetProtocol(const nsAString &aProtocol) {
SetHrefAttribute(uri);
}
void Link::SetPassword(const nsAString &aPassword) {
void Link::SetPassword(const nsAString& aPassword) {
nsCOMPtr<nsIURI> uri(GetURI());
if (!uri) {
// Ignore failures to be compatible with NS4.
@@ -441,7 +441,7 @@ void Link::SetPassword(const nsAString &aPassword) {
}
}
void Link::SetUsername(const nsAString &aUsername) {
void Link::SetUsername(const nsAString& aUsername) {
nsCOMPtr<nsIURI> uri(GetURI());
if (!uri) {
// Ignore failures to be compatible with NS4.
@@ -456,7 +456,7 @@ void Link::SetUsername(const nsAString &aUsername) {
}
}
void Link::SetHost(const nsAString &aHost) {
void Link::SetHost(const nsAString& aHost) {
nsCOMPtr<nsIURI> uri(GetURI());
if (!uri) {
// Ignore failures to be compatible with NS4.
@@ -471,7 +471,7 @@ void Link::SetHost(const nsAString &aHost) {
SetHrefAttribute(uri);
}
void Link::SetHostname(const nsAString &aHostname) {
void Link::SetHostname(const nsAString& aHostname) {
nsCOMPtr<nsIURI> uri(GetURI());
if (!uri) {
// Ignore failures to be compatible with NS4.
@@ -486,7 +486,7 @@ void Link::SetHostname(const nsAString &aHostname) {
SetHrefAttribute(uri);
}
void Link::SetPathname(const nsAString &aPathname) {
void Link::SetPathname(const nsAString& aPathname) {
nsCOMPtr<nsIURI> uri(GetURI());
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
if (!url) {
@@ -503,7 +503,7 @@ void Link::SetPathname(const nsAString &aPathname) {
SetHrefAttribute(uri);
}
void Link::SetSearch(const nsAString &aSearch) {
void Link::SetSearch(const nsAString& aSearch) {
nsCOMPtr<nsIURI> uri(GetURI());
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
if (!url) {
@@ -522,7 +522,7 @@ void Link::SetSearch(const nsAString &aSearch) {
SetHrefAttribute(uri);
}
void Link::SetPort(const nsAString &aPort) {
void Link::SetPort(const nsAString& aPort) {
nsCOMPtr<nsIURI> uri(GetURI());
if (!uri) {
// Ignore failures to be compatible with NS4.
@@ -548,7 +548,7 @@ void Link::SetPort(const nsAString &aPort) {
SetHrefAttribute(uri);
}
void Link::SetHash(const nsAString &aHash) {
void Link::SetHash(const nsAString& aHash) {
nsCOMPtr<nsIURI> uri(GetURI());
if (!uri) {
// Ignore failures to be compatible with NS4.
@@ -564,7 +564,7 @@ void Link::SetHash(const nsAString &aHash) {
SetHrefAttribute(uri);
}
void Link::GetOrigin(nsAString &aOrigin) {
void Link::GetOrigin(nsAString& aOrigin) {
aOrigin.Truncate();
nsCOMPtr<nsIURI> uri(GetURI());
@@ -577,7 +577,7 @@ void Link::GetOrigin(nsAString &aOrigin) {
aOrigin.Assign(origin);
}
void Link::GetProtocol(nsAString &_protocol) {
void Link::GetProtocol(nsAString& _protocol) {
nsCOMPtr<nsIURI> uri(GetURI());
if (!uri) {
_protocol.AssignLiteral("http");
@@ -589,7 +589,7 @@ void Link::GetProtocol(nsAString &_protocol) {
_protocol.Append(char16_t(':'));
}
void Link::GetUsername(nsAString &aUsername) {
void Link::GetUsername(nsAString& aUsername) {
aUsername.Truncate();
nsCOMPtr<nsIURI> uri(GetURI());
@@ -602,7 +602,7 @@ void Link::GetUsername(nsAString &aUsername) {
CopyASCIItoUTF16(username, aUsername);
}
void Link::GetPassword(nsAString &aPassword) {
void Link::GetPassword(nsAString& aPassword) {
aPassword.Truncate();
nsCOMPtr<nsIURI> uri(GetURI());
@@ -615,7 +615,7 @@ void Link::GetPassword(nsAString &aPassword) {
CopyASCIItoUTF16(password, aPassword);
}
void Link::GetHost(nsAString &_host) {
void Link::GetHost(nsAString& _host) {
_host.Truncate();
nsCOMPtr<nsIURI> uri(GetURI());
@@ -631,7 +631,7 @@ void Link::GetHost(nsAString &_host) {
}
}
void Link::GetHostname(nsAString &_hostname) {
void Link::GetHostname(nsAString& _hostname) {
_hostname.Truncate();
nsCOMPtr<nsIURI> uri(GetURI());
@@ -643,7 +643,7 @@ void Link::GetHostname(nsAString &_hostname) {
nsContentUtils::GetHostOrIPv6WithBrackets(uri, _hostname);
}
void Link::GetPathname(nsAString &_pathname) {
void Link::GetPathname(nsAString& _pathname) {
_pathname.Truncate();
nsCOMPtr<nsIURI> uri(GetURI());
@@ -661,7 +661,7 @@ void Link::GetPathname(nsAString &_pathname) {
}
}
void Link::GetSearch(nsAString &_search) {
void Link::GetSearch(nsAString& _search) {
_search.Truncate();
nsCOMPtr<nsIURI> uri(GetURI());
@@ -680,7 +680,7 @@ void Link::GetSearch(nsAString &_search) {
}
}
void Link::GetPort(nsAString &_port) {
void Link::GetPort(nsAString& _port) {
_port.Truncate();
nsCOMPtr<nsIURI> uri(GetURI());
@@ -700,7 +700,7 @@ void Link::GetPort(nsAString &_port) {
}
}
void Link::GetHash(nsAString &_hash) {
void Link::GetHash(nsAString& _hash) {
_hash.Truncate();
nsCOMPtr<nsIURI> uri(GetURI());
@@ -732,7 +732,7 @@ void Link::ResetLinkState(bool aNotify, bool aHasHref) {
// currently registered; in either case, we should remove ourself
// from the doc and the history.
if (!mNeedsRegistration && mLinkState != eLinkState_NotLink) {
Document *doc = mElement->GetComposedDoc();
Document* doc = mElement->GetComposedDoc();
if (doc && (mRegistered || mLinkState == eLinkState_Visited)) {
// Tell the document to forget about this link if we've registered
// with it before.
@@ -780,7 +780,7 @@ void Link::UnregisterFromHistory() {
#ifdef ANDROID
nsCOMPtr<IHistory> history = services::GetHistoryService();
#elif defined(MOZ_PLACES)
History *history = History::GetService();
History* history = History::GetService();
#else
nsCOMPtr<IHistory> history;
#endif
@@ -795,7 +795,7 @@ void Link::UnregisterFromHistory() {
}
}
void Link::SetHrefAttribute(nsIURI *aURI) {
void Link::SetHrefAttribute(nsIURI* aURI) {
NS_ASSERTION(aURI, "Null URI is illegal!");
// if we change this code to not reserialize we need to do something smarter
@@ -807,7 +807,7 @@ void Link::SetHrefAttribute(nsIURI *aURI) {
NS_ConvertUTF8toUTF16(href), true);
}
size_t Link::SizeOfExcludingThis(mozilla::SizeOfState &aState) const {
size_t Link::SizeOfExcludingThis(mozilla::SizeOfState& aState) const {
size_t n = 0;
if (mCachedURI) {
@@ -831,7 +831,7 @@ static const nsAttrValue::EnumTable kAsAttributeTable[] = {
{"fetch", DESTINATION_FETCH}, {nullptr, 0}};
/* static */
void Link::ParseAsValue(const nsAString &aValue, nsAttrValue &aResult) {
void Link::ParseAsValue(const nsAString& aValue, nsAttrValue& aResult) {
DebugOnly<bool> success =
aResult.ParseEnumValue(aValue, kAsAttributeTable, false,
// default value is a empty string
@@ -842,7 +842,7 @@ void Link::ParseAsValue(const nsAString &aValue, nsAttrValue &aResult) {
}
/* static */
nsContentPolicyType Link::AsValueToContentPolicy(const nsAttrValue &aValue) {
nsContentPolicyType Link::AsValueToContentPolicy(const nsAttrValue& aValue) {
switch (aValue.GetEnumValue()) {
case DESTINATION_INVALID:
return nsIContentPolicy::TYPE_INVALID;

View File

@@ -38,7 +38,7 @@ class Link : public nsISupports {
/**
* aElement is the element pointer corresponding to this link.
*/
explicit Link(Element *aElement);
explicit Link(Element* aElement);
/**
* This constructor is only used for testing.
@@ -57,31 +57,31 @@ class Link : public nsISupports {
/**
* @return the URI this link is for, if available.
*/
nsIURI *GetURI() const;
virtual nsIURI *GetURIExternal() const { return GetURI(); }
nsIURI* GetURI() const;
virtual nsIURI* GetURIExternal() const { return GetURI(); }
/**
* Helper methods for modifying and obtaining parts of the URI of the Link.
*/
void SetProtocol(const nsAString &aProtocol);
void SetUsername(const nsAString &aUsername);
void SetPassword(const nsAString &aPassword);
void SetHost(const nsAString &aHost);
void SetHostname(const nsAString &aHostname);
void SetPathname(const nsAString &aPathname);
void SetSearch(const nsAString &aSearch);
void SetPort(const nsAString &aPort);
void SetHash(const nsAString &aHash);
void GetOrigin(nsAString &aOrigin);
void GetProtocol(nsAString &_protocol);
void GetUsername(nsAString &aUsername);
void GetPassword(nsAString &aPassword);
void GetHost(nsAString &_host);
void GetHostname(nsAString &_hostname);
void GetPathname(nsAString &_pathname);
void GetSearch(nsAString &_search);
void GetPort(nsAString &_port);
void GetHash(nsAString &_hash);
void SetProtocol(const nsAString& aProtocol);
void SetUsername(const nsAString& aUsername);
void SetPassword(const nsAString& aPassword);
void SetHost(const nsAString& aHost);
void SetHostname(const nsAString& aHostname);
void SetPathname(const nsAString& aPathname);
void SetSearch(const nsAString& aSearch);
void SetPort(const nsAString& aPort);
void SetHash(const nsAString& aHash);
void GetOrigin(nsAString& aOrigin);
void GetProtocol(nsAString& _protocol);
void GetUsername(nsAString& aUsername);
void GetPassword(nsAString& aPassword);
void GetHost(nsAString& _host);
void GetHostname(nsAString& _hostname);
void GetPathname(nsAString& _pathname);
void GetSearch(nsAString& _search);
void GetPort(nsAString& _port);
void GetHash(nsAString& _hash);
/**
* Invalidates any link caching, and resets the state to the default.
@@ -93,7 +93,7 @@ class Link : public nsISupports {
void ResetLinkState(bool aNotify, bool aHasHref);
// This method nevers returns a null element.
Element *GetElement() const { return mElement; }
Element* GetElement() const { return mElement; }
/**
* DNS prefetch has been deferred until later, e.g. page load complete.
@@ -115,7 +115,7 @@ class Link : public nsISupports {
*/
virtual bool HasDeferredDNSPrefetchRequest() { return true; }
virtual size_t SizeOfExcludingThis(mozilla::SizeOfState &aState) const;
virtual size_t SizeOfExcludingThis(mozilla::SizeOfState& aState) const;
virtual bool ElementHasHref() const;
@@ -126,8 +126,8 @@ class Link : public nsISupports {
// This is called by HTMLLinkElement.
void TryDNSPrefetchOrPreconnectOrPrefetchOrPreloadOrPrerender();
void UpdatePreload(nsAtom *aName, const nsAttrValue *aValue,
const nsAttrValue *aOldValue);
void UpdatePreload(nsAtom* aName, const nsAttrValue* aValue,
const nsAttrValue* aOldValue);
void CancelPrefetchOrPreload();
bool HasPendingLinkUpdate() const { return mHasPendingLinkUpdate; }
@@ -138,14 +138,14 @@ class Link : public nsISupports {
// similar to the one in Element. Overriders must call
// ClearHasPendingLinkUpdate().
// If you change this, change also the method in Element.
virtual void NodeInfoChanged(Document *aOldDoc) = 0;
virtual void NodeInfoChanged(Document* aOldDoc) = 0;
bool IsInDNSPrefetch() { return mInDNSPrefetch; }
void SetIsInDNSPrefetch() { mInDNSPrefetch = true; }
void ClearIsInDNSPrefetch() { mInDNSPrefetch = false; }
static void ParseAsValue(const nsAString &aValue, nsAttrValue &aResult);
static nsContentPolicyType AsValueToContentPolicy(const nsAttrValue &aValue);
static void ParseAsValue(const nsAString& aValue, nsAttrValue& aResult);
static nsContentPolicyType AsValueToContentPolicy(const nsAttrValue& aValue);
protected:
virtual ~Link();
@@ -161,7 +161,7 @@ class Link : public nsISupports {
return !!GetURI();
}
nsIURI *GetCachedURI() const { return mCachedURI; }
nsIURI* GetCachedURI() const { return mCachedURI; }
bool HasCachedURI() const { return !!mCachedURI; }
private:
@@ -171,15 +171,15 @@ class Link : public nsISupports {
*/
void UnregisterFromHistory();
void SetHrefAttribute(nsIURI *aURI);
void SetHrefAttribute(nsIURI* aURI);
void GetContentPolicyMimeTypeMedia(nsAttrValue &aAsAttr,
nsContentPolicyType &aPolicyType,
nsString &aMimeType, nsAString &aMedia);
void GetContentPolicyMimeTypeMedia(nsAttrValue& aAsAttr,
nsContentPolicyType& aPolicyType,
nsString& aMimeType, nsAString& aMedia);
mutable nsCOMPtr<nsIURI> mCachedURI;
Element *const mElement;
Element* const mElement;
uint16_t mLinkState;

View File

@@ -25,10 +25,10 @@ namespace dom {
/*
* NodePointer implementation
*/
NodeIterator::NodePointer::NodePointer(nsINode *aNode, bool aBeforeNode)
NodeIterator::NodePointer::NodePointer(nsINode* aNode, bool aBeforeNode)
: mNode(aNode), mBeforeNode(aBeforeNode) {}
bool NodeIterator::NodePointer::MoveToNext(nsINode *aRoot) {
bool NodeIterator::NodePointer::MoveToNext(nsINode* aRoot) {
if (!mNode) return false;
if (mBeforeNode) {
@@ -36,7 +36,7 @@ bool NodeIterator::NodePointer::MoveToNext(nsINode *aRoot) {
return true;
}
nsINode *child = mNode->GetFirstChild();
nsINode* child = mNode->GetFirstChild();
if (child) {
mNode = child;
return true;
@@ -45,7 +45,7 @@ bool NodeIterator::NodePointer::MoveToNext(nsINode *aRoot) {
return MoveForward(aRoot, mNode);
}
bool NodeIterator::NodePointer::MoveToPrevious(nsINode *aRoot) {
bool NodeIterator::NodePointer::MoveToPrevious(nsINode* aRoot) {
if (!mNode) return false;
if (!mBeforeNode) {
@@ -61,8 +61,8 @@ bool NodeIterator::NodePointer::MoveToPrevious(nsINode *aRoot) {
}
void NodeIterator::NodePointer::AdjustAfterRemoval(
nsINode *aRoot, nsINode *aContainer, nsIContent *aChild,
nsIContent *aPreviousSibling) {
nsINode* aRoot, nsINode* aContainer, nsIContent* aChild,
nsIContent* aPreviousSibling) {
// If mNode is null or the root there is nothing to do.
if (!mNode || mNode == aRoot) return;
@@ -71,7 +71,7 @@ void NodeIterator::NodePointer::AdjustAfterRemoval(
if (mBeforeNode) {
// Try the next sibling
nsINode *nextSibling = aPreviousSibling ? aPreviousSibling->GetNextSibling()
nsINode* nextSibling = aPreviousSibling ? aPreviousSibling->GetNextSibling()
: aContainer->GetFirstChild();
if (nextSibling) {
@@ -89,11 +89,11 @@ void NodeIterator::NodePointer::AdjustAfterRemoval(
MoveBackward(aContainer, aPreviousSibling);
}
bool NodeIterator::NodePointer::MoveForward(nsINode *aRoot, nsINode *aNode) {
bool NodeIterator::NodePointer::MoveForward(nsINode* aRoot, nsINode* aNode) {
while (1) {
if (aNode == aRoot) break;
nsINode *sibling = aNode->GetNextSibling();
nsINode* sibling = aNode->GetNextSibling();
if (sibling) {
mNode = sibling;
return true;
@@ -104,7 +104,7 @@ bool NodeIterator::NodePointer::MoveForward(nsINode *aRoot, nsINode *aNode) {
return false;
}
void NodeIterator::NodePointer::MoveBackward(nsINode *aParent, nsINode *aNode) {
void NodeIterator::NodePointer::MoveBackward(nsINode* aParent, nsINode* aNode) {
if (aNode) {
do {
mNode = aNode;
@@ -119,8 +119,8 @@ void NodeIterator::NodePointer::MoveBackward(nsINode *aParent, nsINode *aNode) {
* Factories, constructors and destructors
*/
NodeIterator::NodeIterator(nsINode *aRoot, uint32_t aWhatToShow,
NodeFilter *aFilter)
NodeIterator::NodeIterator(nsINode* aRoot, uint32_t aWhatToShow,
NodeFilter* aFilter)
: nsTraversal(aRoot, aWhatToShow, aFilter), mPointer(mRoot, true) {
aRoot->AddMutationObserver(this);
}
@@ -156,7 +156,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(NodeIterator)
NS_IMPL_CYCLE_COLLECTING_RELEASE(NodeIterator)
already_AddRefed<nsINode> NodeIterator::NextOrPrevNode(
NodePointer::MoveToMethodType aMove, ErrorResult &aResult) {
NodePointer::MoveToMethodType aMove, ErrorResult& aResult) {
if (mInAcceptNode) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
@@ -165,8 +165,8 @@ already_AddRefed<nsINode> NodeIterator::NextOrPrevNode(
mWorkingPointer = mPointer;
struct AutoClear {
NodePointer *mPtr;
explicit AutoClear(NodePointer *ptr) : mPtr(ptr) {}
NodePointer* mPtr;
explicit AutoClear(NodePointer* ptr) : mPtr(ptr) {}
~AutoClear() { mPtr->Clear(); }
} ac(&mWorkingPointer);
@@ -196,17 +196,17 @@ void NodeIterator::Detach() {
* nsIMutationObserver interface
*/
void NodeIterator::ContentRemoved(nsIContent *aChild,
nsIContent *aPreviousSibling) {
nsINode *container = aChild->GetParentNode();
void NodeIterator::ContentRemoved(nsIContent* aChild,
nsIContent* aPreviousSibling) {
nsINode* container = aChild->GetParentNode();
mPointer.AdjustAfterRemoval(mRoot, container, aChild, aPreviousSibling);
mWorkingPointer.AdjustAfterRemoval(mRoot, container, aChild,
aPreviousSibling);
}
bool NodeIterator::WrapObject(JSContext *cx, JS::Handle<JSObject *> aGivenProto,
JS::MutableHandle<JSObject *> aReflector) {
bool NodeIterator::WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto,
JS::MutableHandle<JSObject*> aReflector) {
return NodeIterator_Binding::Wrap(cx, this, aGivenProto, aReflector);
}

View File

@@ -24,56 +24,56 @@ class NodeIterator final : public nsStubMutationObserver, public nsTraversal {
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NodeIterator(nsINode *aRoot, uint32_t aWhatToShow, NodeFilter *aFilter);
NodeIterator(nsINode* aRoot, uint32_t aWhatToShow, NodeFilter* aFilter);
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
NS_DECL_CYCLE_COLLECTION_CLASS(NodeIterator)
// WebIDL API
nsINode *Root() const { return mRoot; }
nsINode *GetReferenceNode() const { return mPointer.mNode; }
nsINode* Root() const { return mRoot; }
nsINode* GetReferenceNode() const { return mPointer.mNode; }
bool PointerBeforeReferenceNode() const { return mPointer.mBeforeNode; }
uint32_t WhatToShow() const { return mWhatToShow; }
NodeFilter *GetFilter() { return mFilter; }
already_AddRefed<nsINode> NextNode(ErrorResult &aResult) {
NodeFilter* GetFilter() { return mFilter; }
already_AddRefed<nsINode> NextNode(ErrorResult& aResult) {
return NextOrPrevNode(&NodePointer::MoveToNext, aResult);
}
already_AddRefed<nsINode> PreviousNode(ErrorResult &aResult) {
already_AddRefed<nsINode> PreviousNode(ErrorResult& aResult) {
return NextOrPrevNode(&NodePointer::MoveToPrevious, aResult);
}
void Detach();
bool WrapObject(JSContext *cx, JS::Handle<JSObject *> aGivenProto,
JS::MutableHandle<JSObject *> aReflector);
bool WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto,
JS::MutableHandle<JSObject*> aReflector);
private:
virtual ~NodeIterator();
struct NodePointer {
NodePointer() : mNode(nullptr), mBeforeNode(false) {}
NodePointer(nsINode *aNode, bool aBeforeNode);
NodePointer(nsINode* aNode, bool aBeforeNode);
typedef bool (NodePointer::*MoveToMethodType)(nsINode *);
bool MoveToNext(nsINode *aRoot);
bool MoveToPrevious(nsINode *aRoot);
typedef bool (NodePointer::*MoveToMethodType)(nsINode*);
bool MoveToNext(nsINode* aRoot);
bool MoveToPrevious(nsINode* aRoot);
bool MoveForward(nsINode *aRoot, nsINode *aNode);
void MoveBackward(nsINode *aParent, nsINode *aNode);
bool MoveForward(nsINode* aRoot, nsINode* aNode);
void MoveBackward(nsINode* aParent, nsINode* aNode);
void AdjustAfterRemoval(nsINode *aRoot, nsINode *aContainer,
nsIContent *aChild, nsIContent *aPreviousSibling);
void AdjustAfterRemoval(nsINode* aRoot, nsINode* aContainer,
nsIContent* aChild, nsIContent* aPreviousSibling);
void Clear() { mNode = nullptr; }
nsINode *mNode;
nsINode* mNode;
bool mBeforeNode;
};
// Have to return a strong ref, because the act of testing the node can
// remove it from the DOM so we're holding the only ref to it.
already_AddRefed<nsINode> NextOrPrevNode(NodePointer::MoveToMethodType aMove,
ErrorResult &aResult);
ErrorResult& aResult);
NodePointer mPointer;
NodePointer mWorkingPointer;

View File

@@ -25,59 +25,59 @@ namespace ubi {
template <>
class Concrete<nsINode> : public Base {
protected:
explicit Concrete(nsINode *ptr) : Base(ptr) {}
explicit Concrete(nsINode* ptr) : Base(ptr) {}
public:
static void construct(void *storage, nsINode *ptr);
static void construct(void* storage, nsINode* ptr);
Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
js::UniquePtr<EdgeRange> edges(JSContext *cx, bool wantNames) const override;
js::UniquePtr<EdgeRange> edges(JSContext* cx, bool wantNames) const override;
nsINode &get() const { return *static_cast<nsINode *>(ptr); }
nsINode& get() const { return *static_cast<nsINode*>(ptr); }
CoarseType coarseType() const final { return CoarseType::DOMNode; }
const char16_t *descriptiveTypeName() const override;
const char16_t* descriptiveTypeName() const override;
};
template <>
class Concrete<nsIContent> : public Concrete<nsINode> {
protected:
explicit Concrete(nsIContent *ptr) : Concrete<nsINode>(ptr) {}
explicit Concrete(nsIContent* ptr) : Concrete<nsINode>(ptr) {}
public:
static void construct(void *storage, nsIContent *ptr) {
static void construct(void* storage, nsIContent* ptr) {
new (storage) Concrete(ptr);
}
const char16_t *typeName() const override { return concreteTypeName; };
const char16_t* typeName() const override { return concreteTypeName; };
static const char16_t concreteTypeName[];
};
template <>
class Concrete<mozilla::dom::Document> : public Concrete<nsINode> {
protected:
explicit Concrete(mozilla::dom::Document *ptr) : Concrete<nsINode>(ptr) {}
explicit Concrete(mozilla::dom::Document* ptr) : Concrete<nsINode>(ptr) {}
public:
static void construct(void *storage, mozilla::dom::Document *ptr) {
static void construct(void* storage, mozilla::dom::Document* ptr) {
new (storage) Concrete(ptr);
}
Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
mozilla::dom::Document &getDoc() const {
return *static_cast<mozilla::dom::Document *>(ptr);
mozilla::dom::Document& getDoc() const {
return *static_cast<mozilla::dom::Document*>(ptr);
}
const char16_t *typeName() const override { return concreteTypeName; };
const char16_t* typeName() const override { return concreteTypeName; };
static const char16_t concreteTypeName[];
};
template <>
class Concrete<mozilla::dom::Attr> : public Concrete<nsINode> {
protected:
explicit Concrete(mozilla::dom::Attr *ptr) : Concrete<nsINode>(ptr) {}
explicit Concrete(mozilla::dom::Attr* ptr) : Concrete<nsINode>(ptr) {}
public:
static void construct(void *storage, mozilla::dom::Attr *ptr) {
static void construct(void* storage, mozilla::dom::Attr* ptr) {
new (storage) Concrete(ptr);
}
const char16_t *typeName() const override { return concreteTypeName; };
const char16_t* typeName() const override { return concreteTypeName; };
static const char16_t concreteTypeName[];
};

View File

@@ -35,7 +35,7 @@ NS_IMPL_ISUPPORTS(nsContentPolicy, nsIContentPolicy)
static mozilla::LazyLogModule gConPolLog("nsContentPolicy");
nsresult NS_NewContentPolicy(nsIContentPolicy **aResult) {
nsresult NS_NewContentPolicy(nsIContentPolicy** aResult) {
*aResult = new nsContentPolicy;
NS_ADDREF(*aResult);
return NS_OK;
@@ -64,10 +64,10 @@ nsContentPolicy::~nsContentPolicy() {}
#endif // defined(DEBUG)
inline nsresult nsContentPolicy::CheckPolicy(CPMethod policyMethod,
nsIURI *contentLocation,
nsILoadInfo *loadInfo,
const nsACString &mimeType,
int16_t *decision) {
nsIURI* contentLocation,
nsILoadInfo* loadInfo,
const nsACString& mimeType,
int16_t* decision) {
nsContentPolicyType contentType = loadInfo->InternalContentPolicyType();
nsCOMPtr<nsISupports> requestingContext = loadInfo->GetLoadingContext();
nsCOMPtr<nsIPrincipal> requestPrincipal = loadInfo->TriggeringPrincipal();
@@ -120,7 +120,7 @@ inline nsresult nsContentPolicy::CheckPolicy(CPMethod policyMethod,
* their permissions.
*/
nsresult rv;
const nsCOMArray<nsIContentPolicy> &entries = mPolicies.GetCachedEntries();
const nsCOMArray<nsIContentPolicy>& entries = mPolicies.GetCachedEntries();
nsCOMPtr<nsPIDOMWindowOuter> window;
if (nsCOMPtr<nsINode> node = do_QueryInterface(requestingContext)) {
@@ -176,7 +176,7 @@ inline nsresult nsContentPolicy::CheckPolicy(CPMethod policyMethod,
} \
/* skip all this nonsense if the call failed or logging is disabled */ \
if (NS_SUCCEEDED(rv) && MOZ_LOG_TEST(gConPolLog, LogLevel::Debug)) { \
const char *resultName; \
const char* resultName; \
if (decision) { \
resultName = NS_CP_ResponseName(*decision); \
} else { \
@@ -193,8 +193,8 @@ inline nsresult nsContentPolicy::CheckPolicy(CPMethod policyMethod,
PR_END_MACRO
NS_IMETHODIMP
nsContentPolicy::ShouldLoad(nsIURI *contentLocation, nsILoadInfo *loadInfo,
const nsACString &mimeType, int16_t *decision) {
nsContentPolicy::ShouldLoad(nsIURI* contentLocation, nsILoadInfo* loadInfo,
const nsACString& mimeType, int16_t* decision) {
// ShouldProcess does not need a content location, but we do
MOZ_ASSERT(contentLocation, "Must provide request location");
nsresult rv = CheckPolicy(&nsIContentPolicy::ShouldLoad, contentLocation,
@@ -205,8 +205,8 @@ nsContentPolicy::ShouldLoad(nsIURI *contentLocation, nsILoadInfo *loadInfo,
}
NS_IMETHODIMP
nsContentPolicy::ShouldProcess(nsIURI *contentLocation, nsILoadInfo *loadInfo,
const nsACString &mimeType, int16_t *decision) {
nsContentPolicy::ShouldProcess(nsIURI* contentLocation, nsILoadInfo* loadInfo,
const nsACString& mimeType, int16_t* decision) {
nsresult rv = CheckPolicy(&nsIContentPolicy::ShouldProcess, contentLocation,
loadInfo, mimeType, decision);
LOG_CHECK("ShouldProcess");

View File

@@ -33,11 +33,11 @@ class nsContentPolicy : public nsIContentPolicy {
// Helper method that applies policyMethod across all policies in mPolicies
// with the given parameters
nsresult CheckPolicy(CPMethod policyMethod, nsIURI *aURI,
nsILoadInfo *aLoadInfo, const nsACString &mimeGuess,
int16_t *decision);
nsresult CheckPolicy(CPMethod policyMethod, nsIURI* aURI,
nsILoadInfo* aLoadInfo, const nsACString& mimeGuess,
int16_t* decision);
};
nsresult NS_NewContentPolicy(nsIContentPolicy **aResult);
nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
#endif /* __nsContentPolicy_h__ */

View File

@@ -68,7 +68,7 @@
* @param response the response code
* @return the name of the given response code
*/
inline const char *NS_CP_ResponseName(int16_t response) {
inline const char* NS_CP_ResponseName(int16_t response) {
switch (response) {
CASE_RETURN(REJECT_REQUEST);
CASE_RETURN(REJECT_TYPE);
@@ -89,7 +89,7 @@ inline const char *NS_CP_ResponseName(int16_t response) {
* @param contentType the content type code
* @return the name of the given content type code
*/
inline const char *NS_CP_ContentTypeName(uint32_t contentType) {
inline const char* NS_CP_ContentTypeName(uint32_t contentType) {
switch (contentType) {
CASE_RETURN(TYPE_OTHER);
CASE_RETURN(TYPE_SCRIPT);
@@ -183,7 +183,7 @@ inline const char *NS_CP_ContentTypeName(uint32_t contentType) {
n = win ? win->GetExtantDoc() : nullptr; \
} \
if (n) { \
mozilla::dom::Document *d = n->OwnerDoc(); \
mozilla::dom::Document* d = n->OwnerDoc(); \
if (d->IsLoadedAsData() || d->IsBeingUsedAsImage() || \
d->IsResourceDoc()) { \
nsCOMPtr<nsIContentPolicy> dataPolicy = \
@@ -211,9 +211,9 @@ inline const char *NS_CP_ContentTypeName(uint32_t contentType) {
* origin URI will be passed).
*/
inline nsresult NS_CheckContentLoadPolicy(
nsIURI *contentLocation, nsILoadInfo *loadInfo, const nsACString &mimeType,
int16_t *decision, nsIContentPolicy *policyService = nullptr) {
nsIPrincipal *loadingPrincipal = loadInfo->LoadingPrincipal();
nsIURI* contentLocation, nsILoadInfo* loadInfo, const nsACString& mimeType,
int16_t* decision, nsIContentPolicy* policyService = nullptr) {
nsIPrincipal* loadingPrincipal = loadInfo->LoadingPrincipal();
nsCOMPtr<nsISupports> context = loadInfo->GetLoadingContext();
nsContentPolicyType contentType = loadInfo->InternalContentPolicyType();
CHECK_PRINCIPAL_AND_DATA(ShouldLoad);
@@ -227,9 +227,9 @@ inline nsresult NS_CheckContentLoadPolicy(
* Alias for calling ShouldProcess on the content policy service.
*/
inline nsresult NS_CheckContentProcessPolicy(
nsIURI *contentLocation, nsILoadInfo *loadInfo, const nsACString &mimeType,
int16_t *decision, nsIContentPolicy *policyService = nullptr) {
nsIPrincipal *loadingPrincipal = loadInfo->LoadingPrincipal();
nsIURI* contentLocation, nsILoadInfo* loadInfo, const nsACString& mimeType,
int16_t* decision, nsIContentPolicy* policyService = nullptr) {
nsIPrincipal* loadingPrincipal = loadInfo->LoadingPrincipal();
nsCOMPtr<nsISupports> context = loadInfo->GetLoadingContext();
nsContentPolicyType contentType = loadInfo->InternalContentPolicyType();
CHECK_PRINCIPAL_AND_DATA(ShouldProcess);
@@ -265,7 +265,7 @@ inline nsresult NS_CheckContentProcessPolicy(
* happening in. These are somewhat odd semantics, and bug 466687 has been
* filed to consider improving them.
*/
inline nsIDocShell *NS_CP_GetDocShellFromContext(nsISupports *aContext) {
inline nsIDocShell* NS_CP_GetDocShellFromContext(nsISupports* aContext) {
if (!aContext) {
return nullptr;
}

View File

@@ -19,7 +19,7 @@ class nsIJSArgArray;
// Optionally, aArgv may be nullptr, in which case the array is allocated and
// rooted, but all items remain nullptr. This presumably means the caller
// will then QI us for nsIJSArgArray, and set our array elements.
nsresult NS_CreateJSArgv(JSContext *aContext, uint32_t aArgc,
const JS::Value *aArgv, nsIJSArgArray **aArray);
nsresult NS_CreateJSArgv(JSContext* aContext, uint32_t aArgc,
const JS::Value* aArgv, nsIJSArgArray** aArray);
#endif // nsDOMJSUtils_h__

View File

@@ -26,7 +26,7 @@ NS_IMPL_ISUPPORTS(nsDataDocumentContentPolicy, nsIContentPolicy)
// Helper method for ShouldLoad()
// Checks a URI for the given flags. Returns true if the URI has the flags,
// and false if not (or if we weren't able to tell).
static bool HasFlags(nsIURI *aURI, uint32_t aURIFlags) {
static bool HasFlags(nsIURI* aURI, uint32_t aURIFlags) {
bool hasFlags;
nsresult rv = NS_URIChainHasFlags(aURI, aURIFlags, &hasFlags);
return NS_SUCCEEDED(rv) && hasFlags;
@@ -36,10 +36,10 @@ static bool HasFlags(nsIURI *aURI, uint32_t aURIFlags) {
// CHECK_PRINCIPAL_AND_DATA in nsContentPolicyUtils is still valid.
// nsContentPolicyUtils may not pass all the parameters to ShouldLoad.
NS_IMETHODIMP
nsDataDocumentContentPolicy::ShouldLoad(nsIURI *aContentLocation,
nsILoadInfo *aLoadInfo,
const nsACString &aMimeGuess,
int16_t *aDecision) {
nsDataDocumentContentPolicy::ShouldLoad(nsIURI* aContentLocation,
nsILoadInfo* aLoadInfo,
const nsACString& aMimeGuess,
int16_t* aDecision) {
auto setBlockingReason = MakeScopeExit([&]() {
if (NS_CP_REJECTED(*aDecision)) {
NS_SetRequestBlockingReason(
@@ -82,7 +82,7 @@ nsDataDocumentContentPolicy::ShouldLoad(nsIURI *aContentLocation,
}
}
mozilla::dom::Document *docToCheckForImage = doc->GetDisplayDocument();
mozilla::dom::Document* docToCheckForImage = doc->GetDisplayDocument();
if (!docToCheckForImage) {
docToCheckForImage = doc;
}
@@ -104,7 +104,7 @@ nsDataDocumentContentPolicy::ShouldLoad(nsIURI *aContentLocation,
// Report error, if we can.
if (node) {
nsIPrincipal *requestingPrincipal = node->NodePrincipal();
nsIPrincipal* requestingPrincipal = node->NodePrincipal();
RefPtr<nsIURI> principalURI;
nsresult rv = requestingPrincipal->GetURI(getter_AddRefs(principalURI));
if (NS_SUCCEEDED(rv) && principalURI) {
@@ -153,9 +153,9 @@ nsDataDocumentContentPolicy::ShouldLoad(nsIURI *aContentLocation,
}
NS_IMETHODIMP
nsDataDocumentContentPolicy::ShouldProcess(nsIURI *aContentLocation,
nsILoadInfo *aLoadInfo,
const nsACString &aMimeGuess,
int16_t *aDecision) {
nsDataDocumentContentPolicy::ShouldProcess(nsIURI* aContentLocation,
nsILoadInfo* aLoadInfo,
const nsACString& aMimeGuess,
int16_t* aDecision) {
return ShouldLoad(aContentLocation, aLoadInfo, aMimeGuess, aDecision);
}

View File

@@ -40,72 +40,72 @@
using namespace mozilla;
using namespace mozilla::layers;
constexpr const char *sSelectAllString = "cmd_selectAll";
constexpr const char *sSelectNoneString = "cmd_selectNone";
constexpr const char *sCopyImageLocationString = "cmd_copyImageLocation";
constexpr const char *sCopyImageContentsString = "cmd_copyImageContents";
constexpr const char *sCopyImageString = "cmd_copyImage";
constexpr const char* sSelectAllString = "cmd_selectAll";
constexpr const char* sSelectNoneString = "cmd_selectNone";
constexpr const char* sCopyImageLocationString = "cmd_copyImageLocation";
constexpr const char* sCopyImageContentsString = "cmd_copyImageContents";
constexpr const char* sCopyImageString = "cmd_copyImage";
constexpr const char *sScrollTopString = "cmd_scrollTop";
constexpr const char *sScrollBottomString = "cmd_scrollBottom";
constexpr const char *sScrollPageUpString = "cmd_scrollPageUp";
constexpr const char *sScrollPageDownString = "cmd_scrollPageDown";
constexpr const char *sScrollLineUpString = "cmd_scrollLineUp";
constexpr const char *sScrollLineDownString = "cmd_scrollLineDown";
constexpr const char *sScrollLeftString = "cmd_scrollLeft";
constexpr const char *sScrollRightString = "cmd_scrollRight";
constexpr const char *sMoveTopString = "cmd_moveTop";
constexpr const char *sMoveBottomString = "cmd_moveBottom";
constexpr const char *sMovePageUpString = "cmd_movePageUp";
constexpr const char *sMovePageDownString = "cmd_movePageDown";
constexpr const char *sLinePreviousString = "cmd_linePrevious";
constexpr const char *sLineNextString = "cmd_lineNext";
constexpr const char *sCharPreviousString = "cmd_charPrevious";
constexpr const char *sCharNextString = "cmd_charNext";
constexpr const char* sScrollTopString = "cmd_scrollTop";
constexpr const char* sScrollBottomString = "cmd_scrollBottom";
constexpr const char* sScrollPageUpString = "cmd_scrollPageUp";
constexpr const char* sScrollPageDownString = "cmd_scrollPageDown";
constexpr const char* sScrollLineUpString = "cmd_scrollLineUp";
constexpr const char* sScrollLineDownString = "cmd_scrollLineDown";
constexpr const char* sScrollLeftString = "cmd_scrollLeft";
constexpr const char* sScrollRightString = "cmd_scrollRight";
constexpr const char* sMoveTopString = "cmd_moveTop";
constexpr const char* sMoveBottomString = "cmd_moveBottom";
constexpr const char* sMovePageUpString = "cmd_movePageUp";
constexpr const char* sMovePageDownString = "cmd_movePageDown";
constexpr const char* sLinePreviousString = "cmd_linePrevious";
constexpr const char* sLineNextString = "cmd_lineNext";
constexpr const char* sCharPreviousString = "cmd_charPrevious";
constexpr const char* sCharNextString = "cmd_charNext";
// These are so the browser can use editor navigation key bindings
// helps with accessibility (boolean pref accessibility.browsewithcaret)
constexpr const char *sSelectCharPreviousString = "cmd_selectCharPrevious";
constexpr const char *sSelectCharNextString = "cmd_selectCharNext";
constexpr const char* sSelectCharPreviousString = "cmd_selectCharPrevious";
constexpr const char* sSelectCharNextString = "cmd_selectCharNext";
constexpr const char *sWordPreviousString = "cmd_wordPrevious";
constexpr const char *sWordNextString = "cmd_wordNext";
constexpr const char *sSelectWordPreviousString = "cmd_selectWordPrevious";
constexpr const char *sSelectWordNextString = "cmd_selectWordNext";
constexpr const char* sWordPreviousString = "cmd_wordPrevious";
constexpr const char* sWordNextString = "cmd_wordNext";
constexpr const char* sSelectWordPreviousString = "cmd_selectWordPrevious";
constexpr const char* sSelectWordNextString = "cmd_selectWordNext";
constexpr const char *sBeginLineString = "cmd_beginLine";
constexpr const char *sEndLineString = "cmd_endLine";
constexpr const char *sSelectBeginLineString = "cmd_selectBeginLine";
constexpr const char *sSelectEndLineString = "cmd_selectEndLine";
constexpr const char* sBeginLineString = "cmd_beginLine";
constexpr const char* sEndLineString = "cmd_endLine";
constexpr const char* sSelectBeginLineString = "cmd_selectBeginLine";
constexpr const char* sSelectEndLineString = "cmd_selectEndLine";
constexpr const char *sSelectLinePreviousString = "cmd_selectLinePrevious";
constexpr const char *sSelectLineNextString = "cmd_selectLineNext";
constexpr const char* sSelectLinePreviousString = "cmd_selectLinePrevious";
constexpr const char* sSelectLineNextString = "cmd_selectLineNext";
constexpr const char *sSelectPageUpString = "cmd_selectPageUp";
constexpr const char *sSelectPageDownString = "cmd_selectPageDown";
constexpr const char* sSelectPageUpString = "cmd_selectPageUp";
constexpr const char* sSelectPageDownString = "cmd_selectPageDown";
constexpr const char *sSelectTopString = "cmd_selectTop";
constexpr const char *sSelectBottomString = "cmd_selectBottom";
constexpr const char* sSelectTopString = "cmd_selectTop";
constexpr const char* sSelectBottomString = "cmd_selectBottom";
// Physical-direction movement and selection commands
constexpr const char *sMoveLeftString = "cmd_moveLeft";
constexpr const char *sMoveRightString = "cmd_moveRight";
constexpr const char *sMoveUpString = "cmd_moveUp";
constexpr const char *sMoveDownString = "cmd_moveDown";
constexpr const char *sMoveLeft2String = "cmd_moveLeft2";
constexpr const char *sMoveRight2String = "cmd_moveRight2";
constexpr const char *sMoveUp2String = "cmd_moveUp2";
constexpr const char *sMoveDown2String = "cmd_moveDown2";
constexpr const char* sMoveLeftString = "cmd_moveLeft";
constexpr const char* sMoveRightString = "cmd_moveRight";
constexpr const char* sMoveUpString = "cmd_moveUp";
constexpr const char* sMoveDownString = "cmd_moveDown";
constexpr const char* sMoveLeft2String = "cmd_moveLeft2";
constexpr const char* sMoveRight2String = "cmd_moveRight2";
constexpr const char* sMoveUp2String = "cmd_moveUp2";
constexpr const char* sMoveDown2String = "cmd_moveDown2";
constexpr const char *sSelectLeftString = "cmd_selectLeft";
constexpr const char *sSelectRightString = "cmd_selectRight";
constexpr const char *sSelectUpString = "cmd_selectUp";
constexpr const char *sSelectDownString = "cmd_selectDown";
constexpr const char *sSelectLeft2String = "cmd_selectLeft2";
constexpr const char *sSelectRight2String = "cmd_selectRight2";
constexpr const char *sSelectUp2String = "cmd_selectUp2";
constexpr const char *sSelectDown2String = "cmd_selectDown2";
constexpr const char* sSelectLeftString = "cmd_selectLeft";
constexpr const char* sSelectRightString = "cmd_selectRight";
constexpr const char* sSelectUpString = "cmd_selectUp";
constexpr const char* sSelectDownString = "cmd_selectDown";
constexpr const char* sSelectLeft2String = "cmd_selectLeft2";
constexpr const char* sSelectRight2String = "cmd_selectRight2";
constexpr const char* sSelectUp2String = "cmd_selectUp2";
constexpr const char* sSelectDown2String = "cmd_selectDown2";
#if 0
# pragma mark -
@@ -115,24 +115,24 @@ constexpr const char *sSelectDown2String = "cmd_selectDown2";
class nsSelectionCommandsBase : public nsIControllerCommand {
public:
NS_DECL_ISUPPORTS
NS_IMETHOD IsCommandEnabled(const char *aCommandName,
nsISupports *aCommandContext,
bool *_retval) override;
NS_IMETHOD GetCommandStateParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *aCommandContext) override;
NS_IMETHOD IsCommandEnabled(const char* aCommandName,
nsISupports* aCommandContext,
bool* _retval) override;
NS_IMETHOD GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* aCommandContext) override;
MOZ_CAN_RUN_SCRIPT
NS_IMETHOD DoCommandParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *aCommandContext) override;
NS_IMETHOD DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* aCommandContext) override;
protected:
virtual ~nsSelectionCommandsBase() {}
static nsresult GetPresShellFromWindow(nsPIDOMWindowOuter *aWindow,
PresShell **aPresShell);
static nsresult GetPresShellFromWindow(nsPIDOMWindowOuter* aWindow,
PresShell** aPresShell);
static nsresult GetSelectionControllerFromWindow(
nsPIDOMWindowOuter *aWindow, nsISelectionController **aSelCon);
nsPIDOMWindowOuter* aWindow, nsISelectionController** aSelCon);
// no member variables, please, we're stateless!
};
@@ -141,8 +141,8 @@ class nsSelectionCommandsBase : public nsIControllerCommand {
// caret' setting
class nsSelectMoveScrollCommand : public nsSelectionCommandsBase {
public:
NS_IMETHOD DoCommand(const char *aCommandName,
nsISupports *aCommandContext) override;
NS_IMETHOD DoCommand(const char* aCommandName,
nsISupports* aCommandContext) override;
// no member variables, please, we're stateless!
};
@@ -150,8 +150,8 @@ class nsSelectMoveScrollCommand : public nsSelectionCommandsBase {
// this class implements physical-movement versions of the above
class nsPhysicalSelectMoveScrollCommand : public nsSelectionCommandsBase {
public:
NS_IMETHOD DoCommand(const char *aCommandName,
nsISupports *aCommandContext) override;
NS_IMETHOD DoCommand(const char* aCommandName,
nsISupports* aCommandContext) override;
// no member variables, please, we're stateless!
};
@@ -159,8 +159,8 @@ class nsPhysicalSelectMoveScrollCommand : public nsSelectionCommandsBase {
// this class implements other selection commands
class nsSelectCommand : public nsSelectionCommandsBase {
public:
NS_IMETHOD DoCommand(const char *aCommandName,
nsISupports *aCommandContext) override;
NS_IMETHOD DoCommand(const char* aCommandName,
nsISupports* aCommandContext) override;
// no member variables, please, we're stateless!
};
@@ -168,8 +168,8 @@ class nsSelectCommand : public nsSelectionCommandsBase {
// this class implements physical-movement versions of selection commands
class nsPhysicalSelectCommand : public nsSelectionCommandsBase {
public:
NS_IMETHOD DoCommand(const char *aCommandName,
nsISupports *aCommandContext) override;
NS_IMETHOD DoCommand(const char* aCommandName,
nsISupports* aCommandContext) override;
// no member variables, please, we're stateless!
};
@@ -181,9 +181,9 @@ class nsPhysicalSelectCommand : public nsSelectionCommandsBase {
NS_IMPL_ISUPPORTS(nsSelectionCommandsBase, nsIControllerCommand)
NS_IMETHODIMP
nsSelectionCommandsBase::IsCommandEnabled(const char *aCommandName,
nsISupports *aCommandContext,
bool *outCmdEnabled) {
nsSelectionCommandsBase::IsCommandEnabled(const char* aCommandName,
nsISupports* aCommandContext,
bool* outCmdEnabled) {
// XXX this needs fixing. e.g. you can't scroll up if you're already at the
// top of the document.
*outCmdEnabled = true;
@@ -191,28 +191,28 @@ nsSelectionCommandsBase::IsCommandEnabled(const char *aCommandName,
}
NS_IMETHODIMP
nsSelectionCommandsBase::GetCommandStateParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *aCommandContext) {
nsSelectionCommandsBase::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* aCommandContext) {
// XXX we should probably return the enabled state
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSelectionCommandsBase::DoCommandParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *aCommandContext) {
nsSelectionCommandsBase::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* aCommandContext) {
return DoCommand(aCommandName, aCommandContext);
}
// protected methods
nsresult nsSelectionCommandsBase::GetPresShellFromWindow(
nsPIDOMWindowOuter *aWindow, PresShell **aPresShell) {
nsPIDOMWindowOuter* aWindow, PresShell** aPresShell) {
*aPresShell = nullptr;
NS_ENSURE_TRUE(aWindow, NS_ERROR_FAILURE);
nsIDocShell *docShell = aWindow->GetDocShell();
nsIDocShell* docShell = aWindow->GetDocShell();
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
NS_IF_ADDREF(*aPresShell = docShell->GetPresShell());
@@ -220,7 +220,7 @@ nsresult nsSelectionCommandsBase::GetPresShellFromWindow(
}
nsresult nsSelectionCommandsBase::GetSelectionControllerFromWindow(
nsPIDOMWindowOuter *aWindow, nsISelectionController **aSelCon) {
nsPIDOMWindowOuter* aWindow, nsISelectionController** aSelCon) {
RefPtr<PresShell> presShell;
GetPresShellFromWindow(aWindow, getter_AddRefs(presShell));
if (!presShell) {
@@ -236,9 +236,9 @@ nsresult nsSelectionCommandsBase::GetSelectionControllerFromWindow(
#endif
// Helpers for nsSelectMoveScrollCommand and nsPhysicalSelectMoveScrollCommand
static void AdjustFocusAfterCaretMove(nsPIDOMWindowOuter *aWindow) {
static void AdjustFocusAfterCaretMove(nsPIDOMWindowOuter* aWindow) {
// adjust the focus to the new caret position
nsIFocusManager *fm = nsFocusManager::GetFocusManager();
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
RefPtr<dom::Element> result;
fm->MoveFocus(aWindow, nullptr, nsIFocusManager::MOVEFOCUS_CARET,
@@ -246,8 +246,8 @@ static void AdjustFocusAfterCaretMove(nsPIDOMWindowOuter *aWindow) {
}
}
static bool IsCaretOnInWindow(nsPIDOMWindowOuter *aWindow,
nsISelectionController *aSelCont) {
static bool IsCaretOnInWindow(nsPIDOMWindowOuter* aWindow,
nsISelectionController* aSelCont) {
// We allow the caret to be moved with arrow keys on any window for which
// the caret is enabled. In particular, this includes caret-browsing mode
// in non-chrome documents.
@@ -300,8 +300,8 @@ static constexpr struct BrowseCommand {
&nsISelectionController::CompleteScroll,
&nsISelectionController::IntraLineMove}};
nsresult nsSelectMoveScrollCommand::DoCommand(const char *aCommandName,
nsISupports *aCommandContext) {
nsresult nsSelectMoveScrollCommand::DoCommand(const char* aCommandName,
nsISupports* aCommandContext) {
nsCOMPtr<nsPIDOMWindowOuter> piWindow(do_QueryInterface(aCommandContext));
nsCOMPtr<nsISelectionController> selCont;
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
@@ -329,7 +329,7 @@ nsresult nsSelectMoveScrollCommand::DoCommand(const char *aCommandName,
// ScrollLine, etc., as if for horizontal-mode content, but this may need
// to be reconsidered once we have more experience with vertical content.
static const struct PhysicalBrowseCommand {
const char *command;
const char* command;
int16_t direction, amount;
KeyboardScrollAction::KeyboardScrollActionType scrollAction;
nsresult (NS_STDCALL nsISelectionController::*scroll)(bool);
@@ -359,7 +359,7 @@ static const struct PhysicalBrowseCommand {
};
nsresult nsPhysicalSelectMoveScrollCommand::DoCommand(
const char *aCommandName, nsISupports *aCommandContext) {
const char* aCommandName, nsISupports* aCommandContext) {
nsCOMPtr<nsPIDOMWindowOuter> piWindow(do_QueryInterface(aCommandContext));
nsCOMPtr<nsISelectionController> selCont;
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
@@ -368,7 +368,7 @@ nsresult nsPhysicalSelectMoveScrollCommand::DoCommand(
bool caretOn = IsCaretOnInWindow(piWindow, selCont);
for (size_t i = 0; i < ArrayLength(physicalBrowseCommands); i++) {
const PhysicalBrowseCommand &cmd = physicalBrowseCommands[i];
const PhysicalBrowseCommand& cmd = physicalBrowseCommands[i];
if (!strcmp(aCommandName, cmd.command)) {
int16_t dir = cmd.direction;
if (caretOn &&
@@ -406,8 +406,8 @@ static const struct SelectCommand {
{sSelectTopString, sSelectBottomString,
&nsISelectionController::CompleteMove}};
nsresult nsSelectCommand::DoCommand(const char *aCommandName,
nsISupports *aCommandContext) {
nsresult nsSelectCommand::DoCommand(const char* aCommandName,
nsISupports* aCommandContext) {
nsCOMPtr<nsPIDOMWindowOuter> piWindow(do_QueryInterface(aCommandContext));
nsCOMPtr<nsISelectionController> selCont;
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
@@ -429,7 +429,7 @@ nsresult nsSelectCommand::DoCommand(const char *aCommandName,
#endif
static const struct PhysicalSelectCommand {
const char *command;
const char* command;
int16_t direction, amount;
} physicalSelectCommands[] = {
{sSelectLeftString, nsISelectionController::MOVE_LEFT, 0},
@@ -441,8 +441,8 @@ static const struct PhysicalSelectCommand {
{sSelectUp2String, nsISelectionController::MOVE_UP, 1},
{sSelectDown2String, nsISelectionController::MOVE_DOWN, 1}};
nsresult nsPhysicalSelectCommand::DoCommand(const char *aCommandName,
nsISupports *aCommandContext) {
nsresult nsPhysicalSelectCommand::DoCommand(const char* aCommandName,
nsISupports* aCommandContext) {
nsCOMPtr<nsPIDOMWindowOuter> piWindow(do_QueryInterface(aCommandContext));
nsCOMPtr<nsISelectionController> selCont;
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
@@ -472,9 +472,9 @@ class nsClipboardCommand final : public nsIControllerCommand {
NS_IMPL_ISUPPORTS(nsClipboardCommand, nsIControllerCommand)
nsresult nsClipboardCommand::IsCommandEnabled(const char *aCommandName,
nsISupports *aContext,
bool *outCmdEnabled) {
nsresult nsClipboardCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* aContext,
bool* outCmdEnabled) {
NS_ENSURE_ARG_POINTER(outCmdEnabled);
*outCmdEnabled = false;
@@ -501,8 +501,8 @@ nsresult nsClipboardCommand::IsCommandEnabled(const char *aCommandName,
return NS_OK;
}
nsresult nsClipboardCommand::DoCommand(const char *aCommandName,
nsISupports *aContext) {
nsresult nsClipboardCommand::DoCommand(const char* aCommandName,
nsISupports* aContext) {
if (strcmp(aCommandName, "cmd_cut") && strcmp(aCommandName, "cmd_copy") &&
strcmp(aCommandName, "cmd_paste"))
return NS_OK;
@@ -510,7 +510,7 @@ nsresult nsClipboardCommand::DoCommand(const char *aCommandName,
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryInterface(aContext);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsIDocShell *docShell = window->GetDocShell();
nsIDocShell* docShell = window->GetDocShell();
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
RefPtr<PresShell> presShell = docShell->GetPresShell();
@@ -532,15 +532,15 @@ nsresult nsClipboardCommand::DoCommand(const char *aCommandName,
}
NS_IMETHODIMP
nsClipboardCommand::GetCommandStateParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *aCommandContext) {
nsClipboardCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* aCommandContext) {
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult nsClipboardCommand::DoCommandParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *aContext) {
nsresult nsClipboardCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* aContext) {
return DoCommand(aCommandName, aContext);
}
@@ -556,15 +556,15 @@ class nsSelectionCommand : public nsIControllerCommand {
protected:
virtual ~nsSelectionCommand() {}
virtual nsresult IsClipboardCommandEnabled(const char *aCommandName,
nsIContentViewerEdit *aEdit,
bool *outCmdEnabled) = 0;
virtual nsresult DoClipboardCommand(const char *aCommandName,
nsIContentViewerEdit *aEdit,
nsICommandParams *aParams) = 0;
virtual nsresult IsClipboardCommandEnabled(const char* aCommandName,
nsIContentViewerEdit* aEdit,
bool* outCmdEnabled) = 0;
virtual nsresult DoClipboardCommand(const char* aCommandName,
nsIContentViewerEdit* aEdit,
nsICommandParams* aParams) = 0;
static nsresult GetContentViewerEditFromContext(
nsISupports *aContext, nsIContentViewerEdit **aEditInterface);
nsISupports* aContext, nsIContentViewerEdit** aEditInterface);
// no member variables, please, we're stateless!
};
@@ -578,9 +578,9 @@ NS_IMPL_ISUPPORTS(nsSelectionCommand, nsIControllerCommand)
----------------------------------------------------------------------------*/
NS_IMETHODIMP
nsSelectionCommand::IsCommandEnabled(const char *aCommandName,
nsISupports *aCommandContext,
bool *outCmdEnabled) {
nsSelectionCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* aCommandContext,
bool* outCmdEnabled) {
NS_ENSURE_ARG_POINTER(outCmdEnabled);
*outCmdEnabled = false;
@@ -592,8 +592,8 @@ nsSelectionCommand::IsCommandEnabled(const char *aCommandName,
}
NS_IMETHODIMP
nsSelectionCommand::DoCommand(const char *aCommandName,
nsISupports *aCommandContext) {
nsSelectionCommand::DoCommand(const char* aCommandName,
nsISupports* aCommandContext) {
nsCOMPtr<nsIContentViewerEdit> contentEdit;
GetContentViewerEditFromContext(aCommandContext, getter_AddRefs(contentEdit));
NS_ENSURE_TRUE(contentEdit, NS_ERROR_NOT_INITIALIZED);
@@ -602,16 +602,16 @@ nsSelectionCommand::DoCommand(const char *aCommandName,
}
NS_IMETHODIMP
nsSelectionCommand::GetCommandStateParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *aCommandContext) {
nsSelectionCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* aCommandContext) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSelectionCommand::DoCommandParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *aCommandContext) {
nsSelectionCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* aCommandContext) {
nsCOMPtr<nsIContentViewerEdit> contentEdit;
GetContentViewerEditFromContext(aCommandContext, getter_AddRefs(contentEdit));
NS_ENSURE_TRUE(contentEdit, NS_ERROR_NOT_INITIALIZED);
@@ -620,14 +620,14 @@ nsSelectionCommand::DoCommandParams(const char *aCommandName,
}
nsresult nsSelectionCommand::GetContentViewerEditFromContext(
nsISupports *aContext, nsIContentViewerEdit **aEditInterface) {
nsISupports* aContext, nsIContentViewerEdit** aEditInterface) {
NS_ENSURE_ARG(aEditInterface);
*aEditInterface = nullptr;
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryInterface(aContext);
NS_ENSURE_TRUE(window, NS_ERROR_INVALID_ARG);
nsIDocShell *docShell = window->GetDocShell();
nsIDocShell* docShell = window->GetDocShell();
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIContentViewer> viewer;
@@ -646,12 +646,12 @@ nsresult nsSelectionCommand::GetContentViewerEditFromContext(
#define NS_DECL_CLIPBOARD_COMMAND(_cmd) \
class _cmd : public nsSelectionCommand { \
protected: \
virtual nsresult IsClipboardCommandEnabled(const char *aCommandName, \
nsIContentViewerEdit *aEdit, \
bool *outCmdEnabled) override; \
virtual nsresult DoClipboardCommand(const char *aCommandName, \
nsIContentViewerEdit *aEdit, \
nsICommandParams *aParams) override; \
virtual nsresult IsClipboardCommandEnabled(const char* aCommandName, \
nsIContentViewerEdit* aEdit, \
bool* outCmdEnabled) override; \
virtual nsresult DoClipboardCommand(const char* aCommandName, \
nsIContentViewerEdit* aEdit, \
nsICommandParams* aParams) override; \
/* no member variables, please, we're stateless! */ \
};
@@ -661,14 +661,14 @@ NS_DECL_CLIPBOARD_COMMAND(nsClipboardSelectAllNoneCommands)
NS_DECL_CLIPBOARD_COMMAND(nsClipboardGetContentsCommand)
nsresult nsClipboardCopyLinkCommand::IsClipboardCommandEnabled(
const char *aCommandName, nsIContentViewerEdit *aEdit,
bool *outCmdEnabled) {
const char* aCommandName, nsIContentViewerEdit* aEdit,
bool* outCmdEnabled) {
return aEdit->GetInLink(outCmdEnabled);
}
nsresult nsClipboardCopyLinkCommand::DoClipboardCommand(
const char *aCommandName, nsIContentViewerEdit *aEdit,
nsICommandParams *aParams) {
const char* aCommandName, nsIContentViewerEdit* aEdit,
nsICommandParams* aParams) {
return aEdit->CopyLinkLocation();
}
@@ -677,14 +677,14 @@ nsresult nsClipboardCopyLinkCommand::DoClipboardCommand(
#endif
nsresult nsClipboardImageCommands::IsClipboardCommandEnabled(
const char *aCommandName, nsIContentViewerEdit *aEdit,
bool *outCmdEnabled) {
const char* aCommandName, nsIContentViewerEdit* aEdit,
bool* outCmdEnabled) {
return aEdit->GetInImage(outCmdEnabled);
}
nsresult nsClipboardImageCommands::DoClipboardCommand(
const char *aCommandName, nsIContentViewerEdit *aEdit,
nsICommandParams *aParams) {
const char* aCommandName, nsIContentViewerEdit* aEdit,
nsICommandParams* aParams) {
if (!nsCRT::strcmp(sCopyImageLocationString, aCommandName))
return aEdit->CopyImage(nsIContentViewerEdit::COPY_IMAGE_TEXT);
if (!nsCRT::strcmp(sCopyImageContentsString, aCommandName))
@@ -702,15 +702,15 @@ nsresult nsClipboardImageCommands::DoClipboardCommand(
#endif
nsresult nsClipboardSelectAllNoneCommands::IsClipboardCommandEnabled(
const char *aCommandName, nsIContentViewerEdit *aEdit,
bool *outCmdEnabled) {
const char* aCommandName, nsIContentViewerEdit* aEdit,
bool* outCmdEnabled) {
*outCmdEnabled = true;
return NS_OK;
}
nsresult nsClipboardSelectAllNoneCommands::DoClipboardCommand(
const char *aCommandName, nsIContentViewerEdit *aEdit,
nsICommandParams *aParams) {
const char* aCommandName, nsIContentViewerEdit* aEdit,
nsICommandParams* aParams) {
if (!nsCRT::strcmp(sSelectAllString, aCommandName)) return aEdit->SelectAll();
return aEdit->ClearSelection();
@@ -721,17 +721,17 @@ nsresult nsClipboardSelectAllNoneCommands::DoClipboardCommand(
#endif
nsresult nsClipboardGetContentsCommand::IsClipboardCommandEnabled(
const char *aCommandName, nsIContentViewerEdit *aEdit,
bool *outCmdEnabled) {
const char* aCommandName, nsIContentViewerEdit* aEdit,
bool* outCmdEnabled) {
return aEdit->GetCanGetContents(outCmdEnabled);
}
nsresult nsClipboardGetContentsCommand::DoClipboardCommand(
const char *aCommandName, nsIContentViewerEdit *aEdit,
nsICommandParams *aParams) {
const char* aCommandName, nsIContentViewerEdit* aEdit,
nsICommandParams* aParams) {
NS_ENSURE_ARG(aParams);
nsCommandParams *params = aParams->AsCommandParams();
nsCommandParams* params = aParams->AsCommandParams();
nsAutoCString mimeType("text/plain");
@@ -880,35 +880,35 @@ class nsLookUpDictionaryCommand final : public nsIControllerCommand {
NS_IMPL_ISUPPORTS(nsLookUpDictionaryCommand, nsIControllerCommand)
NS_IMETHODIMP
nsLookUpDictionaryCommand::IsCommandEnabled(const char *aCommandName,
nsISupports *aCommandContext,
bool *aRetval) {
nsLookUpDictionaryCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* aCommandContext,
bool* aRetval) {
*aRetval = true;
return NS_OK;
}
NS_IMETHODIMP
nsLookUpDictionaryCommand::GetCommandStateParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *aCommandContext) {
nsLookUpDictionaryCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* aCommandContext) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsLookUpDictionaryCommand::DoCommand(const char *aCommandName,
nsISupports *aCommandContext) {
nsLookUpDictionaryCommand::DoCommand(const char* aCommandName,
nsISupports* aCommandContext) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsLookUpDictionaryCommand::DoCommandParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *aCommandContext) {
nsLookUpDictionaryCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* aCommandContext) {
if (NS_WARN_IF(!nsContentUtils::IsSafeToRunScript())) {
return NS_ERROR_NOT_AVAILABLE;
}
nsCommandParams *params = aParams->AsCommandParams();
nsCommandParams* params = aParams->AsCommandParams();
ErrorResult error;
int32_t x = params->GetInt("x", error);
@@ -927,17 +927,17 @@ nsLookUpDictionaryCommand::DoCommandParams(const char *aCommandName,
return NS_ERROR_FAILURE;
}
nsIDocShell *docShell = window->GetDocShell();
nsIDocShell* docShell = window->GetDocShell();
if (NS_WARN_IF(!docShell)) {
return NS_ERROR_FAILURE;
}
PresShell *presShell = docShell->GetPresShell();
PresShell* presShell = docShell->GetPresShell();
if (NS_WARN_IF(!presShell)) {
return NS_ERROR_FAILURE;
}
nsPresContext *presContext = presShell->GetPresContext();
nsPresContext* presContext = presShell->GetPresContext();
if (NS_WARN_IF(!presContext)) {
return NS_ERROR_FAILURE;
}
@@ -1022,31 +1022,31 @@ nsLookUpDictionaryCommand::DoCommandParams(const char *aCommandName,
----------------------------------------------------------------------------*/
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass *theCmd = new _cmdClass(); \
rv = aCommandTable->RegisterCommand( \
_cmdName, static_cast<nsIControllerCommand *>(theCmd)); \
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd = new _cmdClass(); \
rv = aCommandTable->RegisterCommand( \
_cmdName, static_cast<nsIControllerCommand*>(theCmd)); \
}
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass *theCmd = new _cmdClass(); \
_cmdClass* theCmd = new _cmdClass(); \
rv = aCommandTable->RegisterCommand( \
_cmdName, static_cast<nsIControllerCommand *>(theCmd));
_cmdName, static_cast<nsIControllerCommand*>(theCmd));
#define NS_REGISTER_NEXT_COMMAND(_cmdClass, _cmdName) \
rv = aCommandTable->RegisterCommand( \
_cmdName, static_cast<nsIControllerCommand *>(theCmd));
_cmdName, static_cast<nsIControllerCommand*>(theCmd));
#define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName) \
rv = aCommandTable->RegisterCommand( \
_cmdName, static_cast<nsIControllerCommand *>(theCmd)); \
#define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName) \
rv = aCommandTable->RegisterCommand( \
_cmdName, static_cast<nsIControllerCommand*>(theCmd)); \
}
// static
nsresult nsWindowCommandRegistration::RegisterWindowCommands(
nsControllerCommandTable *aCommandTable) {
nsControllerCommandTable* aCommandTable) {
nsresult rv;
// XXX rework the macros to use a loop is possible, reducing code size
@@ -1129,14 +1129,14 @@ nsresult nsWindowCommandRegistration::RegisterWindowCommands(
/* static */
bool nsGlobalWindowCommands::FindScrollCommand(
const char *aCommandName, KeyboardScrollAction *aOutAction) {
const char* aCommandName, KeyboardScrollAction* aOutAction) {
// Search for a keyboard scroll action to do for this command in
// browseCommands and physicalBrowseCommands. Each command exists in only one
// of them, so the order we examine browseCommands and physicalBrowseCommands
// doesn't matter.
for (size_t i = 0; i < ArrayLength(browseCommands); i++) {
const BrowseCommand &cmd = browseCommands[i];
const BrowseCommand& cmd = browseCommands[i];
bool forward = !strcmp(aCommandName, cmd.forward);
bool reverse = !strcmp(aCommandName, cmd.reverse);
if (forward || reverse) {
@@ -1146,7 +1146,7 @@ bool nsGlobalWindowCommands::FindScrollCommand(
}
for (size_t i = 0; i < ArrayLength(physicalBrowseCommands); i++) {
const PhysicalBrowseCommand &cmd = physicalBrowseCommands[i];
const PhysicalBrowseCommand& cmd = physicalBrowseCommands[i];
if (!strcmp(aCommandName, cmd.command)) {
int16_t dir = cmd.direction;
bool forward = (dir == nsISelectionController::MOVE_RIGHT ||

View File

@@ -26,9 +26,9 @@ struct ErrorEventInit;
// notifies it of an error via nsIScriptGlobalObject::HandleScriptError.
// Returns true if HandleDOMEvent was actually called, in which case
// aStatus will be filled in with the status.
bool NS_HandleScriptError(nsIScriptGlobalObject *aScriptGlobal,
const mozilla::dom::ErrorEventInit &aErrorEvent,
nsEventStatus *aStatus);
bool NS_HandleScriptError(nsIScriptGlobalObject* aScriptGlobal,
const mozilla::dom::ErrorEventInit& aErrorEvent,
nsEventStatus* aStatus);
// Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs
#define NS_ISCRIPTGLOBALOBJECT_IID \
@@ -62,15 +62,15 @@ class nsIScriptGlobalObject : public nsIGlobalObject {
/**
* Get a script context (WITHOUT added reference) for the specified language.
*/
virtual nsIScriptContext *GetScriptContext() = 0;
virtual nsIScriptContext* GetScriptContext() = 0;
nsIScriptContext *GetContext() { return GetScriptContext(); }
nsIScriptContext* GetContext() { return GetScriptContext(); }
/**
* Handle a script error. Generally called by a script context.
*/
bool HandleScriptError(const mozilla::dom::ErrorEventInit &aErrorEventInit,
nsEventStatus *aEventStatus) {
bool HandleScriptError(const mozilla::dom::ErrorEventInit& aErrorEventInit,
nsEventStatus* aEventStatus) {
return NS_HandleScriptError(this, aErrorEventInit, aEventStatus);
}

View File

@@ -36,34 +36,34 @@ struct CycleCollectorResults;
class nsJSContext : public nsIScriptContext {
public:
nsJSContext(bool aGCOnDestruction, nsIScriptGlobalObject *aGlobalObject);
nsJSContext(bool aGCOnDestruction, nsIScriptGlobalObject* aGlobalObject);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsJSContext,
nsIScriptContext)
virtual nsIScriptGlobalObject *GetGlobalObject() override;
inline nsIScriptGlobalObject *GetGlobalObjectRef() {
virtual nsIScriptGlobalObject* GetGlobalObject() override;
inline nsIScriptGlobalObject* GetGlobalObjectRef() {
return mGlobalObjectRef;
}
virtual nsresult InitContext() override;
virtual bool IsContextInitialized() override;
virtual nsresult SetProperty(JS::Handle<JSObject *> aTarget,
const char *aPropName,
nsISupports *aVal) override;
virtual nsresult SetProperty(JS::Handle<JSObject*> aTarget,
const char* aPropName,
nsISupports* aVal) override;
virtual bool GetProcessingScriptTag() override;
virtual void SetProcessingScriptTag(bool aResult) override;
virtual nsresult InitClasses(JS::Handle<JSObject *> aGlobalObj) override;
virtual nsresult InitClasses(JS::Handle<JSObject*> aGlobalObj) override;
virtual void WillInitializeContext() override;
virtual void DidInitializeContext() override;
virtual void SetWindowProxy(JS::Handle<JSObject *> aWindowProxy) override;
virtual JSObject *GetWindowProxy() override;
virtual void SetWindowProxy(JS::Handle<JSObject*> aWindowProxy) override;
virtual JSObject* GetWindowProxy() override;
enum IsShrinking { ShrinkingGC, NonShrinkingGC };
@@ -77,7 +77,7 @@ class nsJSContext : public nsIScriptContext {
IsShrinking aShrinking = NonShrinkingGC,
int64_t aSliceMillis = 0);
static void CycleCollectNow(nsICycleCollectorListener *aListener = nullptr);
static void CycleCollectNow(nsICycleCollectorListener* aListener = nullptr);
// Run a cycle collector slice, using a heuristic to decide how long to run
// it.
@@ -88,7 +88,7 @@ class nsJSContext : public nsIScriptContext {
static void BeginCycleCollectionCallback();
static void EndCycleCollectionCallback(
mozilla::CycleCollectorResults &aResults);
mozilla::CycleCollectorResults& aResults);
// Return the longest CC slice time since ClearMaxCCSliceTime() was last
// called.
@@ -102,11 +102,11 @@ class nsJSContext : public nsIScriptContext {
// If user has been idle and aDocShell is for an iframe being loaded in an
// already loaded top level docshell, this will run a CC or GC
// timer/runner if there is such pending.
static void MaybeRunNextCollectorSlice(nsIDocShell *aDocShell,
static void MaybeRunNextCollectorSlice(nsIDocShell* aDocShell,
JS::GCReason aReason);
// The GC should probably run soon, in the zone of object aObj (if given).
static void PokeGC(JS::GCReason aReason, JSObject *aObj, int aDelay = 0);
static void PokeGC(JS::GCReason aReason, JSObject* aObj, int aDelay = 0);
static void KillGCTimer();
static void PokeShrinkingGC();
@@ -123,10 +123,10 @@ class nsJSContext : public nsIScriptContext {
static uint32_t CleanupsSinceLastGC();
nsIScriptGlobalObject *GetCachedGlobalObject() {
nsIScriptGlobalObject* GetCachedGlobalObject() {
// Verify that we have a global so that this
// does always return a null when GetGlobalObject() is null.
JSObject *global = GetWindowProxy();
JSObject* global = GetWindowProxy();
return global ? mGlobalObjectRef.get() : nullptr;
}
@@ -134,17 +134,17 @@ class nsJSContext : public nsIScriptContext {
virtual ~nsJSContext();
// Helper to convert xpcom datatypes to jsvals.
nsresult ConvertSupportsTojsvals(JSContext *aCx, nsISupports *aArgs,
JS::Handle<JSObject *> aScope,
nsresult ConvertSupportsTojsvals(JSContext* aCx, nsISupports* aArgs,
JS::Handle<JSObject*> aScope,
JS::MutableHandleVector<JS::Value> aArgsOut);
nsresult AddSupportsPrimitiveTojsvals(JSContext *aCx, nsISupports *aArg,
JS::Value *aArgv);
nsresult AddSupportsPrimitiveTojsvals(JSContext* aCx, nsISupports* aArg,
JS::Value* aArgv);
private:
void Destroy();
JS::Heap<JSObject *> mWindowProxy;
JS::Heap<JSObject*> mWindowProxy;
bool mIsInitialized;
bool mGCOnDestruction;
@@ -154,7 +154,7 @@ class nsJSContext : public nsIScriptContext {
// context does. It is eventually collected by the cycle collector.
nsCOMPtr<nsIScriptGlobalObject> mGlobalObjectRef;
static bool DOMOperationCallback(JSContext *cx);
static bool DOMOperationCallback(JSContext* cx);
};
namespace mozilla {
@@ -167,7 +167,7 @@ void ShutdownJSEnvironment();
class AsyncErrorReporter final : public mozilla::Runnable {
public:
// aWindow may be null if this error report is not associated with a window
explicit AsyncErrorReporter(xpc::ErrorReport *aReport)
explicit AsyncErrorReporter(xpc::ErrorReport* aReport)
: Runnable("dom::AsyncErrorReporter"), mReport(aReport) {}
NS_IMETHOD Run() override {
@@ -199,7 +199,7 @@ class nsIJSArgArray : public nsIArray {
// Bug 312003 describes why this must be "void **", but after calling argv
// may be cast to JS::Value* and the args found at:
// ((JS::Value*)argv)[0], ..., ((JS::Value*)argv)[argc - 1]
virtual nsresult GetArgs(uint32_t *argc, void **argv) = 0;
virtual nsresult GetArgs(uint32_t* argc, void** argv) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIJSArgArray, NS_IJSARGARRAY_IID)

View File

@@ -23,10 +23,10 @@
NS_IMPL_ISUPPORTS(nsNoDataProtocolContentPolicy, nsIContentPolicy)
NS_IMETHODIMP
nsNoDataProtocolContentPolicy::ShouldLoad(nsIURI *aContentLocation,
nsILoadInfo *aLoadInfo,
const nsACString &aMimeGuess,
int16_t *aDecision) {
nsNoDataProtocolContentPolicy::ShouldLoad(nsIURI* aContentLocation,
nsILoadInfo* aLoadInfo,
const nsACString& aMimeGuess,
int16_t* aDecision) {
uint32_t contentType = aLoadInfo->GetExternalContentPolicyType();
MOZ_ASSERT(contentType == nsContentUtils::InternalContentPolicyTypeToExternal(
@@ -67,9 +67,9 @@ nsNoDataProtocolContentPolicy::ShouldLoad(nsIURI *aContentLocation,
}
NS_IMETHODIMP
nsNoDataProtocolContentPolicy::ShouldProcess(nsIURI *aContentLocation,
nsILoadInfo *aLoadInfo,
const nsACString &aMimeGuess,
int16_t *aDecision) {
nsNoDataProtocolContentPolicy::ShouldProcess(nsIURI* aContentLocation,
nsILoadInfo* aLoadInfo,
const nsACString& aMimeGuess,
int16_t* aDecision) {
return ShouldLoad(aContentLocation, aLoadInfo, aMimeGuess, aDecision);
}

View File

@@ -44,9 +44,9 @@ class nsSyncLoader : public nsIStreamListener,
NS_DECL_ISUPPORTS
nsresult LoadDocument(nsIChannel *aChannel, bool aChannelIsSync,
nsresult LoadDocument(nsIChannel* aChannel, bool aChannelIsSync,
bool aForceToXML, ReferrerPolicy aReferrerPolicy,
Document **aResult);
Document** aResult);
NS_FORWARD_NSISTREAMLISTENER(mListener->)
NS_DECL_NSIREQUESTOBSERVER
@@ -58,8 +58,8 @@ class nsSyncLoader : public nsIStreamListener,
private:
virtual ~nsSyncLoader();
nsresult PushAsyncStream(nsIStreamListener *aListener);
nsresult PushSyncStream(nsIStreamListener *aListener);
nsresult PushAsyncStream(nsIStreamListener* aListener);
nsresult PushSyncStream(nsIStreamListener* aListener);
nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsIStreamListener> mListener;
@@ -71,7 +71,7 @@ class nsForceXMLListener : public nsIStreamListener {
virtual ~nsForceXMLListener();
public:
explicit nsForceXMLListener(nsIStreamListener *aListener);
explicit nsForceXMLListener(nsIStreamListener* aListener);
NS_DECL_ISUPPORTS
NS_FORWARD_NSISTREAMLISTENER(mListener->)
@@ -81,7 +81,7 @@ class nsForceXMLListener : public nsIStreamListener {
nsCOMPtr<nsIStreamListener> mListener;
};
nsForceXMLListener::nsForceXMLListener(nsIStreamListener *aListener)
nsForceXMLListener::nsForceXMLListener(nsIStreamListener* aListener)
: mListener(aListener) {}
nsForceXMLListener::~nsForceXMLListener() {}
@@ -89,7 +89,7 @@ nsForceXMLListener::~nsForceXMLListener() {}
NS_IMPL_ISUPPORTS(nsForceXMLListener, nsIStreamListener, nsIRequestObserver)
NS_IMETHODIMP
nsForceXMLListener::OnStartRequest(nsIRequest *aRequest) {
nsForceXMLListener::OnStartRequest(nsIRequest* aRequest) {
nsresult status;
aRequest->GetStatus(&status);
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
@@ -101,7 +101,7 @@ nsForceXMLListener::OnStartRequest(nsIRequest *aRequest) {
}
NS_IMETHODIMP
nsForceXMLListener::OnStopRequest(nsIRequest *aRequest, nsresult aStatusCode) {
nsForceXMLListener::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
return mListener->OnStopRequest(aRequest, aStatusCode);
}
@@ -115,10 +115,10 @@ NS_IMPL_ISUPPORTS(nsSyncLoader, nsIStreamListener, nsIRequestObserver,
nsIChannelEventSink, nsIInterfaceRequestor,
nsISupportsWeakReference)
nsresult nsSyncLoader::LoadDocument(nsIChannel *aChannel, bool aChannelIsSync,
nsresult nsSyncLoader::LoadDocument(nsIChannel* aChannel, bool aChannelIsSync,
bool aForceToXML,
ReferrerPolicy aReferrerPolicy,
Document **aResult) {
Document** aResult) {
NS_ENSURE_ARG(aChannel);
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nullptr;
@@ -195,7 +195,7 @@ nsresult nsSyncLoader::LoadDocument(nsIChannel *aChannel, bool aChannelIsSync,
return NS_OK;
}
nsresult nsSyncLoader::PushAsyncStream(nsIStreamListener *aListener) {
nsresult nsSyncLoader::PushAsyncStream(nsIStreamListener* aListener) {
mListener = aListener;
mAsyncLoadStatus = NS_OK;
@@ -206,7 +206,7 @@ nsresult nsSyncLoader::PushAsyncStream(nsIStreamListener *aListener) {
if (NS_SUCCEEDED(rv)) {
// process events until we're finished.
mLoading = true;
nsIThread *thread = NS_GetCurrentThread();
nsIThread* thread = NS_GetCurrentThread();
while (mLoading && NS_SUCCEEDED(rv)) {
bool processedEvent;
rv = thread->ProcessNextEvent(true, &processedEvent);
@@ -224,7 +224,7 @@ nsresult nsSyncLoader::PushAsyncStream(nsIStreamListener *aListener) {
return mAsyncLoadStatus;
}
nsresult nsSyncLoader::PushSyncStream(nsIStreamListener *aListener) {
nsresult nsSyncLoader::PushSyncStream(nsIStreamListener* aListener) {
nsCOMPtr<nsIInputStream> in;
nsresult rv = mChannel->Open(getter_AddRefs(in));
NS_ENSURE_SUCCESS(rv, rv);
@@ -238,12 +238,12 @@ nsresult nsSyncLoader::PushSyncStream(nsIStreamListener *aListener) {
}
NS_IMETHODIMP
nsSyncLoader::OnStartRequest(nsIRequest *aRequest) {
nsSyncLoader::OnStartRequest(nsIRequest* aRequest) {
return mListener->OnStartRequest(aRequest);
}
NS_IMETHODIMP
nsSyncLoader::OnStopRequest(nsIRequest *aRequest, nsresult aStatusCode) {
nsSyncLoader::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
if (NS_SUCCEEDED(mAsyncLoadStatus) && NS_FAILED(aStatusCode)) {
mAsyncLoadStatus = aStatusCode;
}
@@ -257,9 +257,9 @@ nsSyncLoader::OnStopRequest(nsIRequest *aRequest, nsresult aStatusCode) {
}
NS_IMETHODIMP
nsSyncLoader::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
nsIChannel *aNewChannel, uint32_t aFlags,
nsIAsyncVerifyRedirectCallback *callback) {
nsSyncLoader::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
nsIChannel* aNewChannel, uint32_t aFlags,
nsIAsyncVerifyRedirectCallback* callback) {
MOZ_ASSERT(aNewChannel, "Redirecting to null channel?");
mChannel = aNewChannel;
@@ -269,16 +269,16 @@ nsSyncLoader::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
}
NS_IMETHODIMP
nsSyncLoader::GetInterface(const nsIID &aIID, void **aResult) {
nsSyncLoader::GetInterface(const nsIID& aIID, void** aResult) {
return QueryInterface(aIID, aResult);
}
/* static */
nsresult nsSyncLoadService::LoadDocument(
nsIURI *aURI, nsContentPolicyType aContentPolicyType,
nsIPrincipal *aLoaderPrincipal, nsSecurityFlags aSecurityFlags,
nsILoadGroup *aLoadGroup, nsICookieSettings *aCookieSettings,
bool aForceToXML, ReferrerPolicy aReferrerPolicy, Document **aResult) {
nsIURI* aURI, nsContentPolicyType aContentPolicyType,
nsIPrincipal* aLoaderPrincipal, nsSecurityFlags aSecurityFlags,
nsILoadGroup* aLoadGroup, nsICookieSettings* aCookieSettings,
bool aForceToXML, ReferrerPolicy aReferrerPolicy, Document** aResult) {
nsCOMPtr<nsIChannel> channel;
nsresult rv =
NS_NewChannel(getter_AddRefs(channel), aURI, aLoaderPrincipal,
@@ -304,8 +304,8 @@ nsresult nsSyncLoadService::LoadDocument(
/* static */
nsresult nsSyncLoadService::PushSyncStreamToListener(
already_AddRefed<nsIInputStream> aIn, nsIStreamListener *aListener,
nsIChannel *aChannel) {
already_AddRefed<nsIInputStream> aIn, nsIStreamListener* aListener,
nsIChannel* aChannel) {
nsCOMPtr<nsIInputStream> in = std::move(aIn);
// Set up buffering stream

View File

@@ -20,7 +20,7 @@ static inline bool is_zero(__m128i x) {
return _mm_movemask_epi8(_mm_cmpeq_epi8(x, _mm_setzero_si128())) == 0xffff;
}
int32_t FirstNon8Bit(const char16_t *str, const char16_t *end) {
int32_t FirstNon8Bit(const char16_t* str, const char16_t* end) {
const uint32_t numUnicharsPerVector = 8;
typedef Non8BitParameters<sizeof(size_t)> p;
const size_t mask = p::mask();
@@ -42,7 +42,7 @@ int32_t FirstNon8Bit(const char16_t *str, const char16_t *end) {
const uint16_t shortMask = 0xff00;
__m128i vectmask = _mm_set1_epi16(static_cast<int16_t>(shortMask));
for (; i < vectWalkEnd; i += numUnicharsPerVector) {
const __m128i vect = *reinterpret_cast<const __m128i *>(str + i);
const __m128i vect = *reinterpret_cast<const __m128i*>(str + i);
if (!is_zero(_mm_and_si128(vect, vectmask))) return i;
}
@@ -50,7 +50,7 @@ int32_t FirstNon8Bit(const char16_t *str, const char16_t *end) {
const int32_t wordWalkEnd =
((len - i) / numUnicharsPerWord) * numUnicharsPerWord;
for (; i < wordWalkEnd; i += numUnicharsPerWord) {
const size_t word = *reinterpret_cast<const size_t *>(str + i);
const size_t word = *reinterpret_cast<const size_t*>(str + i);
if (word & mask) return i;
}

View File

@@ -12,7 +12,7 @@
#include "nsCRT.h"
#include "nsIParserUtils.h"
void ConvertBufToPlainText(nsString &aConBuf, int aFlag) {
void ConvertBufToPlainText(nsString& aConBuf, int aFlag) {
nsCOMPtr<nsIParserUtils> utils = do_GetService(NS_PARSERUTILS_CONTRACTID);
utils->ConvertToPlainText(aConBuf, aFlag, 72, aConBuf);
}

View File

@@ -54,9 +54,9 @@ inline uint64_t rotl64(uint64_t x, int8_t r) {
// Block read - if your platform needs to do endian-swapping or can only
// handle aligned reads, do the conversion here
FORCE_INLINE uint32_t getblock(const uint32_t *p, int i) { return p[i]; }
FORCE_INLINE uint32_t getblock(const uint32_t* p, int i) { return p[i]; }
FORCE_INLINE uint64_t getblock(const uint64_t *p, int i) { return p[i]; }
FORCE_INLINE uint64_t getblock(const uint64_t* p, int i) { return p[i]; }
//-----------------------------------------------------------------------------
// Finalization mix - force all bits of a hash block to avalanche
@@ -87,8 +87,8 @@ FORCE_INLINE uint64_t fmix(uint64_t k) {
//-----------------------------------------------------------------------------
void MurmurHash3_x86_32(const void *key, int len, uint32_t seed, void *out) {
const uint8_t *data = (const uint8_t *)key;
void MurmurHash3_x86_32(const void* key, int len, uint32_t seed, void* out) {
const uint8_t* data = (const uint8_t*)key;
const int nblocks = len / 4;
uint32_t h1 = seed;
@@ -99,7 +99,7 @@ void MurmurHash3_x86_32(const void *key, int len, uint32_t seed, void *out) {
//----------
// body
const uint32_t *blocks = (const uint32_t *)(data + nblocks * 4);
const uint32_t* blocks = (const uint32_t*)(data + nblocks * 4);
for (int i = -nblocks; i; i++) {
uint32_t k1 = getblock(blocks, i);
@@ -116,7 +116,7 @@ void MurmurHash3_x86_32(const void *key, int len, uint32_t seed, void *out) {
//----------
// tail
const uint8_t *tail = (const uint8_t *)(data + nblocks * 4);
const uint8_t* tail = (const uint8_t*)(data + nblocks * 4);
uint32_t k1 = 0;
@@ -140,14 +140,14 @@ void MurmurHash3_x86_32(const void *key, int len, uint32_t seed, void *out) {
h1 = fmix(h1);
*(uint32_t *)out = h1;
*(uint32_t*)out = h1;
}
//-----------------------------------------------------------------------------
void MurmurHash3_x86_128(const void *key, const int len, uint32_t seed,
void *out) {
const uint8_t *data = (const uint8_t *)key;
void MurmurHash3_x86_128(const void* key, const int len, uint32_t seed,
void* out) {
const uint8_t* data = (const uint8_t*)key;
const int nblocks = len / 16;
uint32_t h1 = seed;
@@ -163,7 +163,7 @@ void MurmurHash3_x86_128(const void *key, const int len, uint32_t seed,
//----------
// body
const uint32_t *blocks = (const uint32_t *)(data + nblocks * 16);
const uint32_t* blocks = (const uint32_t*)(data + nblocks * 16);
for (int i = -nblocks; i; i++) {
uint32_t k1 = getblock(blocks, i * 4 + 0);
@@ -211,7 +211,7 @@ void MurmurHash3_x86_128(const void *key, const int len, uint32_t seed,
//----------
// tail
const uint8_t *tail = (const uint8_t *)(data + nblocks * 16);
const uint8_t* tail = (const uint8_t*)(data + nblocks * 16);
uint32_t k1 = 0;
uint32_t k2 = 0;
@@ -297,17 +297,17 @@ void MurmurHash3_x86_128(const void *key, const int len, uint32_t seed,
h3 += h1;
h4 += h1;
((uint32_t *)out)[0] = h1;
((uint32_t *)out)[1] = h2;
((uint32_t *)out)[2] = h3;
((uint32_t *)out)[3] = h4;
((uint32_t*)out)[0] = h1;
((uint32_t*)out)[1] = h2;
((uint32_t*)out)[2] = h3;
((uint32_t*)out)[3] = h4;
}
//-----------------------------------------------------------------------------
void MurmurHash3_x64_128(const void *key, const int len, const uint32_t seed,
void *out) {
const uint8_t *data = (const uint8_t *)key;
void MurmurHash3_x64_128(const void* key, const int len, const uint32_t seed,
void* out) {
const uint8_t* data = (const uint8_t*)key;
const int nblocks = len / 16;
uint64_t h1 = seed;
@@ -319,7 +319,7 @@ void MurmurHash3_x64_128(const void *key, const int len, const uint32_t seed,
//----------
// body
const uint64_t *blocks = (const uint64_t *)(data);
const uint64_t* blocks = (const uint64_t*)(data);
for (int i = 0; i < nblocks; i++) {
uint64_t k1 = getblock(blocks, i * 2 + 0);
@@ -347,7 +347,7 @@ void MurmurHash3_x64_128(const void *key, const int len, const uint32_t seed,
//----------
// tail
const uint8_t *tail = (const uint8_t *)(data + nblocks * 16);
const uint8_t* tail = (const uint8_t*)(data + nblocks * 16);
uint64_t k1 = 0;
uint64_t k2 = 0;
@@ -409,8 +409,8 @@ void MurmurHash3_x64_128(const void *key, const int len, const uint32_t seed,
h1 += h2;
h2 += h1;
((uint64_t *)out)[0] = h1;
((uint64_t *)out)[1] = h2;
((uint64_t*)out)[0] = h1;
((uint64_t*)out)[1] = h2;
}
//-----------------------------------------------------------------------------

View File

@@ -13,7 +13,7 @@ namespace mozilla {
namespace dom {
MOZ_MUST_USE RefPtr<ClientOpPromise> ClientOpenWindowInCurrentProcess(
const ClientOpenWindowArgs &aArgs);
const ClientOpenWindowArgs& aArgs);
} // namespace dom
} // namespace mozilla

View File

@@ -14,7 +14,7 @@ using namespace mozilla;
using namespace mozilla::dom;
/* static */
nsresult FontTableURIProtocolHandler::GenerateURIString(nsACString &aUri) {
nsresult FontTableURIProtocolHandler::GenerateURIString(nsACString& aUri) {
nsresult rv;
nsCOMPtr<nsIUUIDGenerator> uuidgen =
do_GetService("@mozilla.org/uuid-generator;1", &rv);
@@ -42,46 +42,46 @@ NS_IMPL_ISUPPORTS(FontTableURIProtocolHandler, nsIProtocolHandler,
nsISupportsWeakReference)
NS_IMETHODIMP
FontTableURIProtocolHandler::GetDefaultPort(int32_t *result) {
FontTableURIProtocolHandler::GetDefaultPort(int32_t* result) {
*result = -1;
return NS_OK;
}
NS_IMETHODIMP
FontTableURIProtocolHandler::GetProtocolFlags(uint32_t *result) {
FontTableURIProtocolHandler::GetProtocolFlags(uint32_t* result) {
*result = URI_NORELATIVE | URI_NOAUTH | URI_LOADABLE_BY_SUBSUMERS |
URI_NON_PERSISTABLE | URI_IS_LOCAL_RESOURCE;
return NS_OK;
}
NS_IMETHODIMP
FontTableURIProtocolHandler::GetFlagsForURI(nsIURI *aURI, uint32_t *aResult) {
FontTableURIProtocolHandler::GetFlagsForURI(nsIURI* aURI, uint32_t* aResult) {
return FontTableURIProtocolHandler::GetProtocolFlags(aResult);
}
NS_IMETHODIMP
FontTableURIProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
nsIChannel **result) {
FontTableURIProtocolHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
nsIChannel** result) {
return NS_ERROR_DOM_BAD_URI;
}
NS_IMETHODIMP
FontTableURIProtocolHandler::AllowPort(int32_t port, const char *scheme,
bool *_retval) {
FontTableURIProtocolHandler::AllowPort(int32_t port, const char* scheme,
bool* _retval) {
*_retval = false;
return NS_OK;
}
NS_IMETHODIMP
FontTableURIProtocolHandler::GetScheme(nsACString &result) {
FontTableURIProtocolHandler::GetScheme(nsACString& result) {
result.AssignLiteral(FONTTABLEURI_SCHEME);
return NS_OK;
}
NS_IMETHODIMP
FontTableURIProtocolHandler::NewURI(const nsACString &aSpec,
const char *aCharset, nsIURI *aBaseURI,
nsIURI **aResult) {
FontTableURIProtocolHandler::NewURI(const nsACString& aSpec,
const char* aCharset, nsIURI* aBaseURI,
nsIURI** aResult) {
nsresult rv;
nsCOMPtr<nsIURI> uri;

View File

@@ -40,9 +40,9 @@ using namespace mozilla::net;
static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
bool sDisablePrefetchHTTPSPref;
static bool sInitialized = false;
static nsIDNSService *sDNSService = nullptr;
static nsHTMLDNSPrefetch::nsDeferrals *sPrefetches = nullptr;
static nsHTMLDNSPrefetch::nsListener *sDNSListener = nullptr;
static nsIDNSService* sDNSService = nullptr;
static nsHTMLDNSPrefetch::nsDeferrals* sPrefetches = nullptr;
static nsHTMLDNSPrefetch::nsListener* sDNSListener = nullptr;
bool sEsniEnabled;
nsresult nsHTMLDNSPrefetch::Initialize() {
@@ -94,32 +94,32 @@ nsresult nsHTMLDNSPrefetch::Shutdown() {
return NS_OK;
}
bool nsHTMLDNSPrefetch::IsAllowed(Document *aDocument) {
bool nsHTMLDNSPrefetch::IsAllowed(Document* aDocument) {
// There is no need to do prefetch on non UI scenarios such as XMLHttpRequest.
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
}
nsresult nsHTMLDNSPrefetch::Prefetch(Link *aElement, uint16_t flags) {
nsresult nsHTMLDNSPrefetch::Prefetch(Link* aElement, uint16_t flags) {
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
return NS_ERROR_NOT_AVAILABLE;
return sPrefetches->Add(flags, aElement);
}
nsresult nsHTMLDNSPrefetch::PrefetchLow(Link *aElement) {
nsresult nsHTMLDNSPrefetch::PrefetchLow(Link* aElement) {
return Prefetch(aElement, nsIDNSService::RESOLVE_PRIORITY_LOW);
}
nsresult nsHTMLDNSPrefetch::PrefetchMedium(Link *aElement) {
nsresult nsHTMLDNSPrefetch::PrefetchMedium(Link* aElement) {
return Prefetch(aElement, nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
}
nsresult nsHTMLDNSPrefetch::PrefetchHigh(Link *aElement) {
nsresult nsHTMLDNSPrefetch::PrefetchHigh(Link* aElement) {
return Prefetch(aElement, 0);
}
nsresult nsHTMLDNSPrefetch::Prefetch(const nsAString &hostname, bool isHttps,
const OriginAttributes &aOriginAttributes,
nsresult nsHTMLDNSPrefetch::Prefetch(const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes,
uint16_t flags) {
if (IsNeckoChild()) {
// We need to check IsEmpty() because net_IsValidHostName()
@@ -161,26 +161,26 @@ nsresult nsHTMLDNSPrefetch::Prefetch(const nsAString &hostname, bool isHttps,
}
nsresult nsHTMLDNSPrefetch::PrefetchLow(
const nsAString &hostname, bool isHttps,
const OriginAttributes &aOriginAttributes) {
const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes) {
return Prefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::RESOLVE_PRIORITY_LOW);
}
nsresult nsHTMLDNSPrefetch::PrefetchMedium(
const nsAString &hostname, bool isHttps,
const OriginAttributes &aOriginAttributes) {
const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes) {
return Prefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
}
nsresult nsHTMLDNSPrefetch::PrefetchHigh(
const nsAString &hostname, bool isHttps,
const OriginAttributes &aOriginAttributes) {
const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes) {
return Prefetch(hostname, isHttps, aOriginAttributes, 0);
}
nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link *aElement, uint16_t flags,
nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link* aElement, uint16_t flags,
nsresult aReason) {
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
return NS_ERROR_NOT_AVAILABLE;
@@ -188,7 +188,7 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link *aElement, uint16_t flags,
nsAutoString hostname;
aElement->GetHostname(hostname);
Element *element = aElement->GetElement();
Element* element = aElement->GetElement();
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
nsAutoString protocol;
@@ -203,8 +203,8 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link *aElement, uint16_t flags,
}
nsresult nsHTMLDNSPrefetch::CancelPrefetch(
const nsAString &hostname, bool isHttps,
const OriginAttributes &aOriginAttributes, uint16_t flags,
const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes, uint16_t flags,
nsresult aReason) {
// Forward this request to Necko Parent if we're a child process
if (IsNeckoChild()) {
@@ -241,19 +241,19 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(
return rv;
}
nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(Link *aElement,
nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(Link* aElement,
nsresult aReason) {
return CancelPrefetch(aElement, nsIDNSService::RESOLVE_PRIORITY_LOW, aReason);
}
nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(
const nsAString &hostname, bool isHttps,
const OriginAttributes &aOriginAttributes, nsresult aReason) {
const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes, nsresult aReason) {
return CancelPrefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::RESOLVE_PRIORITY_LOW, aReason);
}
void nsHTMLDNSPrefetch::LinkDestroyed(Link *aLink) {
void nsHTMLDNSPrefetch::LinkDestroyed(Link* aLink) {
MOZ_ASSERT(aLink->IsInDNSPrefetch());
if (sPrefetches) {
// Clean up all the possible links at once.
@@ -266,15 +266,15 @@ void nsHTMLDNSPrefetch::LinkDestroyed(Link *aLink) {
NS_IMPL_ISUPPORTS(nsHTMLDNSPrefetch::nsListener, nsIDNSListener)
NS_IMETHODIMP
nsHTMLDNSPrefetch::nsListener::OnLookupComplete(nsICancelable *request,
nsIDNSRecord *rec,
nsHTMLDNSPrefetch::nsListener::OnLookupComplete(nsICancelable* request,
nsIDNSRecord* rec,
nsresult status) {
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDNSPrefetch::nsListener::OnLookupByTypeComplete(nsICancelable *request,
nsIDNSByTypeRecord *res,
nsHTMLDNSPrefetch::nsListener::OnLookupByTypeComplete(nsICancelable* request,
nsIDNSByTypeRecord* res,
nsresult status) {
return NS_OK;
}
@@ -309,7 +309,7 @@ void nsHTMLDNSPrefetch::nsDeferrals::Flush() {
}
}
nsresult nsHTMLDNSPrefetch::nsDeferrals::Add(uint16_t flags, Link *aElement) {
nsresult nsHTMLDNSPrefetch::nsDeferrals::Add(uint16_t flags, Link* aElement) {
// The FIFO has no lock, so it can only be accessed on main thread
NS_ASSERTION(NS_IsMainThread(), "nsDeferrals::Add must be on main thread");
@@ -347,7 +347,7 @@ void nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue() {
nsCOMPtr<nsIURI> hrefURI(link ? link->GetURI() : nullptr);
bool isLocalResource = false;
nsresult rv = NS_OK;
Element *element = link->GetElement();
Element* element = link->GetElement();
hostName.Truncate();
bool isHttps = false;
@@ -436,9 +436,9 @@ void nsHTMLDNSPrefetch::nsDeferrals::RemoveUnboundLinks() {
// nsITimer related method
void nsHTMLDNSPrefetch::nsDeferrals::Tick(nsITimer *aTimer, void *aClosure) {
nsHTMLDNSPrefetch::nsDeferrals *self =
(nsHTMLDNSPrefetch::nsDeferrals *)aClosure;
void nsHTMLDNSPrefetch::nsDeferrals::Tick(nsITimer* aTimer, void* aClosure) {
nsHTMLDNSPrefetch::nsDeferrals* self =
(nsHTMLDNSPrefetch::nsDeferrals*)aClosure;
NS_ASSERTION(NS_IsMainThread(), "nsDeferrals::Tick must be on main thread");
NS_ASSERTION(self->mTimerArmed, "Timer is not armed");
@@ -454,8 +454,8 @@ void nsHTMLDNSPrefetch::nsDeferrals::Tick(nsITimer *aTimer, void *aClosure) {
//////////// nsIWebProgressListener methods
NS_IMETHODIMP
nsHTMLDNSPrefetch::nsDeferrals::OnStateChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
nsHTMLDNSPrefetch::nsDeferrals::OnStateChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
uint32_t progressStateFlags,
nsresult aStatus) {
// The FIFO has no lock, so it can only be accessed on main thread
@@ -477,8 +477,8 @@ nsHTMLDNSPrefetch::nsDeferrals::OnStateChange(nsIWebProgress *aWebProgress,
}
NS_IMETHODIMP
nsHTMLDNSPrefetch::nsDeferrals::OnProgressChange(nsIWebProgress *aProgress,
nsIRequest *aRequest,
nsHTMLDNSPrefetch::nsDeferrals::OnProgressChange(nsIWebProgress* aProgress,
nsIRequest* aRequest,
int32_t curSelfProgress,
int32_t maxSelfProgress,
int32_t curTotalProgress,
@@ -487,39 +487,39 @@ nsHTMLDNSPrefetch::nsDeferrals::OnProgressChange(nsIWebProgress *aProgress,
}
NS_IMETHODIMP
nsHTMLDNSPrefetch::nsDeferrals::OnLocationChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
nsIURI *location,
nsHTMLDNSPrefetch::nsDeferrals::OnLocationChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsIURI* location,
uint32_t aFlags) {
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDNSPrefetch::nsDeferrals::OnStatusChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
nsHTMLDNSPrefetch::nsDeferrals::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsresult aStatus,
const char16_t *aMessage) {
const char16_t* aMessage) {
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDNSPrefetch::nsDeferrals::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
nsHTMLDNSPrefetch::nsDeferrals::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
uint32_t aState) {
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDNSPrefetch::nsDeferrals::OnContentBlockingEvent(
nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aEvent) {
nsIWebProgress* aWebProgress, nsIRequest* aRequest, uint32_t aEvent) {
return NS_OK;
}
//////////// nsIObserver method
NS_IMETHODIMP
nsHTMLDNSPrefetch::nsDeferrals::Observe(nsISupports *subject, const char *topic,
const char16_t *data) {
nsHTMLDNSPrefetch::nsDeferrals::Observe(nsISupports* subject, const char* topic,
const char16_t* data) {
if (!strcmp(topic, "xpcom-shutdown")) Flush();
return NS_OK;

View File

@@ -34,7 +34,7 @@ class nsHTMLDNSPrefetch {
// The required aDocument parameter is the context requesting the prefetch -
// under certain circumstances (e.g. headers, or security context) associated
// with the context the prefetch will not be performed.
static bool IsAllowed(mozilla::dom::Document *aDocument);
static bool IsAllowed(mozilla::dom::Document* aDocument);
static nsresult Initialize();
static nsresult Shutdown();
@@ -47,36 +47,36 @@ class nsHTMLDNSPrefetch {
// weight, but its request is also more likely to be dropped due to a
// full queue and it may only be used from the main thread.
static nsresult PrefetchHigh(mozilla::dom::Link *aElement);
static nsresult PrefetchMedium(mozilla::dom::Link *aElement);
static nsresult PrefetchLow(mozilla::dom::Link *aElement);
static nsresult PrefetchHigh(mozilla::dom::Link* aElement);
static nsresult PrefetchMedium(mozilla::dom::Link* aElement);
static nsresult PrefetchLow(mozilla::dom::Link* aElement);
static nsresult PrefetchHigh(
const nsAString &host, bool isHttps,
const mozilla::OriginAttributes &aOriginAttributes);
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes);
static nsresult PrefetchMedium(
const nsAString &host, bool isHttps,
const mozilla::OriginAttributes &aOriginAttributes);
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes);
static nsresult PrefetchLow(
const nsAString &host, bool isHttps,
const mozilla::OriginAttributes &aOriginAttributes);
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes);
static nsresult CancelPrefetchLow(
const nsAString &host, bool isHttps,
const mozilla::OriginAttributes &aOriginAttributes, nsresult aReason);
static nsresult CancelPrefetchLow(mozilla::dom::Link *aElement,
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes, nsresult aReason);
static nsresult CancelPrefetchLow(mozilla::dom::Link* aElement,
nsresult aReason);
static void LinkDestroyed(mozilla::dom::Link *aLink);
static void LinkDestroyed(mozilla::dom::Link* aLink);
private:
static nsresult Prefetch(const nsAString &host, bool isHttps,
const mozilla::OriginAttributes &aOriginAttributes,
static nsresult Prefetch(const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes,
uint16_t flags);
static nsresult Prefetch(mozilla::dom::Link *aElement, uint16_t flags);
static nsresult Prefetch(mozilla::dom::Link* aElement, uint16_t flags);
static nsresult CancelPrefetch(
const nsAString &hostname, bool isHttps,
const mozilla::OriginAttributes &aOriginAttributes, uint16_t flags,
const nsAString& hostname, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes, uint16_t flags,
nsresult aReason);
static nsresult CancelPrefetch(mozilla::dom::Link *aElement, uint16_t flags,
static nsresult CancelPrefetch(mozilla::dom::Link* aElement, uint16_t flags,
nsresult aReason);
public:
@@ -103,7 +103,7 @@ class nsHTMLDNSPrefetch {
nsDeferrals();
void Activate();
nsresult Add(uint16_t flags, mozilla::dom::Link *aElement);
nsresult Add(uint16_t flags, mozilla::dom::Link* aElement);
void RemoveUnboundLinks();
@@ -119,7 +119,7 @@ class nsHTMLDNSPrefetch {
nsCOMPtr<nsITimer> mTimer;
bool mTimerArmed;
static void Tick(nsITimer *aTimer, void *aClosure);
static void Tick(nsITimer* aTimer, void* aClosure);
static const int sMaxDeferred = 512; // keep power of 2 for masking
static const int sMaxDeferredMask = (sMaxDeferred - 1);
@@ -127,7 +127,7 @@ class nsHTMLDNSPrefetch {
struct deferred_entry {
uint16_t mFlags;
// Link implementation clears this raw pointer in its destructor.
mozilla::dom::Link *mElement;
mozilla::dom::Link* mElement;
} mEntries[sMaxDeferred];
};

View File

@@ -61,7 +61,7 @@ class nsIHTMLDocument : public nsISupports {
* @param aChange +1 if the contentEditable attribute/property was changed to
* true, -1 if it was changed to false
*/
virtual nsresult ChangeContentEditableCount(nsIContent *aElement,
virtual nsresult ChangeContentEditableCount(nsIContent* aElement,
int32_t aChange) = 0;
enum EditingState {

View File

@@ -18,7 +18,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(RemoteWebProgress)
NS_INTERFACE_MAP_ENTRY(nsIRemoteWebProgress)
NS_INTERFACE_MAP_END
NS_IMETHODIMP RemoteWebProgress::Init(nsIWebProgress *aManager,
NS_IMETHODIMP RemoteWebProgress::Init(nsIWebProgress* aManager,
bool aIsTopLevel) {
mManager = aManager;
mIsTopLevel = aIsTopLevel;
@@ -39,7 +39,7 @@ NS_IMETHODIMP RemoteWebProgress::Update(uint64_t aOuterDOMWindowID,
}
NS_IMETHODIMP RemoteWebProgress::AddProgressListener(
nsIWebProgressListener *aListener, uint32_t aNotifyMask) {
nsIWebProgressListener* aListener, uint32_t aNotifyMask) {
if (mManager) {
return mManager->AddProgressListener(aListener, aNotifyMask);
} else {
@@ -50,7 +50,7 @@ NS_IMETHODIMP RemoteWebProgress::AddProgressListener(
}
NS_IMETHODIMP RemoteWebProgress::RemoveProgressListener(
nsIWebProgressListener *aListener) {
nsIWebProgressListener* aListener) {
if (mManager) {
return mManager->RemoveProgressListener(aListener);
} else {
@@ -60,45 +60,45 @@ NS_IMETHODIMP RemoteWebProgress::RemoveProgressListener(
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgress::GetDOMWindow(mozIDOMWindowProxy **aDOMWindow) {
NS_IMETHODIMP RemoteWebProgress::GetDOMWindow(mozIDOMWindowProxy** aDOMWindow) {
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP RemoteWebProgress::GetDOMWindowID(uint64_t *aDOMWindowID) {
NS_IMETHODIMP RemoteWebProgress::GetDOMWindowID(uint64_t* aDOMWindowID) {
*aDOMWindowID = mOuterDOMWindowID;
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgress::GetInnerDOMWindowID(
uint64_t *aInnerDOMWindowID) {
uint64_t* aInnerDOMWindowID) {
*aInnerDOMWindowID = mInnerDOMWindowID;
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgress::GetIsTopLevel(bool *aIsTopLevel) {
NS_IMETHODIMP RemoteWebProgress::GetIsTopLevel(bool* aIsTopLevel) {
NS_ENSURE_ARG_POINTER(aIsTopLevel);
*aIsTopLevel = mIsTopLevel;
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgress::GetIsLoadingDocument(
bool *aIsLoadingDocument) {
bool* aIsLoadingDocument) {
NS_ENSURE_ARG_POINTER(aIsLoadingDocument);
*aIsLoadingDocument = mIsLoadingDocument;
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgress::GetLoadType(uint32_t *aLoadType) {
NS_IMETHODIMP RemoteWebProgress::GetLoadType(uint32_t* aLoadType) {
NS_ENSURE_ARG_POINTER(aLoadType);
*aLoadType = mLoadType;
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgress::GetTarget(nsIEventTarget **aTarget) {
NS_IMETHODIMP RemoteWebProgress::GetTarget(nsIEventTarget** aTarget) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgress::SetTarget(nsIEventTarget *aTarget) {
NS_IMETHODIMP RemoteWebProgress::SetTarget(nsIEventTarget* aTarget) {
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -26,7 +26,7 @@ class RemoteWebProgress final : public nsIRemoteWebProgress {
mIsLoadingDocument(false),
mIsTopLevel(false) {}
RemoteWebProgress(nsIWebProgress *aManager, uint64_t aOuterDOMWindowID,
RemoteWebProgress(nsIWebProgress* aManager, uint64_t aOuterDOMWindowID,
uint64_t aInnerDOMWindowID, uint32_t aLoadType,
bool aIsLoadingDocument, bool aIsTopLevel)
: mManager(aManager),

View File

@@ -10,8 +10,8 @@ namespace dom {
NS_IMPL_ISUPPORTS(RemoteWebProgressRequest, nsIRequest, nsIChannel,
nsIClassifiedChannel, nsIRemoteWebProgressRequest)
NS_IMETHODIMP RemoteWebProgressRequest::Init(nsIURI *aURI, nsIURI *aOriginalURI,
const nsACString &aMatchedList) {
NS_IMETHODIMP RemoteWebProgressRequest::Init(nsIURI* aURI, nsIURI* aOriginalURI,
const nsACString& aMatchedList) {
mURI = aURI;
mOriginalURI = aOriginalURI;
mMatchedList = aMatchedList;
@@ -21,67 +21,67 @@ NS_IMETHODIMP RemoteWebProgressRequest::Init(nsIURI *aURI, nsIURI *aOriginalURI,
// nsIChannel methods
NS_IMETHODIMP RemoteWebProgressRequest::GetOriginalURI(nsIURI **aOriginalURI) {
NS_IMETHODIMP RemoteWebProgressRequest::GetOriginalURI(nsIURI** aOriginalURI) {
NS_ENSURE_ARG_POINTER(aOriginalURI);
NS_ADDREF(*aOriginalURI = mOriginalURI);
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgressRequest::SetOriginalURI(nsIURI *aOriginalURI) {
NS_IMETHODIMP RemoteWebProgressRequest::SetOriginalURI(nsIURI* aOriginalURI) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetURI(nsIURI **aURI) {
NS_IMETHODIMP RemoteWebProgressRequest::GetURI(nsIURI** aURI) {
NS_ENSURE_ARG_POINTER(aURI);
NS_ADDREF(*aURI = mURI);
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetOwner(nsISupports **aOwner) {
NS_IMETHODIMP RemoteWebProgressRequest::GetOwner(nsISupports** aOwner) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::SetOwner(nsISupports *aOwner) {
NS_IMETHODIMP RemoteWebProgressRequest::SetOwner(nsISupports* aOwner) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetNotificationCallbacks(
nsIInterfaceRequestor **aNotificationCallbacks) {
nsIInterfaceRequestor** aNotificationCallbacks) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::SetNotificationCallbacks(
nsIInterfaceRequestor *aNotificationCallbacks) {
nsIInterfaceRequestor* aNotificationCallbacks) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetSecurityInfo(
nsISupports **aSecurityInfo) {
nsISupports** aSecurityInfo) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetContentType(
nsACString &aContentType) {
nsACString& aContentType) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::SetContentType(
const nsACString &aContentType) {
const nsACString& aContentType) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetContentCharset(
nsACString &aContentCharset) {
nsACString& aContentCharset) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::SetContentCharset(
const nsACString &aContentCharset) {
const nsACString& aContentCharset) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetContentLength(
int64_t *aContentLength) {
int64_t* aContentLength) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -90,17 +90,17 @@ NS_IMETHODIMP RemoteWebProgressRequest::SetContentLength(
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::Open(nsIInputStream **_retval) {
NS_IMETHODIMP RemoteWebProgressRequest::Open(nsIInputStream** _retval) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::AsyncOpen(
nsIStreamListener *aListener) {
nsIStreamListener* aListener) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetContentDisposition(
uint32_t *aContentDisposition) {
uint32_t* aContentDisposition) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -110,53 +110,53 @@ NS_IMETHODIMP RemoteWebProgressRequest::SetContentDisposition(
}
NS_IMETHODIMP RemoteWebProgressRequest::GetContentDispositionFilename(
nsAString &aContentDispositionFilename) {
nsAString& aContentDispositionFilename) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::SetContentDispositionFilename(
const nsAString &aContentDispositionFilename) {
const nsAString& aContentDispositionFilename) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetContentDispositionHeader(
nsACString &aContentDispositionHeader) {
nsACString& aContentDispositionHeader) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetLoadInfo(nsILoadInfo **aLoadInfo) {
NS_IMETHODIMP RemoteWebProgressRequest::GetLoadInfo(nsILoadInfo** aLoadInfo) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::SetLoadInfo(nsILoadInfo *aLoadInfo) {
NS_IMETHODIMP RemoteWebProgressRequest::SetLoadInfo(nsILoadInfo* aLoadInfo) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetIsDocument(bool *aIsDocument) {
NS_IMETHODIMP RemoteWebProgressRequest::GetIsDocument(bool* aIsDocument) {
return NS_ERROR_NOT_IMPLEMENTED;
}
// nsIClassifiedChannel methods
NS_IMETHODIMP RemoteWebProgressRequest::SetMatchedInfo(
const nsACString &aList, const nsACString &aProvider,
const nsACString &aFullHash) {
const nsACString& aList, const nsACString& aProvider,
const nsACString& aFullHash) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetMatchedList(
nsACString &aMatchedList) {
nsACString& aMatchedList) {
aMatchedList = mMatchedList;
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetMatchedProvider(
nsACString &aMatchedProvider) {
nsACString& aMatchedProvider) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetMatchedFullHash(
nsACString &aMatchedFullHash) {
nsACString& aMatchedFullHash) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -176,15 +176,15 @@ NS_IMETHODIMP RemoteWebProgressRequest::GetMatchedTrackingFullHashes(
}
// nsIRequest methods
NS_IMETHODIMP RemoteWebProgressRequest::GetName(nsACString &aName) {
NS_IMETHODIMP RemoteWebProgressRequest::GetName(nsACString& aName) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::IsPending(bool *_retval) {
NS_IMETHODIMP RemoteWebProgressRequest::IsPending(bool* _retval) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetStatus(nsresult *aStatus) {
NS_IMETHODIMP RemoteWebProgressRequest::GetStatus(nsresult* aStatus) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -201,15 +201,15 @@ NS_IMETHODIMP RemoteWebProgressRequest::Resume(void) {
}
NS_IMETHODIMP RemoteWebProgressRequest::GetLoadGroup(
nsILoadGroup **aLoadGroup) {
nsILoadGroup** aLoadGroup) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::SetLoadGroup(nsILoadGroup *aLoadGroup) {
NS_IMETHODIMP RemoteWebProgressRequest::SetLoadGroup(nsILoadGroup* aLoadGroup) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP RemoteWebProgressRequest::GetLoadFlags(nsLoadFlags *aLoadFlags) {
NS_IMETHODIMP RemoteWebProgressRequest::GetLoadFlags(nsLoadFlags* aLoadFlags) {
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -42,7 +42,7 @@ uint32_t AudioCompactor::GetChunkSamples(uint32_t aFrames, uint32_t aChannels,
return chunkSize / sizeof(AudioDataValue);
}
uint32_t AudioCompactor::NativeCopy::operator()(AudioDataValue *aBuffer,
uint32_t AudioCompactor::NativeCopy::operator()(AudioDataValue* aBuffer,
uint32_t aSamples) {
NS_ASSERTION(aBuffer, "cannot copy to null buffer pointer");
NS_ASSERTION(aSamples, "cannot copy zero values");

View File

@@ -17,8 +17,8 @@ class MemoryFunctor : public nsDequeFunctor {
MemoryFunctor() : mSize(0) {}
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
void operator()(void *aObject) override {
const AudioData *audioData = static_cast<const AudioData *>(aObject);
void operator()(void* aObject) override {
const AudioData* audioData = static_cast<const AudioData*>(aObject);
mSize += audioData->SizeOfIncludingThis(MallocSizeOf);
}
@@ -27,14 +27,14 @@ class MemoryFunctor : public nsDequeFunctor {
class TestCopy {
public:
TestCopy(uint32_t aFrames, uint32_t aChannels, uint32_t &aCallCount,
uint32_t &aFrameCount)
TestCopy(uint32_t aFrames, uint32_t aChannels, uint32_t& aCallCount,
uint32_t& aFrameCount)
: mFrames(aFrames),
mChannels(aChannels),
mCallCount(aCallCount),
mFrameCount(aFrameCount) {}
uint32_t operator()(AudioDataValue *aBuffer, uint32_t aSamples) {
uint32_t operator()(AudioDataValue* aBuffer, uint32_t aSamples) {
mCallCount += 1;
uint32_t frames = std::min(mFrames - mFrameCount, aSamples / mChannels);
mFrameCount += frames;
@@ -44,8 +44,8 @@ class TestCopy {
private:
const uint32_t mFrames;
const uint32_t mChannels;
uint32_t &mCallCount;
uint32_t &mFrameCount;
uint32_t& mCallCount;
uint32_t& mFrameCount;
};
static void TestAudioCompactor(size_t aBytes) {

View File

@@ -20,9 +20,9 @@ enum RDFTransformType {
extern "C" {
typedef RDFTContext *(*AvRdftInitFn)(int nbits, enum RDFTransformType trans);
typedef void (*AvRdftCalcFn)(RDFTContext *s, FFTSample *data);
typedef void (*AvRdftEndFn)(RDFTContext *s);
typedef RDFTContext* (*AvRdftInitFn)(int nbits, enum RDFTransformType trans);
typedef void (*AvRdftCalcFn)(RDFTContext* s, FFTSample* data);
typedef void (*AvRdftEndFn)(RDFTContext* s);
}
struct FFmpegRDFTFuncs {

View File

@@ -58,29 +58,29 @@ HRESULT MFShutdown();
// All functions below are wrappers around the corresponding WMF function,
// and automatically locate and call the corresponding function in the WMF DLLs.
HRESULT MFCreateMediaType(IMFMediaType **aOutMFType);
HRESULT MFCreateMediaType(IMFMediaType** aOutMFType);
HRESULT MFGetStrideForBitmapInfoHeader(DWORD aFormat, DWORD aWidth,
LONG *aOutStride);
LONG* aOutStride);
HRESULT MFGetService(IUnknown *punkObject, REFGUID guidService, REFIID riid,
LPVOID *ppvObject);
HRESULT MFGetService(IUnknown* punkObject, REFGUID guidService, REFIID riid,
LPVOID* ppvObject);
HRESULT DXVA2CreateDirect3DDeviceManager9(
UINT *pResetToken, IDirect3DDeviceManager9 **ppDXVAManager);
UINT* pResetToken, IDirect3DDeviceManager9** ppDXVAManager);
HRESULT MFCreateDXGIDeviceManager(UINT *pResetToken,
IMFDXGIDeviceManager **ppDXVAManager);
HRESULT MFCreateDXGIDeviceManager(UINT* pResetToken,
IMFDXGIDeviceManager** ppDXVAManager);
HRESULT MFCreateSample(IMFSample **ppIMFSample);
HRESULT MFCreateSample(IMFSample** ppIMFSample);
HRESULT MFCreateAlignedMemoryBuffer(DWORD cbMaxLength, DWORD fAlignmentFlags,
IMFMediaBuffer **ppBuffer);
IMFMediaBuffer** ppBuffer);
HRESULT MFCreateDXGISurfaceBuffer(REFIID riid, IUnknown *punkSurface,
HRESULT MFCreateDXGISurfaceBuffer(REFIID riid, IUnknown* punkSurface,
UINT uSubresourceIndex,
BOOL fButtomUpWhenLinear,
IMFMediaBuffer **ppBuffer);
IMFMediaBuffer** ppBuffer);
} // end namespace wmf
} // end namespace mozilla

View File

@@ -39,7 +39,7 @@ OpenSLESProvider::~OpenSLESProvider() {
}
/* static */
OpenSLESProvider &OpenSLESProvider::getInstance() {
OpenSLESProvider& OpenSLESProvider::getInstance() {
// This doesn't need a Mutex in C++11 or GCC 4.3+, see N2660 and
// https://gcc.gnu.org/projects/cxx0x.html
static OpenSLESProvider instance;
@@ -47,15 +47,15 @@ OpenSLESProvider &OpenSLESProvider::getInstance() {
}
/* static */
SLresult OpenSLESProvider::Get(SLObjectItf *aObjectm, SLuint32 aOptionCount,
const SLEngineOption *aOptions) {
OpenSLESProvider &provider = OpenSLESProvider::getInstance();
SLresult OpenSLESProvider::Get(SLObjectItf* aObjectm, SLuint32 aOptionCount,
const SLEngineOption* aOptions) {
OpenSLESProvider& provider = OpenSLESProvider::getInstance();
return provider.GetEngine(aObjectm, aOptionCount, aOptions);
}
SLresult OpenSLESProvider::GetEngine(SLObjectItf *aObjectm,
SLresult OpenSLESProvider::GetEngine(SLObjectItf* aObjectm,
SLuint32 aOptionCount,
const SLEngineOption *aOptions) {
const SLEngineOption* aOptions) {
MutexAutoLock lock(mLock);
LOG(("Getting OpenSLES engine"));
// Bug 1042051: Validate options are the same
@@ -78,9 +78,9 @@ SLresult OpenSLESProvider::GetEngine(SLObjectItf *aObjectm,
}
}
SLresult OpenSLESProvider::ConstructEngine(SLObjectItf *aObjectm,
SLresult OpenSLESProvider::ConstructEngine(SLObjectItf* aObjectm,
SLuint32 aOptionCount,
const SLEngineOption *aOptions) {
const SLEngineOption* aOptions) {
mLock.AssertCurrentThreadOwns();
if (!mOpenSLESLib) {
@@ -91,9 +91,9 @@ SLresult OpenSLESProvider::ConstructEngine(SLObjectItf *aObjectm,
}
}
typedef SLresult (*slCreateEngine_t)(
SLObjectItf *, SLuint32, const SLEngineOption *, SLuint32,
const SLInterfaceID *, const SLboolean *);
typedef SLresult (*slCreateEngine_t)(SLObjectItf*, SLuint32,
const SLEngineOption*, SLuint32,
const SLInterfaceID*, const SLboolean*);
slCreateEngine_t f_slCreateEngine =
(slCreateEngine_t)dlsym(mOpenSLESLib, "slCreateEngine");
@@ -103,12 +103,12 @@ SLresult OpenSLESProvider::ConstructEngine(SLObjectItf *aObjectm,
}
/* static */
void OpenSLESProvider::Destroy(SLObjectItf *aObjectm) {
OpenSLESProvider &provider = OpenSLESProvider::getInstance();
void OpenSLESProvider::Destroy(SLObjectItf* aObjectm) {
OpenSLESProvider& provider = OpenSLESProvider::getInstance();
provider.DestroyEngine(aObjectm);
}
void OpenSLESProvider::DestroyEngine(SLObjectItf *aObjectm) {
void OpenSLESProvider::DestroyEngine(SLObjectItf* aObjectm) {
MutexAutoLock lock(mLock);
NS_ASSERTION(mOpenSLESLib, "OpenSLES destroy called but library is not open");
@@ -130,7 +130,7 @@ void OpenSLESProvider::DestroyEngine(SLObjectItf *aObjectm) {
/* static */
SLresult OpenSLESProvider::Realize(SLObjectItf aObjectm) {
OpenSLESProvider &provider = OpenSLESProvider::getInstance();
OpenSLESProvider& provider = OpenSLESProvider::getInstance();
return provider.RealizeEngine(aObjectm);
}
@@ -159,12 +159,12 @@ SLresult OpenSLESProvider::RealizeEngine(SLObjectItf aObjectm) {
} // namespace mozilla
extern "C" {
SLresult mozilla_get_sles_engine(SLObjectItf *aObjectm, SLuint32 aOptionCount,
const SLEngineOption *aOptions) {
SLresult mozilla_get_sles_engine(SLObjectItf* aObjectm, SLuint32 aOptionCount,
const SLEngineOption* aOptions) {
return mozilla::OpenSLESProvider::Get(aObjectm, aOptionCount, aOptions);
}
void mozilla_destroy_sles_engine(SLObjectItf *aObjectm) {
void mozilla_destroy_sles_engine(SLObjectItf* aObjectm) {
mozilla::OpenSLESProvider::Destroy(aObjectm);
}

View File

@@ -13,9 +13,9 @@
extern "C" {
#endif
extern MOZ_EXPORT SLresult
mozilla_get_sles_engine(SLObjectItf *aObjectm, SLuint32 aOptionCount,
const SLEngineOption *aOptions);
extern MOZ_EXPORT void mozilla_destroy_sles_engine(SLObjectItf *aObjectm);
mozilla_get_sles_engine(SLObjectItf* aObjectm, SLuint32 aOptionCount,
const SLEngineOption* aOptions);
extern MOZ_EXPORT void mozilla_destroy_sles_engine(SLObjectItf* aObjectm);
/* Realize is always in synchronous mode. */
extern MOZ_EXPORT SLresult mozilla_realize_sles_engine(SLObjectItf aObjectm);
#ifdef __cplusplus
@@ -31,30 +31,30 @@ namespace mozilla {
class OpenSLESProvider {
public:
static SLresult Get(SLObjectItf *aObjectm, SLuint32 aOptionCount,
const SLEngineOption *aOptions);
static void Destroy(SLObjectItf *aObjectm);
static SLresult Get(SLObjectItf* aObjectm, SLuint32 aOptionCount,
const SLEngineOption* aOptions);
static void Destroy(SLObjectItf* aObjectm);
static SLresult Realize(SLObjectItf aObjectm);
private:
OpenSLESProvider();
~OpenSLESProvider();
OpenSLESProvider(OpenSLESProvider const &); // NO IMPLEMENTATION
void operator=(OpenSLESProvider const &); // NO IMPLEMENTATION
static OpenSLESProvider &getInstance();
SLresult GetEngine(SLObjectItf *aObjectm, SLuint32 aOptionCount,
const SLEngineOption *aOptions);
SLresult ConstructEngine(SLObjectItf *aObjectm, SLuint32 aOptionCount,
const SLEngineOption *aOptions);
OpenSLESProvider(OpenSLESProvider const&); // NO IMPLEMENTATION
void operator=(OpenSLESProvider const&); // NO IMPLEMENTATION
static OpenSLESProvider& getInstance();
SLresult GetEngine(SLObjectItf* aObjectm, SLuint32 aOptionCount,
const SLEngineOption* aOptions);
SLresult ConstructEngine(SLObjectItf* aObjectm, SLuint32 aOptionCount,
const SLEngineOption* aOptions);
SLresult RealizeEngine(SLObjectItf aObjectm);
void DestroyEngine(SLObjectItf *aObjectm);
void DestroyEngine(SLObjectItf* aObjectm);
// Protect all our internal variables
mozilla::Mutex mLock;
SLObjectItf mSLEngine;
int mSLEngineUsers;
bool mIsRealized;
void *mOpenSLESLib;
void* mOpenSLESLib;
};
} // namespace mozilla

View File

@@ -132,8 +132,8 @@ LRESULT CALLBACK PlatformUIThread::EventWindowProc(HWND hwnd, UINT uMsg,
return 0;
}
PlatformUIThread *twui =
static_cast<PlatformUIThread *>(GetPropW(hwnd, kThisProperty));
PlatformUIThread* twui =
static_cast<PlatformUIThread*>(GetPropW(hwnd, kThisProperty));
if (!twui) {
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}

View File

@@ -35,7 +35,7 @@
namespace WebCore {
void ZeroPole::process(const float *source, float *destination,
void ZeroPole::process(const float* source, float* destination,
int framesToProcess) {
float zero = m_zero;
float pole = m_pole;

View File

@@ -37,7 +37,7 @@ class ZeroPole {
public:
ZeroPole() : m_zero(0), m_pole(0), m_lastX(0), m_lastY(0) {}
void process(const float *source, float *destination, int framesToProcess);
void process(const float* source, float* destination, int framesToProcess);
// Reset filter state.
void reset() {

View File

@@ -85,7 +85,7 @@ typedef struct NPClass NPClass;
typedef char NPUTF8;
typedef struct _NPString {
const NPUTF8 *UTF8Characters;
const NPUTF8* UTF8Characters;
uint32_t UTF8Length;
} NPString;
@@ -106,7 +106,7 @@ typedef struct _NPVariant {
int32_t intValue;
double doubleValue;
NPString stringValue;
NPObject *objectValue;
NPObject* objectValue;
} value;
} NPVariant;
@@ -120,7 +120,7 @@ typedef struct _NPVariant {
After calling NPN_ReleaseVariantValue, the type of the variant
will be NPVariantType_Void.
*/
void NPN_ReleaseVariantValue(NPVariant *variant);
void NPN_ReleaseVariantValue(NPVariant* variant);
#define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void)
#define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null)
@@ -200,7 +200,7 @@ void NPN_ReleaseVariantValue(NPVariant *variant);
NPVariantType_Object Object
*/
typedef void *NPIdentifier;
typedef void* NPIdentifier;
/*
NPObjects have methods and properties. Methods and properties are
@@ -213,16 +213,16 @@ typedef void *NPIdentifier;
by the browser. Plugins do not need to worry about memory management
with regards to NPIdentifiers.
*/
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
NPIdentifier *identifiers);
NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name);
void NPN_GetStringIdentifiers(const NPUTF8** names, int32_t nameCount,
NPIdentifier* identifiers);
NPIdentifier NPN_GetIntIdentifier(int32_t intid);
bool NPN_IdentifierIsString(NPIdentifier identifier);
/*
The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed.
*/
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier);
NPUTF8* NPN_UTF8FromIdentifier(NPIdentifier identifier);
/*
Get the integer represented by identifier. If identifier is not an
@@ -237,27 +237,27 @@ int32_t NPN_IntFromIdentifier(NPIdentifier identifier);
The NPVariant *result argument of these functions (where
applicable) should be released using NPN_ReleaseVariantValue().
*/
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj);
typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj);
typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name,
const NPVariant *args, uint32_t argCount,
NPVariant *result);
typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj,
const NPVariant *args,
typedef NPObject* (*NPAllocateFunctionPtr)(NPP npp, NPClass* aClass);
typedef void (*NPDeallocateFunctionPtr)(NPObject* npobj);
typedef void (*NPInvalidateFunctionPtr)(NPObject* npobj);
typedef bool (*NPHasMethodFunctionPtr)(NPObject* npobj, NPIdentifier name);
typedef bool (*NPInvokeFunctionPtr)(NPObject* npobj, NPIdentifier name,
const NPVariant* args, uint32_t argCount,
NPVariant* result);
typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject* npobj,
const NPVariant* args,
uint32_t argCount,
NPVariant *result);
typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
NPVariant *result);
typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
const NPVariant *value);
typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value,
uint32_t *count);
typedef bool (*NPConstructFunctionPtr)(NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
NPVariant* result);
typedef bool (*NPHasPropertyFunctionPtr)(NPObject* npobj, NPIdentifier name);
typedef bool (*NPGetPropertyFunctionPtr)(NPObject* npobj, NPIdentifier name,
NPVariant* result);
typedef bool (*NPSetPropertyFunctionPtr)(NPObject* npobj, NPIdentifier name,
const NPVariant* value);
typedef bool (*NPRemovePropertyFunctionPtr)(NPObject* npobj, NPIdentifier name);
typedef bool (*NPEnumerationFunctionPtr)(NPObject* npobj, NPIdentifier** value,
uint32_t* count);
typedef bool (*NPConstructFunctionPtr)(NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant* result);
/*
NPObjects returned by create, retain, invoke, and getProperty pass
@@ -310,7 +310,7 @@ struct NPClass {
((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR)
struct NPObject {
NPClass *_class;
NPClass* _class;
uint32_t referenceCount;
/*
* Additional space may be allocated here by types of NPObjects
@@ -323,19 +323,19 @@ struct NPObject {
returned. This method will initialize the referenceCount member of
the NPObject to 1.
*/
NPObject *NPN_CreateObject(NPP npp, NPClass *aClass);
NPObject* NPN_CreateObject(NPP npp, NPClass* aClass);
/*
Increment the NPObject's reference count.
*/
NPObject *NPN_RetainObject(NPObject *npobj);
NPObject* NPN_RetainObject(NPObject* npobj);
/*
Decremented the NPObject's reference count. If the reference
count goes to zero, the class's destroy function is invoke if
specified, otherwise the object is freed directly.
*/
void NPN_ReleaseObject(NPObject *npobj);
void NPN_ReleaseObject(NPObject* npobj);
/*
Functions to access script objects represented by NPObject.
@@ -349,23 +349,23 @@ void NPN_ReleaseObject(NPObject *npobj);
on which the plugin was initialized.
*/
bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
const NPVariant *args, uint32_t argCount, NPVariant *result);
bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script,
NPVariant *result);
bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
NPVariant *result);
bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
const NPVariant *value);
bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
uint32_t *count);
bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
bool NPN_Invoke(NPP npp, NPObject* npobj, NPIdentifier methodName,
const NPVariant* args, uint32_t argCount, NPVariant* result);
bool NPN_InvokeDefault(NPP npp, NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant* result);
bool NPN_Evaluate(NPP npp, NPObject* npobj, NPString* script,
NPVariant* result);
bool NPN_GetProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName,
NPVariant* result);
bool NPN_SetProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName,
const NPVariant* value);
bool NPN_RemoveProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName);
bool NPN_HasProperty(NPP npp, NPObject* npobj, NPIdentifier propertyName);
bool NPN_HasMethod(NPP npp, NPObject* npobj, NPIdentifier methodName);
bool NPN_Enumerate(NPP npp, NPObject* npobj, NPIdentifier** identifier,
uint32_t* count);
bool NPN_Construct(NPP npp, NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant* result);
/*
NPN_SetException may be called to trigger a script exception upon
@@ -373,7 +373,7 @@ bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args,
NPN_SetException (npobj, message);
*/
void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
void NPN_SetException(NPObject* npobj, const NPUTF8* message);
#ifdef __cplusplus
}

File diff suppressed because it is too large Load Diff

View File

@@ -20,44 +20,44 @@ class nsJSNPRuntime {
class nsJSObjWrapperKey {
public:
nsJSObjWrapperKey(JSObject *obj, NPP npp) : mJSObj(obj), mNpp(npp) {}
nsJSObjWrapperKey(JSObject* obj, NPP npp) : mJSObj(obj), mNpp(npp) {}
bool operator==(const nsJSObjWrapperKey &other) const {
bool operator==(const nsJSObjWrapperKey& other) const {
return mJSObj == other.mJSObj && mNpp == other.mNpp;
}
bool operator!=(const nsJSObjWrapperKey &other) const {
bool operator!=(const nsJSObjWrapperKey& other) const {
return !(*this == other);
}
void trace(JSTracer *trc) {
void trace(JSTracer* trc) {
JS::TraceEdge(trc, &mJSObj, "nsJSObjWrapperKey");
}
nsJSObjWrapperKey(const nsJSObjWrapperKey &other)
nsJSObjWrapperKey(const nsJSObjWrapperKey& other)
: mJSObj(other.mJSObj), mNpp(other.mNpp) {}
void operator=(const nsJSObjWrapperKey &other) {
void operator=(const nsJSObjWrapperKey& other) {
mJSObj = other.mJSObj;
mNpp = other.mNpp;
}
JS::Heap<JSObject *> mJSObj;
JS::Heap<JSObject*> mJSObj;
NPP mNpp;
};
class nsJSObjWrapper : public NPObject {
public:
JS::Heap<JSObject *> mJSObj;
JS::Heap<JSObject*> mJSObj;
// Because mJSObj might be a cross-compartment wrapper, we can't use it to
// enter the target realm. We use this global instead (it's always
// same-compartment with mJSObj).
JS::Heap<JSObject *> mJSObjGlobal;
JS::Heap<JSObject*> mJSObjGlobal;
const NPP mNpp;
bool mDestroyPending;
static NPObject *GetNewOrUsed(NPP npp, JS::Handle<JSObject *> obj,
JS::Handle<JSObject *> objGlobal);
static NPObject* GetNewOrUsed(NPP npp, JS::Handle<JSObject*> obj,
JS::Handle<JSObject*> objGlobal);
void trace(JSTracer *trc) {
void trace(JSTracer* trc) {
JS::TraceEdge(trc, &mJSObj, "nsJSObjWrapper::mJSObj");
JS::TraceEdge(trc, &mJSObjGlobal, "nsJSObjWrapper::mJSObjGlobal");
}
@@ -66,25 +66,25 @@ class nsJSObjWrapper : public NPObject {
explicit nsJSObjWrapper(NPP npp);
~nsJSObjWrapper();
static NPObject *NP_Allocate(NPP npp, NPClass *aClass);
static void NP_Deallocate(NPObject *obj);
static void NP_Invalidate(NPObject *obj);
static bool NP_HasMethod(NPObject *, NPIdentifier identifier);
static bool NP_Invoke(NPObject *obj, NPIdentifier method,
const NPVariant *args, uint32_t argCount,
NPVariant *result);
static bool NP_InvokeDefault(NPObject *obj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
static bool NP_HasProperty(NPObject *obj, NPIdentifier property);
static bool NP_GetProperty(NPObject *obj, NPIdentifier property,
NPVariant *result);
static bool NP_SetProperty(NPObject *obj, NPIdentifier property,
const NPVariant *value);
static bool NP_RemoveProperty(NPObject *obj, NPIdentifier property);
static bool NP_Enumerate(NPObject *npobj, NPIdentifier **identifier,
uint32_t *count);
static bool NP_Construct(NPObject *obj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
static NPObject* NP_Allocate(NPP npp, NPClass* aClass);
static void NP_Deallocate(NPObject* obj);
static void NP_Invalidate(NPObject* obj);
static bool NP_HasMethod(NPObject*, NPIdentifier identifier);
static bool NP_Invoke(NPObject* obj, NPIdentifier method,
const NPVariant* args, uint32_t argCount,
NPVariant* result);
static bool NP_InvokeDefault(NPObject* obj, const NPVariant* args,
uint32_t argCount, NPVariant* result);
static bool NP_HasProperty(NPObject* obj, NPIdentifier property);
static bool NP_GetProperty(NPObject* obj, NPIdentifier property,
NPVariant* result);
static bool NP_SetProperty(NPObject* obj, NPIdentifier property,
const NPVariant* value);
static bool NP_RemoveProperty(NPObject* obj, NPIdentifier property);
static bool NP_Enumerate(NPObject* npobj, NPIdentifier** identifier,
uint32_t* count);
static bool NP_Construct(NPObject* obj, const NPVariant* args,
uint32_t argCount, NPVariant* result);
public:
static NPClass sJSObjWrapperNPClass;
@@ -92,12 +92,12 @@ class nsJSObjWrapper : public NPObject {
class nsNPObjWrapper {
public:
static bool IsWrapper(JSObject *obj);
static void OnDestroy(NPObject *npobj);
static JSObject *GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj);
static bool IsWrapper(JSObject* obj);
static void OnDestroy(NPObject* npobj);
static JSObject* GetNewOrUsed(NPP npp, JSContext* cx, NPObject* npobj);
};
bool JSValToNPVariant(NPP npp, JSContext *cx, const JS::Value &val,
NPVariant *variant);
bool JSValToNPVariant(NPP npp, JSContext* cx, const JS::Value& val,
NPVariant* variant);
#endif // nsJSNPRuntime_h_

File diff suppressed because it is too large Load Diff

View File

@@ -27,13 +27,13 @@ class nsNPAPIPlugin final {
// Constructs and initializes an nsNPAPIPlugin object. A nullptr file path
// will prevent this from calling NP_Initialize.
static nsresult CreatePlugin(nsPluginTag *aPluginTag,
nsNPAPIPlugin **aResult);
static nsresult CreatePlugin(nsPluginTag* aPluginTag,
nsNPAPIPlugin** aResult);
PluginLibrary *GetLibrary();
PluginLibrary* GetLibrary();
// PluginFuncs() can't fail but results are only valid if GetLibrary()
// succeeds
NPPluginFuncs *PluginFuncs();
NPPluginFuncs* PluginFuncs();
#if defined(XP_MACOSX) && !defined(__LP64__)
void SetPluginRefNum(short aRefNum);
@@ -43,18 +43,18 @@ class nsNPAPIPlugin final {
// crashes and is no longer usable. pluginDumpID/browserDumpID are
// the IDs of respective minidumps that were written, or empty if no
// minidump was written.
void PluginCrashed(const nsAString &pluginDumpID,
const nsAString &browserDumpID);
void PluginCrashed(const nsAString& pluginDumpID,
const nsAString& browserDumpID);
nsresult Shutdown();
static nsresult RetainStream(NPStream *pstream, nsISupports **aRetainedPeer);
static nsresult RetainStream(NPStream* pstream, nsISupports** aRetainedPeer);
private:
~nsNPAPIPlugin();
NPPluginFuncs mPluginFuncs;
PluginLibrary *mLibrary;
PluginLibrary* mLibrary;
};
namespace mozilla {
@@ -78,11 +78,11 @@ inline bool NPIdentifierIsString(NPIdentifier id) {
return JSID_IS_STRING(NPIdentifierToJSId(id));
}
inline JSString *NPIdentifierToString(NPIdentifier id) {
inline JSString* NPIdentifierToString(NPIdentifier id) {
return JSID_TO_STRING(NPIdentifierToJSId(id));
}
inline NPIdentifier StringToNPIdentifier(JSContext *cx, JSString *str) {
inline NPIdentifier StringToNPIdentifier(JSContext* cx, JSString* str) {
return JSIdToNPIdentifier(INTERNED_STRING_TO_JSID(cx, str));
}
@@ -98,7 +98,7 @@ inline NPIdentifier IntToNPIdentifier(int i) {
return JSIdToNPIdentifier(INT_TO_JSID(i));
}
JSContext *GetJSContext(NPP npp);
JSContext* GetJSContext(NPP npp);
inline bool NPStringIdentifierIsPermanent(NPIdentifier id) {
AutoSafeJSContext cx;
@@ -107,68 +107,68 @@ inline bool NPStringIdentifierIsPermanent(NPIdentifier id) {
#define NPIdentifier_VOID (JSIdToNPIdentifier(JSID_VOID))
NPObject *_getwindowobject(NPP npp);
NPObject* _getwindowobject(NPP npp);
NPObject *_getpluginelement(NPP npp);
NPObject* _getpluginelement(NPP npp);
NPIdentifier _getstringidentifier(const NPUTF8 *name);
NPIdentifier _getstringidentifier(const NPUTF8* name);
void _getstringidentifiers(const NPUTF8 **names, int32_t nameCount,
NPIdentifier *identifiers);
void _getstringidentifiers(const NPUTF8** names, int32_t nameCount,
NPIdentifier* identifiers);
bool _identifierisstring(NPIdentifier identifiers);
NPIdentifier _getintidentifier(int32_t intid);
NPUTF8 *_utf8fromidentifier(NPIdentifier identifier);
NPUTF8* _utf8fromidentifier(NPIdentifier identifier);
int32_t _intfromidentifier(NPIdentifier identifier);
NPObject *_createobject(NPP npp, NPClass *aClass);
NPObject* _createobject(NPP npp, NPClass* aClass);
NPObject *_retainobject(NPObject *npobj);
NPObject* _retainobject(NPObject* npobj);
void _releaseobject(NPObject *npobj);
void _releaseobject(NPObject* npobj);
bool _invoke(NPP npp, NPObject *npobj, NPIdentifier method,
const NPVariant *args, uint32_t argCount, NPVariant *result);
bool _invoke(NPP npp, NPObject* npobj, NPIdentifier method,
const NPVariant* args, uint32_t argCount, NPVariant* result);
bool _invokeDefault(NPP npp, NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
bool _invokeDefault(NPP npp, NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant* result);
bool _evaluate(NPP npp, NPObject *npobj, NPString *script, NPVariant *result);
bool _evaluate(NPP npp, NPObject* npobj, NPString* script, NPVariant* result);
bool _getproperty(NPP npp, NPObject *npobj, NPIdentifier property,
NPVariant *result);
bool _getproperty(NPP npp, NPObject* npobj, NPIdentifier property,
NPVariant* result);
bool _setproperty(NPP npp, NPObject *npobj, NPIdentifier property,
const NPVariant *value);
bool _setproperty(NPP npp, NPObject* npobj, NPIdentifier property,
const NPVariant* value);
bool _removeproperty(NPP npp, NPObject *npobj, NPIdentifier property);
bool _removeproperty(NPP npp, NPObject* npobj, NPIdentifier property);
bool _hasproperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool _hasproperty(NPP npp, NPObject* npobj, NPIdentifier propertyName);
bool _hasmethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
bool _hasmethod(NPP npp, NPObject* npobj, NPIdentifier methodName);
bool _enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
uint32_t *count);
bool _enumerate(NPP npp, NPObject* npobj, NPIdentifier** identifier,
uint32_t* count);
bool _construct(NPP npp, NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
bool _construct(NPP npp, NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant* result);
void _releasevariantvalue(NPVariant *variant);
void _releasevariantvalue(NPVariant* variant);
void _setexception(NPObject *npobj, const NPUTF8 *message);
void _setexception(NPObject* npobj, const NPUTF8* message);
void _pushpopupsenabledstate(NPP npp, NPBool enabled);
void _poppopupsenabledstate(NPP npp);
NPError _getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
char **value, uint32_t *len);
NPError _getvalueforurl(NPP instance, NPNURLVariable variable, const char* url,
char** value, uint32_t* len);
NPError _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
const char *value, uint32_t len);
NPError _setvalueforurl(NPP instance, NPNURLVariable variable, const char* url,
const char* value, uint32_t len);
typedef void (*PluginTimerFunc)(NPP npp, uint32_t timerID);
@@ -177,70 +177,70 @@ uint32_t _scheduletimer(NPP instance, uint32_t interval, NPBool repeat,
void _unscheduletimer(NPP instance, uint32_t timerID);
NPError _popupcontextmenu(NPP instance, NPMenu *menu);
NPError _popupcontextmenu(NPP instance, NPMenu* menu);
NPBool _convertpoint(NPP instance, double sourceX, double sourceY,
NPCoordinateSpace sourceSpace, double *destX,
double *destY, NPCoordinateSpace destSpace);
NPCoordinateSpace sourceSpace, double* destX,
double* destY, NPCoordinateSpace destSpace);
NPError _requestread(NPStream *pstream, NPByteRange *rangeList);
NPError _requestread(NPStream* pstream, NPByteRange* rangeList);
NPError _geturlnotify(NPP npp, const char *relativeURL, const char *target,
void *notifyData);
NPError _geturlnotify(NPP npp, const char* relativeURL, const char* target,
void* notifyData);
NPError _getvalue(NPP npp, NPNVariable variable, void *r_value);
NPError _getvalue(NPP npp, NPNVariable variable, void* r_value);
NPError _setvalue(NPP npp, NPPVariable variable, void *r_value);
NPError _setvalue(NPP npp, NPPVariable variable, void* r_value);
NPError _geturl(NPP npp, const char *relativeURL, const char *target);
NPError _geturl(NPP npp, const char* relativeURL, const char* target);
NPError _posturlnotify(NPP npp, const char *relativeURL, const char *target,
uint32_t len, const char *buf, NPBool file,
void *notifyData);
NPError _posturlnotify(NPP npp, const char* relativeURL, const char* target,
uint32_t len, const char* buf, NPBool file,
void* notifyData);
NPError _posturl(NPP npp, const char *relativeURL, const char *target,
uint32_t len, const char *buf, NPBool file);
NPError _posturl(NPP npp, const char* relativeURL, const char* target,
uint32_t len, const char* buf, NPBool file);
void _status(NPP npp, const char *message);
void _status(NPP npp, const char* message);
void _memfree(void *ptr);
void _memfree(void* ptr);
uint32_t _memflush(uint32_t size);
void _reloadplugins(NPBool reloadPages);
void _invalidaterect(NPP npp, NPRect *invalidRect);
void _invalidaterect(NPP npp, NPRect* invalidRect);
void _invalidateregion(NPP npp, NPRegion invalidRegion);
void _forceredraw(NPP npp);
const char *_useragent(NPP npp);
const char* _useragent(NPP npp);
void *_memalloc(uint32_t size);
void* _memalloc(uint32_t size);
// Deprecated entry points for the old Java plugin.
void * /* OJI type: JRIEnv* */
void* /* OJI type: JRIEnv* */
_getJavaEnv();
void * /* OJI type: jref */
void* /* OJI type: jref */
_getJavaPeer(NPP npp);
void _urlredirectresponse(NPP instance, void *notifyData, NPBool allow);
void _urlredirectresponse(NPP instance, void* notifyData, NPBool allow);
NPError _initasyncsurface(NPP instance, NPSize *size, NPImageFormat format,
void *initData, NPAsyncSurface *surface);
NPError _initasyncsurface(NPP instance, NPSize* size, NPImageFormat format,
void* initData, NPAsyncSurface* surface);
NPError _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface);
NPError _finalizeasyncsurface(NPP instance, NPAsyncSurface* surface);
void _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface,
NPRect *changed);
void _setcurrentasyncsurface(NPP instance, NPAsyncSurface* surface,
NPRect* changed);
} /* namespace parent */
} /* namespace plugins */
} /* namespace mozilla */
const char *PeekException();
const char* PeekException();
void PopException();
@@ -283,7 +283,7 @@ class NPPExceptionAutoHolder {
~NPPExceptionAutoHolder();
protected:
char *mOldException;
char* mOldException;
};
#endif // nsNPAPIPlugin_h_

View File

@@ -35,8 +35,8 @@ NS_IMPL_ISUPPORTS(nsPluginDirServiceProvider, nsIDirectoryServiceProvider)
//*****************************************************************************
NS_IMETHODIMP
nsPluginDirServiceProvider::GetFile(const char *charProp, bool *persistant,
nsIFile **_retval) {
nsPluginDirServiceProvider::GetFile(const char* charProp, bool* persistant,
nsIFile** _retval) {
NS_ENSURE_ARG(charProp);
*_retval = nullptr;
@@ -46,7 +46,7 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, bool *persistant,
}
nsresult nsPluginDirServiceProvider::GetPLIDDirectories(
nsISimpleEnumerator **aEnumerator) {
nsISimpleEnumerator** aEnumerator) {
NS_ENSURE_ARG_POINTER(aEnumerator);
*aEnumerator = nullptr;
@@ -59,7 +59,7 @@ nsresult nsPluginDirServiceProvider::GetPLIDDirectories(
}
nsresult nsPluginDirServiceProvider::GetPLIDDirectoriesWithRootKey(
uint32_t aKey, nsCOMArray<nsIFile> &aDirs) {
uint32_t aKey, nsCOMArray<nsIFile>& aDirs) {
nsCOMPtr<nsIWindowsRegKey> regKey =
do_CreateInstance("@mozilla.org/windows-registry-key;1");
NS_ENSURE_TRUE(regKey, NS_ERROR_FAILURE);
@@ -105,7 +105,7 @@ nsresult nsPluginDirServiceProvider::GetPLIDDirectoriesWithRootKey(
if (NS_SUCCEEDED(localFile->Exists(&isFileThere)) && isFileThere) {
int32_t c = aDirs.Count();
for (int32_t i = 0; i < c; i++) {
nsIFile *dup = static_cast<nsIFile *>(aDirs[i]);
nsIFile* dup = static_cast<nsIFile*>(aDirs[i]);
if (dup && NS_SUCCEEDED(dup->Equals(localFile, &isDupEntry)) &&
isDupEntry) {
break;

View File

@@ -26,11 +26,11 @@ class nsPluginDirServiceProvider : public nsIDirectoryServiceProvider {
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
#ifdef XP_WIN
static nsresult GetPLIDDirectories(nsISimpleEnumerator **aEnumerator);
static nsresult GetPLIDDirectories(nsISimpleEnumerator** aEnumerator);
private:
static nsresult GetPLIDDirectoriesWithRootKey(uint32_t aKey,
nsCOMArray<nsIFile> &aDirs);
nsCOMArray<nsIFile>& aDirs);
#endif
protected:

View File

@@ -33,27 +33,27 @@ class nsPluginNativeWindow : public NPWindow {
*/
public:
nsresult GetPluginInstance(RefPtr<nsNPAPIPluginInstance> &aPluginInstance) {
nsresult GetPluginInstance(RefPtr<nsNPAPIPluginInstance>& aPluginInstance) {
aPluginInstance = mPluginInstance;
return NS_OK;
}
nsresult SetPluginInstance(nsNPAPIPluginInstance *aPluginInstance) {
nsresult SetPluginInstance(nsNPAPIPluginInstance* aPluginInstance) {
if (mPluginInstance != aPluginInstance) mPluginInstance = aPluginInstance;
return NS_OK;
}
nsresult GetPluginWidget(nsIWidget **aWidget) const {
nsresult GetPluginWidget(nsIWidget** aWidget) const {
NS_IF_ADDREF(*aWidget = mWidget);
return NS_OK;
}
nsresult SetPluginWidget(nsIWidget *aWidget) {
nsresult SetPluginWidget(nsIWidget* aWidget) {
mWidget = aWidget;
return NS_OK;
}
public:
virtual nsresult CallSetWindow(
RefPtr<nsNPAPIPluginInstance> &aPluginInstance) {
RefPtr<nsNPAPIPluginInstance>& aPluginInstance) {
// null aPluginInstance means that we want to call SetWindow(null)
if (aPluginInstance)
aPluginInstance->SetWindow(this);
@@ -69,8 +69,8 @@ class nsPluginNativeWindow : public NPWindow {
nsCOMPtr<nsIWidget> mWidget;
};
nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow **aPluginNativeWindow);
nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow** aPluginNativeWindow);
nsresult PLUG_DeletePluginNativeWindow(
nsPluginNativeWindow *aPluginNativeWindow);
nsPluginNativeWindow* aPluginNativeWindow);
#endif //_nsPluginNativeWindow_h_

View File

@@ -48,7 +48,7 @@ typedef nsTWeakRef<class nsPluginNativeWindowWin> PluginWindowWeakRef;
class PluginWindowEvent : public Runnable {
public:
PluginWindowEvent();
void Init(const PluginWindowWeakRef &ref, HWND hWnd, UINT msg, WPARAM wParam,
void Init(const PluginWindowWeakRef& ref, HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam);
void Clear();
HWND GetWnd() { return mWnd; };
@@ -78,7 +78,7 @@ void PluginWindowEvent::Clear() {
mLParam = 0;
}
void PluginWindowEvent::Init(const PluginWindowWeakRef &ref, HWND aWnd,
void PluginWindowEvent::Init(const PluginWindowWeakRef& ref, HWND aWnd,
UINT aMsg, WPARAM aWParam, LPARAM aLParam) {
NS_ASSERTION(aWnd != nullptr, "invalid plugin event value");
NS_ASSERTION(mWnd == nullptr, "event already in use");
@@ -99,7 +99,7 @@ class nsPluginNativeWindowWin : public nsPluginNativeWindow {
virtual ~nsPluginNativeWindowWin();
virtual nsresult CallSetWindow(
RefPtr<nsNPAPIPluginInstance> &aPluginInstance);
RefPtr<nsNPAPIPluginInstance>& aPluginInstance);
private:
nsresult SubclassAndAssociateWindow();
@@ -110,7 +110,7 @@ class nsPluginNativeWindowWin : public nsPluginNativeWindow {
WNDPROC GetPrevWindowProc();
void SetPrevWindowProc(WNDPROC proc) { mPluginWinProc = proc; }
WNDPROC GetWindowProc();
PluginWindowEvent *GetPluginWindowEvent(HWND aWnd, UINT aMsg, WPARAM aWParam,
PluginWindowEvent* GetPluginWindowEvent(HWND aWnd, UINT aMsg, WPARAM aWParam,
LPARAM aLParam);
private:
@@ -128,8 +128,8 @@ class nsPluginNativeWindowWin : public nsPluginNativeWindow {
static bool sInPreviousMessageDispatch = false;
static bool ProcessFlashMessageDelayed(nsPluginNativeWindowWin *aWin,
nsNPAPIPluginInstance *aInst, HWND hWnd,
static bool ProcessFlashMessageDelayed(nsPluginNativeWindowWin* aWin,
nsNPAPIPluginInstance* aInst, HWND hWnd,
UINT msg, WPARAM wParam, LPARAM lParam) {
NS_ENSURE_TRUE(aWin, false);
NS_ENSURE_TRUE(aInst, false);
@@ -158,7 +158,7 @@ static bool ProcessFlashMessageDelayed(nsPluginNativeWindowWin *aWin,
class nsDelayedPopupsEnabledEvent : public Runnable {
public:
explicit nsDelayedPopupsEnabledEvent(nsNPAPIPluginInstance *inst)
explicit nsDelayedPopupsEnabledEvent(nsNPAPIPluginInstance* inst)
: Runnable("nsDelayedPopupsEnabledEvent"), mInst(inst) {}
NS_DECL_NSIRUNNABLE
@@ -187,7 +187,7 @@ static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam,
*/
static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam) {
nsPluginNativeWindowWin *win = (nsPluginNativeWindowWin *)::GetProp(
nsPluginNativeWindowWin* win = (nsPluginNativeWindowWin*)::GetProp(
hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
if (!win) return TRUE;
@@ -344,18 +344,18 @@ static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam,
static WindowsDllInterceptor sUser32Intercept;
#ifdef _WIN64
typedef LONG_PTR(WINAPI *User32SetWindowLongPtrA)(HWND hWnd, int nIndex,
typedef LONG_PTR(WINAPI* User32SetWindowLongPtrA)(HWND hWnd, int nIndex,
LONG_PTR dwNewLong);
typedef LONG_PTR(WINAPI *User32SetWindowLongPtrW)(HWND hWnd, int nIndex,
typedef LONG_PTR(WINAPI* User32SetWindowLongPtrW)(HWND hWnd, int nIndex,
LONG_PTR dwNewLong);
static WindowsDllInterceptor::FuncHookType<User32SetWindowLongPtrA>
sUser32SetWindowLongAHookStub;
static WindowsDllInterceptor::FuncHookType<User32SetWindowLongPtrW>
sUser32SetWindowLongWHookStub;
#else
typedef LONG(WINAPI *User32SetWindowLongA)(HWND hWnd, int nIndex,
typedef LONG(WINAPI* User32SetWindowLongA)(HWND hWnd, int nIndex,
LONG dwNewLong);
typedef LONG(WINAPI *User32SetWindowLongW)(HWND hWnd, int nIndex,
typedef LONG(WINAPI* User32SetWindowLongW)(HWND hWnd, int nIndex,
LONG dwNewLong);
static WindowsDllInterceptor::FuncHookType<User32SetWindowLongA>
sUser32SetWindowLongAHookStub;
@@ -364,7 +364,7 @@ static WindowsDllInterceptor::FuncHookType<User32SetWindowLongW>
#endif
static inline bool SetWindowLongHookCheck(HWND hWnd, int nIndex,
LONG_PTR newLong) {
nsPluginNativeWindowWin *win = (nsPluginNativeWindowWin *)GetProp(
nsPluginNativeWindowWin* win = (nsPluginNativeWindowWin*)GetProp(
hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
if (!win || (win && win->mPluginType != nsPluginHost::eSpecialType_Flash) ||
(nIndex == GWLP_WNDPROC &&
@@ -386,7 +386,7 @@ LONG WINAPI SetWindowLongAHook(HWND hWnd, int nIndex, LONG newLong)
LONG_PTR proc = sUser32SetWindowLongAHookStub(hWnd, nIndex, newLong);
// We already checked this in SetWindowLongHookCheck
nsPluginNativeWindowWin *win = (nsPluginNativeWindowWin *)GetProp(
nsPluginNativeWindowWin* win = (nsPluginNativeWindowWin*)GetProp(
hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
// Hook our subclass back up, just like we do on setwindow.
@@ -409,7 +409,7 @@ LONG WINAPI SetWindowLongWHook(HWND hWnd, int nIndex, LONG newLong)
LONG_PTR proc = sUser32SetWindowLongWHookStub(hWnd, nIndex, newLong);
// We already checked this in SetWindowLongHookCheck
nsPluginNativeWindowWin *win = (nsPluginNativeWindowWin *)GetProp(
nsPluginNativeWindowWin* win = (nsPluginNativeWindowWin*)GetProp(
hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
// Hook our subclass back up, just like we do on setwindow.
@@ -469,7 +469,7 @@ WNDPROC nsPluginNativeWindowWin::GetPrevWindowProc() { return mPrevWinProc; }
WNDPROC nsPluginNativeWindowWin::GetWindowProc() { return mPluginWinProc; }
NS_IMETHODIMP PluginWindowEvent::Run() {
nsPluginNativeWindowWin *win = mPluginWindowRef.get();
nsPluginNativeWindowWin* win = mPluginWindowRef.get();
if (!win) return NS_OK;
HWND hWnd = GetWnd();
@@ -493,14 +493,14 @@ NS_IMETHODIMP PluginWindowEvent::Run() {
return NS_OK;
}
PluginWindowEvent *nsPluginNativeWindowWin::GetPluginWindowEvent(
PluginWindowEvent* nsPluginNativeWindowWin::GetPluginWindowEvent(
HWND aWnd, UINT aMsg, WPARAM aWParam, LPARAM aLParam) {
if (!mWeakRef) {
mWeakRef = this;
if (!mWeakRef) return nullptr;
}
PluginWindowEvent *event;
PluginWindowEvent* event;
// We have the ability to alloc if needed in case in the future some plugin
// should post multiple PostMessages. However, this could lead to many
@@ -519,7 +519,7 @@ PluginWindowEvent *nsPluginNativeWindowWin::GetPluginWindowEvent(
}
nsresult nsPluginNativeWindowWin::CallSetWindow(
RefPtr<nsNPAPIPluginInstance> &aPluginInstance) {
RefPtr<nsNPAPIPluginInstance>& aPluginInstance) {
// Note, 'window' can be null
// check the incoming instance, null indicates that window is going away and
@@ -535,7 +535,7 @@ nsresult nsPluginNativeWindowWin::CallSetWindow(
// check plugin mime type and cache it if it will need special treatment later
if (mPluginType == nsPluginHost::eSpecialType_None) {
const char *mimetype = nullptr;
const char* mimetype = nullptr;
if (NS_SUCCEEDED(aPluginInstance->GetMIMEType(&mimetype)) && mimetype) {
mPluginType = nsPluginHost::GetSpecialType(nsDependentCString(mimetype));
}
@@ -609,9 +609,8 @@ nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow() {
(WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)PluginWndProc);
if (!mPluginWinProc) return NS_ERROR_FAILURE;
DebugOnly<nsPluginNativeWindowWin *> win =
(nsPluginNativeWindowWin *)::GetProp(
hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
DebugOnly<nsPluginNativeWindowWin*> win = (nsPluginNativeWindowWin*)::GetProp(
hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
NS_ASSERTION(!win || (win == this),
"plugin window already has property and this is not us");
@@ -649,7 +648,7 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow() {
}
nsresult PLUG_NewPluginNativeWindow(
nsPluginNativeWindow **aPluginNativeWindow) {
nsPluginNativeWindow** aPluginNativeWindow) {
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
*aPluginNativeWindow = new nsPluginNativeWindowWin();
@@ -657,9 +656,9 @@ nsresult PLUG_NewPluginNativeWindow(
}
nsresult PLUG_DeletePluginNativeWindow(
nsPluginNativeWindow *aPluginNativeWindow) {
nsPluginNativeWindow* aPluginNativeWindow) {
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
nsPluginNativeWindowWin *p = (nsPluginNativeWindowWin *)aPluginNativeWindow;
nsPluginNativeWindowWin* p = (nsPluginNativeWindowWin*)aPluginNativeWindow;
delete p;
return NS_OK;
}

View File

@@ -16,20 +16,20 @@
// E.g. "mime type::desecription;" // correct w/o ext
// "mime type:desecription;" // wrong w/o ext
//
static nsresult ParsePluginMimeDescription(const char *mdesc,
nsPluginInfo &info) {
static nsresult ParsePluginMimeDescription(const char* mdesc,
nsPluginInfo& info) {
nsresult rv = NS_ERROR_FAILURE;
if (!mdesc || !*mdesc) return rv;
char *mdescDup =
char* mdescDup =
PL_strdup(mdesc); // make a dup of intput string we'll change it content
char anEmptyString[] = "";
AutoTArray<char *, 8> tmpMimeTypeArr;
AutoTArray<char*, 8> tmpMimeTypeArr;
char delimiters[] = {':', ':', ';'};
int mimeTypeVariantCount = 0;
char *p = mdescDup; // make a dup of intput string we'll change it content
char* p = mdescDup; // make a dup of intput string we'll change it content
while (p) {
char *ptrMimeArray[] = {anEmptyString, anEmptyString, anEmptyString};
char* ptrMimeArray[] = {anEmptyString, anEmptyString, anEmptyString};
// It's easy to point out ptrMimeArray[0] to the string sounds like
// "Mime type is not specified, plugin will not function properly."
@@ -42,7 +42,7 @@ static nsresult ParsePluginMimeDescription(const char *mdesc,
// empty string on GetMIMEDescription() call, e.g. plugger returns "" if
// pluggerrc file is not found.
char *s = p;
char* s = p;
int i;
for (i = 0;
i < (int)sizeof(delimiters) && (p = PL_strchr(s, delimiters[i]));
@@ -66,12 +66,10 @@ static nsresult ParsePluginMimeDescription(const char *mdesc,
if (mimeTypeVariantCount) {
info.fVariantCount = mimeTypeVariantCount;
// we can do these 3 mallocs at once, later on code cleanup
info.fMimeTypeArray =
(char **)malloc(mimeTypeVariantCount * sizeof(char *));
info.fMimeTypeArray = (char**)malloc(mimeTypeVariantCount * sizeof(char*));
info.fMimeDescriptionArray =
(char **)malloc(mimeTypeVariantCount * sizeof(char *));
info.fExtensionArray =
(char **)malloc(mimeTypeVariantCount * sizeof(char *));
(char**)malloc(mimeTypeVariantCount * sizeof(char*));
info.fExtensionArray = (char**)malloc(mimeTypeVariantCount * sizeof(char*));
int j, i;
for (j = i = 0; i < mimeTypeVariantCount; i++) {

View File

@@ -26,10 +26,10 @@ using namespace mozilla::plugins::PluginUtilsOSX;
@interface CGBridgeLayer : CALayer {
DrawPluginFunc mDrawFunc;
void *mPluginInstance;
void* mPluginInstance;
nsIntRect mUpdateRect;
}
- (void)setDrawFunc:(DrawPluginFunc)aFunc pluginInstance:(void *)aPluginInstance;
- (void)setDrawFunc:(DrawPluginFunc)aFunc pluginInstance:(void*)aPluginInstance;
- (void)updateRect:(nsIntRect)aRect;
@end
@@ -40,7 +40,7 @@ using namespace mozilla::plugins::PluginUtilsOSX;
// originally specified in a call to CGBitmapContextCreate() or
// CGBitmapContextCreateWithData().
typedef void (*CGBitmapContextSetDataFunc)(CGContextRef c, size_t x, size_t y, size_t width,
size_t height, void *data, size_t bitsPerComponent,
size_t height, void* data, size_t bitsPerComponent,
size_t bitsPerPixel, size_t bytesPerRow);
CGBitmapContextSetDataFunc CGBitmapContextSetDataPtr = NULL;
@@ -49,7 +49,7 @@ CGBitmapContextSetDataFunc CGBitmapContextSetDataPtr = NULL;
mUpdateRect.UnionRect(mUpdateRect, aRect);
}
- (void)setDrawFunc:(DrawPluginFunc)aFunc pluginInstance:(void *)aPluginInstance {
- (void)setDrawFunc:(DrawPluginFunc)aFunc pluginInstance:(void*)aPluginInstance {
mDrawFunc = aFunc;
mPluginInstance = aPluginInstance;
}
@@ -70,16 +70,16 @@ CGBitmapContextSetDataFunc CGBitmapContextSetDataPtr = NULL;
@end
void *mozilla::plugins::PluginUtilsOSX::GetCGLayer(DrawPluginFunc aFunc, void *aPluginInstance,
void* mozilla::plugins::PluginUtilsOSX::GetCGLayer(DrawPluginFunc aFunc, void* aPluginInstance,
double aContentsScaleFactor) {
CGBridgeLayer *bridgeLayer = [[CGBridgeLayer alloc] init];
CGBridgeLayer* bridgeLayer = [[CGBridgeLayer alloc] init];
// We need to make bridgeLayer behave properly when its superlayer changes
// size (in nsCARenderer::SetBounds()).
bridgeLayer.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
bridgeLayer.needsDisplayOnBoundsChange = YES;
NSNull *nullValue = [NSNull null];
NSDictionary *actions = [NSDictionary
NSNull* nullValue = [NSNull null];
NSDictionary* actions = [NSDictionary
dictionaryWithObjectsAndKeys:nullValue, @"bounds", nullValue, @"contents", nullValue,
@"contentsRect", nullValue, @"position", nil];
[bridgeLayer setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]];
@@ -100,13 +100,13 @@ void *mozilla::plugins::PluginUtilsOSX::GetCGLayer(DrawPluginFunc aFunc, void *a
return bridgeLayer;
}
void mozilla::plugins::PluginUtilsOSX::ReleaseCGLayer(void *cgLayer) {
CGBridgeLayer *bridgeLayer = (CGBridgeLayer *)cgLayer;
void mozilla::plugins::PluginUtilsOSX::ReleaseCGLayer(void* cgLayer) {
CGBridgeLayer* bridgeLayer = (CGBridgeLayer*)cgLayer;
[bridgeLayer release];
}
void mozilla::plugins::PluginUtilsOSX::Repaint(void *caLayer, nsIntRect aRect) {
CGBridgeLayer *bridgeLayer = (CGBridgeLayer *)caLayer;
void mozilla::plugins::PluginUtilsOSX::Repaint(void* caLayer, nsIntRect aRect) {
CGBridgeLayer* bridgeLayer = (CGBridgeLayer*)caLayer;
[CATransaction begin];
[bridgeLayer updateRect:aRect];
[bridgeLayer setNeedsDisplay];
@@ -116,9 +116,9 @@ void mozilla::plugins::PluginUtilsOSX::Repaint(void *caLayer, nsIntRect aRect) {
@interface EventProcessor : NSObject {
RemoteProcessEvents aRemoteEvents;
void *aPluginModule;
void* aPluginModule;
}
- (void)setRemoteEvents:(RemoteProcessEvents)remoteEvents pluginModule:(void *)pluginModule;
- (void)setRemoteEvents:(RemoteProcessEvents)remoteEvents pluginModule:(void*)pluginModule;
- (void)onTick;
@end
@@ -127,7 +127,7 @@ void mozilla::plugins::PluginUtilsOSX::Repaint(void *caLayer, nsIntRect aRect) {
aRemoteEvents(aPluginModule);
}
- (void)setRemoteEvents:(RemoteProcessEvents)remoteEvents pluginModule:(void *)pluginModule {
- (void)setRemoteEvents:(RemoteProcessEvents)remoteEvents pluginModule:(void*)pluginModule {
aRemoteEvents = remoteEvents;
aPluginModule = pluginModule;
}
@@ -135,8 +135,8 @@ void mozilla::plugins::PluginUtilsOSX::Repaint(void *caLayer, nsIntRect aRect) {
#define EVENT_PROCESS_DELAY 0.05 // 50 ms
NPError mozilla::plugins::PluginUtilsOSX::ShowCocoaContextMenu(void *aMenu, int aX, int aY,
void *pluginModule,
NPError mozilla::plugins::PluginUtilsOSX::ShowCocoaContextMenu(void* aMenu, int aX, int aY,
void* pluginModule,
RemoteProcessEvents remoteEvent) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
@@ -148,8 +148,8 @@ NPError mozilla::plugins::PluginUtilsOSX::ShowCocoaContextMenu(void *aMenu, int
// change to an arrow cursor automatically -- as it does in Chrome.
[[NSCursor arrowCursor] set];
EventProcessor *eventProcessor = nullptr;
NSTimer *eventTimer = nullptr;
EventProcessor* eventProcessor = nullptr;
NSTimer* eventTimer = nullptr;
if (pluginModule) {
// Create a timer to process browser events while waiting
// on the menu. This prevents the browser from hanging
@@ -166,7 +166,7 @@ NPError mozilla::plugins::PluginUtilsOSX::ShowCocoaContextMenu(void *aMenu, int
[[NSRunLoop currentRunLoop] addTimer:eventTimer forMode:NSEventTrackingRunLoopMode];
}
NSMenu *nsmenu = reinterpret_cast<NSMenu *>(aMenu);
NSMenu* nsmenu = reinterpret_cast<NSMenu*>(aMenu);
NSPoint screen_point = ::NSMakePoint(aX, aY);
[nsmenu popUpMenuPositioningItem:nil atLocation:screen_point inView:nil];
@@ -191,13 +191,13 @@ void mozilla::plugins::PluginUtilsOSX::InvokeNativeEventLoop() {
namespace mozilla {
namespace plugins {
namespace PluginUtilsOSX {
static void *sApplicationASN = NULL;
static void *sApplicationInfoItem = NULL;
static void* sApplicationASN = NULL;
static void* sApplicationInfoItem = NULL;
} // namespace PluginUtilsOSX
} // namespace plugins
} // namespace mozilla
bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char *aProcessName) {
bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char* aProcessName) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
nsAutoreleasePool localPool;
@@ -205,8 +205,8 @@ bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char *aProcessName)
return false;
}
NSString *currentName =
[[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:(NSString *)kCFBundleNameKey];
NSString* currentName =
[[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:(NSString*)kCFBundleNameKey];
char formattedName[1024];
SprintfLiteral(formattedName, "%s %s", [currentName UTF8String], aProcessName);
@@ -216,7 +216,7 @@ bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char *aProcessName)
// This function is based on Chrome/Webkit's and relies on potentially dangerous SPI.
typedef CFTypeRef (*LSGetASNType)();
typedef OSStatus (*LSSetInformationItemType)(int, CFTypeRef, CFStringRef, CFStringRef,
CFDictionaryRef *);
CFDictionaryRef*);
CFBundleRef launchServices = ::CFBundleGetBundleWithIdentifier(CFSTR("com.apple.LaunchServices"));
if (!launchServices) {
@@ -244,12 +244,12 @@ bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char *aProcessName)
LSSetInformationItemType setInformationItemFunc =
reinterpret_cast<LSSetInformationItemType>(sApplicationInfoItem);
void *displayNameKeyAddr =
void* displayNameKeyAddr =
::CFBundleGetDataPointerForName(launchServices, CFSTR("_kLSDisplayNameKey"));
CFStringRef displayNameKey = nil;
if (displayNameKeyAddr) {
displayNameKey = reinterpret_cast<CFStringRef>(*(CFStringRef *)displayNameKeyAddr);
displayNameKey = reinterpret_cast<CFStringRef>(*(CFStringRef*)displayNameKeyAddr);
}
// Rename will fail without this
@@ -350,7 +350,7 @@ bool nsDoubleBufferCARenderer::HasFrontSurface() { return !!mFrontSurface; }
bool nsDoubleBufferCARenderer::HasCALayer() { return !!mCALayer; }
void nsDoubleBufferCARenderer::SetCALayer(void *aCALayer) { mCALayer = aCALayer; }
void nsDoubleBufferCARenderer::SetCALayer(void* aCALayer) { mCALayer = aCALayer; }
bool nsDoubleBufferCARenderer::InitFrontSurface(size_t aWidth, size_t aHeight,
double aContentsScaleFactor,

View File

@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
const char *sPluginName = "Shockwave Flash";
const char *sPluginDescription = "Flash plug-in for testing purposes.";
const char *sMimeDescription =
const char* sPluginName = "Shockwave Flash";
const char* sPluginDescription = "Flash plug-in for testing purposes.";
const char* sMimeDescription =
"application/x-shockwave-flash-test:swf:Flash test type";

View File

@@ -1,8 +1,8 @@
const char *sPluginName = "Test Plug-in";
const char *sPluginDescription =
const char* sPluginName = "Test Plug-in";
const char* sPluginDescription =
"Plug-in for testing purposes.\xE2\x84\xA2 "
"(\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80 "
"\xe4\xb8\xad\xe6\x96\x87 "
"\xd8\xa7\xd9\x84\xd8\xb9\xd8\xb1\xd8\xa8\xd9\x8a\xd8\xa9)";
const char *sMimeDescription =
const char* sMimeDescription =
"application/x-test:tst:Test \xE2\x84\xA2 mimetype";

View File

@@ -2,6 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
const char *sPluginName = "Second Test Plug-in";
const char *sPluginDescription = "Second plug-in for testing purposes.";
const char *sMimeDescription = "application/x-Second-Test:ts2:Second test type";
const char* sPluginName = "Second Test Plug-in";
const char* sPluginDescription = "Second plug-in for testing purposes.";
const char* sMimeDescription = "application/x-Second-Test:ts2:Second test type";

View File

@@ -2,6 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
const char *sPluginName = "Third Test Plug-in";
const char *sPluginDescription = "Third plug-in for testing purposes.";
const char *sMimeDescription = "application/x-Third-Test:ts3:Third test type";
const char* sPluginName = "Third Test Plug-in";
const char* sPluginDescription = "Third plug-in for testing purposes.";
const char* sMimeDescription = "application/x-Third-Test:ts3:Third test type";

View File

@@ -53,7 +53,7 @@ PowerManagerService::~PowerManagerService() {
}
void PowerManagerService::ComputeWakeLockState(
const WakeLockInformation &aWakeLockInfo, nsAString &aState) {
const WakeLockInformation& aWakeLockInfo, nsAString& aState) {
WakeLockState state = hal::ComputeWakeLockState(aWakeLockInfo.numLocks(),
aWakeLockInfo.numHidden());
switch (state) {
@@ -69,7 +69,7 @@ void PowerManagerService::ComputeWakeLockState(
}
}
void PowerManagerService::Notify(const WakeLockInformation &aWakeLockInfo) {
void PowerManagerService::Notify(const WakeLockInformation& aWakeLockInfo) {
nsAutoString state;
ComputeWakeLockState(aWakeLockInfo, state);
@@ -87,7 +87,7 @@ void PowerManagerService::Notify(const WakeLockInformation &aWakeLockInfo) {
}
NS_IMETHODIMP
PowerManagerService::AddWakeLockListener(nsIDOMMozWakeLockListener *aListener) {
PowerManagerService::AddWakeLockListener(nsIDOMMozWakeLockListener* aListener) {
if (mWakeLockListeners.Contains(aListener)) return NS_OK;
mWakeLockListeners.AppendElement(aListener);
@@ -96,14 +96,14 @@ PowerManagerService::AddWakeLockListener(nsIDOMMozWakeLockListener *aListener) {
NS_IMETHODIMP
PowerManagerService::RemoveWakeLockListener(
nsIDOMMozWakeLockListener *aListener) {
nsIDOMMozWakeLockListener* aListener) {
mWakeLockListeners.RemoveElement(aListener);
return NS_OK;
}
NS_IMETHODIMP
PowerManagerService::GetWakeLockState(const nsAString &aTopic,
nsAString &aState) {
PowerManagerService::GetWakeLockState(const nsAString& aTopic,
nsAString& aState) {
WakeLockInformation info;
GetWakeLockInfo(aTopic, &info);
@@ -113,8 +113,8 @@ PowerManagerService::GetWakeLockState(const nsAString &aTopic,
}
already_AddRefed<WakeLock> PowerManagerService::NewWakeLock(
const nsAString &aTopic, nsPIDOMWindowInner *aWindow,
mozilla::ErrorResult &aRv) {
const nsAString& aTopic, nsPIDOMWindowInner* aWindow,
mozilla::ErrorResult& aRv) {
RefPtr<WakeLock> wakelock = new WakeLock();
aRv = wakelock->Init(aTopic, aWindow);
if (aRv.Failed()) {
@@ -125,9 +125,9 @@ already_AddRefed<WakeLock> PowerManagerService::NewWakeLock(
}
NS_IMETHODIMP
PowerManagerService::NewWakeLock(const nsAString &aTopic,
mozIDOMWindow *aWindow,
nsIWakeLock **aWakeLock) {
PowerManagerService::NewWakeLock(const nsAString& aTopic,
mozIDOMWindow* aWindow,
nsIWakeLock** aWakeLock) {
mozilla::ErrorResult rv;
RefPtr<WakeLock> wakelock =
NewWakeLock(aTopic, nsPIDOMWindowInner::From(aWindow), rv);
@@ -140,7 +140,7 @@ PowerManagerService::NewWakeLock(const nsAString &aTopic,
}
already_AddRefed<WakeLock> PowerManagerService::NewWakeLockOnBehalfOfProcess(
const nsAString &aTopic, ContentParent *aContentParent) {
const nsAString& aTopic, ContentParent* aContentParent) {
RefPtr<WakeLock> wakelock = new WakeLock();
nsresult rv = wakelock->Init(aTopic, aContentParent);
NS_ENSURE_SUCCESS(rv, nullptr);

View File

@@ -34,7 +34,7 @@ CSPService::~CSPService() {}
NS_IMPL_ISUPPORTS(CSPService, nsIContentPolicy, nsIChannelEventSink)
// Helper function to identify protocols and content types not subject to CSP.
bool subjectToCSP(nsIURI *aURI, nsContentPolicyType aContentType) {
bool subjectToCSP(nsIURI* aURI, nsContentPolicyType aContentType) {
nsContentPolicyType contentType =
nsContentUtils::InternalContentPolicyTypeToExternal(aContentType);
@@ -115,8 +115,8 @@ bool subjectToCSP(nsIURI *aURI, nsContentPolicyType aContentType) {
/* nsIContentPolicy implementation */
NS_IMETHODIMP
CSPService::ShouldLoad(nsIURI *aContentLocation, nsILoadInfo *aLoadInfo,
const nsACString &aMimeTypeGuess, int16_t *aDecision) {
CSPService::ShouldLoad(nsIURI* aContentLocation, nsILoadInfo* aLoadInfo,
const nsACString& aMimeTypeGuess, int16_t* aDecision) {
if (!aContentLocation) {
return NS_ERROR_FAILURE;
}
@@ -228,9 +228,9 @@ CSPService::ShouldLoad(nsIURI *aContentLocation, nsILoadInfo *aLoadInfo,
}
NS_IMETHODIMP
CSPService::ShouldProcess(nsIURI *aContentLocation, nsILoadInfo *aLoadInfo,
const nsACString &aMimeTypeGuess,
int16_t *aDecision) {
CSPService::ShouldProcess(nsIURI* aContentLocation, nsILoadInfo* aLoadInfo,
const nsACString& aMimeTypeGuess,
int16_t* aDecision) {
if (!aContentLocation) {
return NS_ERROR_FAILURE;
}
@@ -260,9 +260,9 @@ CSPService::ShouldProcess(nsIURI *aContentLocation, nsILoadInfo *aLoadInfo,
/* nsIChannelEventSink implementation */
NS_IMETHODIMP
CSPService::AsyncOnChannelRedirect(nsIChannel *oldChannel,
nsIChannel *newChannel, uint32_t flags,
nsIAsyncVerifyRedirectCallback *callback) {
CSPService::AsyncOnChannelRedirect(nsIChannel* oldChannel,
nsIChannel* newChannel, uint32_t flags,
nsIAsyncVerifyRedirectCallback* callback) {
net::nsAsyncRedirectAutoCallback autoCallback(callback);
nsCOMPtr<nsIURI> newUri;

View File

@@ -22,8 +22,8 @@ static SVGAttrTearoffTable<SVGAnimatedInteger,
SVGAnimatedInteger::DOMAnimatedInteger>
sSVGAnimatedIntegerTearoffTable;
nsresult SVGAnimatedInteger::SetBaseValueString(const nsAString &aValueAsString,
SVGElement *aSVGElement) {
nsresult SVGAnimatedInteger::SetBaseValueString(const nsAString& aValueAsString,
SVGElement* aSVGElement) {
bool success;
auto token = SVGContentUtils::GetAndEnsureOneToken(aValueAsString, success);
@@ -47,12 +47,12 @@ nsresult SVGAnimatedInteger::SetBaseValueString(const nsAString &aValueAsString,
return NS_OK;
}
void SVGAnimatedInteger::GetBaseValueString(nsAString &aValueAsString) {
void SVGAnimatedInteger::GetBaseValueString(nsAString& aValueAsString) {
aValueAsString.Truncate();
aValueAsString.AppendInt(mBaseVal);
}
void SVGAnimatedInteger::SetBaseValue(int aValue, SVGElement *aSVGElement) {
void SVGAnimatedInteger::SetBaseValue(int aValue, SVGElement* aSVGElement) {
// We can't just rely on SetParsedAttrValue (as called by DidChangeInteger)
// detecting redundant changes since it will compare false if the existing
// attribute value has an associated serialized version (a string value) even
@@ -71,7 +71,7 @@ void SVGAnimatedInteger::SetBaseValue(int aValue, SVGElement *aSVGElement) {
aSVGElement->DidChangeInteger(mAttrEnum);
}
void SVGAnimatedInteger::SetAnimValue(int aValue, SVGElement *aSVGElement) {
void SVGAnimatedInteger::SetAnimValue(int aValue, SVGElement* aSVGElement) {
if (mIsAnimated && aValue == mAnimVal) {
return;
}
@@ -81,7 +81,7 @@ void SVGAnimatedInteger::SetAnimValue(int aValue, SVGElement *aSVGElement) {
}
already_AddRefed<DOMSVGAnimatedInteger>
SVGAnimatedInteger::ToDOMAnimatedInteger(SVGElement *aSVGElement) {
SVGAnimatedInteger::ToDOMAnimatedInteger(SVGElement* aSVGElement) {
RefPtr<DOMAnimatedInteger> domAnimatedInteger =
sSVGAnimatedIntegerTearoffTable.GetTearoff(this);
if (!domAnimatedInteger) {
@@ -96,13 +96,13 @@ SVGAnimatedInteger::DOMAnimatedInteger::~DOMAnimatedInteger() {
sSVGAnimatedIntegerTearoffTable.RemoveTearoff(mVal);
}
UniquePtr<SMILAttr> SVGAnimatedInteger::ToSMILAttr(SVGElement *aSVGElement) {
UniquePtr<SMILAttr> SVGAnimatedInteger::ToSMILAttr(SVGElement* aSVGElement) {
return MakeUnique<SMILInteger>(this, aSVGElement);
}
nsresult SVGAnimatedInteger::SMILInteger::ValueFromString(
const nsAString &aStr, const dom::SVGAnimationElement * /*aSrcElement*/,
SMILValue &aValue, bool &aPreventCachingOfSandwich) const {
const nsAString& aStr, const dom::SVGAnimationElement* /*aSrcElement*/,
SMILValue& aValue, bool& aPreventCachingOfSandwich) const {
int32_t val;
if (!SVGContentUtils::ParseInteger(aStr, val)) {
@@ -131,7 +131,7 @@ void SVGAnimatedInteger::SMILInteger::ClearAnimValue() {
}
nsresult SVGAnimatedInteger::SMILInteger::SetAnimValue(
const SMILValue &aValue) {
const SMILValue& aValue) {
NS_ASSERTION(aValue.mType == SMILIntegerType::Singleton(),
"Unexpected type to assign animated value");
if (aValue.mType == SMILIntegerType::Singleton()) {

View File

@@ -17,14 +17,14 @@ namespace mozilla {
using namespace dom;
nsresult SVGAnimatedLengthList::SetBaseValueString(const nsAString &aValue) {
nsresult SVGAnimatedLengthList::SetBaseValueString(const nsAString& aValue) {
SVGLengthList newBaseValue;
nsresult rv = newBaseValue.SetValueFromString(aValue);
if (NS_FAILED(rv)) {
return rv;
}
DOMSVGAnimatedLengthList *domWrapper =
DOMSVGAnimatedLengthList* domWrapper =
DOMSVGAnimatedLengthList::GetDOMWrapperIfExists(this);
if (domWrapper) {
// We must send this notification *before* changing mBaseVal! If the length
@@ -49,7 +49,7 @@ nsresult SVGAnimatedLengthList::SetBaseValueString(const nsAString &aValue) {
}
void SVGAnimatedLengthList::ClearBaseValue(uint32_t aAttrEnum) {
DOMSVGAnimatedLengthList *domWrapper =
DOMSVGAnimatedLengthList* domWrapper =
DOMSVGAnimatedLengthList::GetDOMWrapperIfExists(this);
if (domWrapper) {
// We must send this notification *before* changing mBaseVal! (See above.)
@@ -59,10 +59,10 @@ void SVGAnimatedLengthList::ClearBaseValue(uint32_t aAttrEnum) {
// Caller notifies
}
nsresult SVGAnimatedLengthList::SetAnimValue(const SVGLengthList &aNewAnimValue,
SVGElement *aElement,
nsresult SVGAnimatedLengthList::SetAnimValue(const SVGLengthList& aNewAnimValue,
SVGElement* aElement,
uint32_t aAttrEnum) {
DOMSVGAnimatedLengthList *domWrapper =
DOMSVGAnimatedLengthList* domWrapper =
DOMSVGAnimatedLengthList::GetDOMWrapperIfExists(this);
if (domWrapper) {
// A new animation may totally change the number of items in the animVal
@@ -97,9 +97,9 @@ nsresult SVGAnimatedLengthList::SetAnimValue(const SVGLengthList &aNewAnimValue,
return NS_OK;
}
void SVGAnimatedLengthList::ClearAnimValue(SVGElement *aElement,
void SVGAnimatedLengthList::ClearAnimValue(SVGElement* aElement,
uint32_t aAttrEnum) {
DOMSVGAnimatedLengthList *domWrapper =
DOMSVGAnimatedLengthList* domWrapper =
DOMSVGAnimatedLengthList::GetDOMWrapperIfExists(this);
if (domWrapper) {
// When all animation ends, animVal simply mirrors baseVal, which may have
@@ -113,7 +113,7 @@ void SVGAnimatedLengthList::ClearAnimValue(SVGElement *aElement,
aElement->DidAnimateLengthList(aAttrEnum);
}
UniquePtr<SMILAttr> SVGAnimatedLengthList::ToSMILAttr(SVGElement *aSVGElement,
UniquePtr<SMILAttr> SVGAnimatedLengthList::ToSMILAttr(SVGElement* aSVGElement,
uint8_t aAttrEnum,
uint8_t aAxis,
bool aCanZeroPadList) {
@@ -122,10 +122,10 @@ UniquePtr<SMILAttr> SVGAnimatedLengthList::ToSMILAttr(SVGElement *aSVGElement,
}
nsresult SVGAnimatedLengthList::SMILAnimatedLengthList::ValueFromString(
const nsAString &aStr, const dom::SVGAnimationElement * /*aSrcElement*/,
SMILValue &aValue, bool &aPreventCachingOfSandwich) const {
const nsAString& aStr, const dom::SVGAnimationElement* /*aSrcElement*/,
SMILValue& aValue, bool& aPreventCachingOfSandwich) const {
SMILValue val(&SVGLengthListSMILType::sSingleton);
SVGLengthListAndInfo *llai = static_cast<SVGLengthListAndInfo *>(val.mU.mPtr);
SVGLengthListAndInfo* llai = static_cast<SVGLengthListAndInfo*>(val.mU.mPtr);
nsresult rv = llai->SetValueFromString(aStr);
if (NS_SUCCEEDED(rv)) {
llai->SetInfo(mElement, mAxis, mCanZeroPadList);
@@ -166,7 +166,7 @@ SMILValue SVGAnimatedLengthList::SMILAnimatedLengthList::GetBaseValue() const {
SMILValue val;
SMILValue tmp(&SVGLengthListSMILType::sSingleton);
SVGLengthListAndInfo *llai = static_cast<SVGLengthListAndInfo *>(tmp.mU.mPtr);
SVGLengthListAndInfo* llai = static_cast<SVGLengthListAndInfo*>(tmp.mU.mPtr);
nsresult rv = llai->CopyFrom(mVal->mBaseVal);
if (NS_SUCCEEDED(rv)) {
llai->SetInfo(mElement, mAxis, mCanZeroPadList);
@@ -176,11 +176,11 @@ SMILValue SVGAnimatedLengthList::SMILAnimatedLengthList::GetBaseValue() const {
}
nsresult SVGAnimatedLengthList::SMILAnimatedLengthList::SetAnimValue(
const SMILValue &aValue) {
const SMILValue& aValue) {
NS_ASSERTION(aValue.mType == &SVGLengthListSMILType::sSingleton,
"Unexpected type to assign animated value");
if (aValue.mType == &SVGLengthListSMILType::sSingleton) {
mVal->SetAnimValue(*static_cast<SVGLengthListAndInfo *>(aValue.mU.mPtr),
mVal->SetAnimValue(*static_cast<SVGLengthListAndInfo*>(aValue.mU.mPtr),
mElement, mAttrEnum);
}
return NS_OK;

View File

@@ -16,14 +16,14 @@ using namespace mozilla::dom;
namespace mozilla {
nsresult SVGAnimatedNumberList::SetBaseValueString(const nsAString &aValue) {
nsresult SVGAnimatedNumberList::SetBaseValueString(const nsAString& aValue) {
SVGNumberList newBaseValue;
nsresult rv = newBaseValue.SetValueFromString(aValue);
if (NS_FAILED(rv)) {
return rv;
}
DOMSVGAnimatedNumberList *domWrapper =
DOMSVGAnimatedNumberList* domWrapper =
DOMSVGAnimatedNumberList::GetDOMWrapperIfExists(this);
if (domWrapper) {
// We must send this notification *before* changing mBaseVal! If the length
@@ -49,7 +49,7 @@ nsresult SVGAnimatedNumberList::SetBaseValueString(const nsAString &aValue) {
}
void SVGAnimatedNumberList::ClearBaseValue(uint32_t aAttrEnum) {
DOMSVGAnimatedNumberList *domWrapper =
DOMSVGAnimatedNumberList* domWrapper =
DOMSVGAnimatedNumberList::GetDOMWrapperIfExists(this);
if (domWrapper) {
// We must send this notification *before* changing mBaseVal! (See above.)
@@ -60,10 +60,10 @@ void SVGAnimatedNumberList::ClearBaseValue(uint32_t aAttrEnum) {
// Caller notifies
}
nsresult SVGAnimatedNumberList::SetAnimValue(const SVGNumberList &aNewAnimValue,
SVGElement *aElement,
nsresult SVGAnimatedNumberList::SetAnimValue(const SVGNumberList& aNewAnimValue,
SVGElement* aElement,
uint32_t aAttrEnum) {
DOMSVGAnimatedNumberList *domWrapper =
DOMSVGAnimatedNumberList* domWrapper =
DOMSVGAnimatedNumberList::GetDOMWrapperIfExists(this);
if (domWrapper) {
// A new animation may totally change the number of items in the animVal
@@ -98,9 +98,9 @@ nsresult SVGAnimatedNumberList::SetAnimValue(const SVGNumberList &aNewAnimValue,
return NS_OK;
}
void SVGAnimatedNumberList::ClearAnimValue(SVGElement *aElement,
void SVGAnimatedNumberList::ClearAnimValue(SVGElement* aElement,
uint32_t aAttrEnum) {
DOMSVGAnimatedNumberList *domWrapper =
DOMSVGAnimatedNumberList* domWrapper =
DOMSVGAnimatedNumberList::GetDOMWrapperIfExists(this);
if (domWrapper) {
// When all animation ends, animVal simply mirrors baseVal, which may have
@@ -114,16 +114,16 @@ void SVGAnimatedNumberList::ClearAnimValue(SVGElement *aElement,
aElement->DidAnimateNumberList(aAttrEnum);
}
UniquePtr<SMILAttr> SVGAnimatedNumberList::ToSMILAttr(SVGElement *aSVGElement,
UniquePtr<SMILAttr> SVGAnimatedNumberList::ToSMILAttr(SVGElement* aSVGElement,
uint8_t aAttrEnum) {
return MakeUnique<SMILAnimatedNumberList>(this, aSVGElement, aAttrEnum);
}
nsresult SVGAnimatedNumberList::SMILAnimatedNumberList::ValueFromString(
const nsAString &aStr, const dom::SVGAnimationElement * /*aSrcElement*/,
SMILValue &aValue, bool &aPreventCachingOfSandwich) const {
const nsAString& aStr, const dom::SVGAnimationElement* /*aSrcElement*/,
SMILValue& aValue, bool& aPreventCachingOfSandwich) const {
SMILValue val(&SVGNumberListSMILType::sSingleton);
SVGNumberListAndInfo *nlai = static_cast<SVGNumberListAndInfo *>(val.mU.mPtr);
SVGNumberListAndInfo* nlai = static_cast<SVGNumberListAndInfo*>(val.mU.mPtr);
nsresult rv = nlai->SetValueFromString(aStr);
if (NS_SUCCEEDED(rv)) {
nlai->SetInfo(mElement);
@@ -140,7 +140,7 @@ SMILValue SVGAnimatedNumberList::SMILAnimatedNumberList::GetBaseValue() const {
SMILValue val;
SMILValue tmp(&SVGNumberListSMILType::sSingleton);
SVGNumberListAndInfo *nlai = static_cast<SVGNumberListAndInfo *>(tmp.mU.mPtr);
SVGNumberListAndInfo* nlai = static_cast<SVGNumberListAndInfo*>(tmp.mU.mPtr);
nsresult rv = nlai->CopyFrom(mVal->mBaseVal);
if (NS_SUCCEEDED(rv)) {
nlai->SetInfo(mElement);
@@ -150,11 +150,11 @@ SMILValue SVGAnimatedNumberList::SMILAnimatedNumberList::GetBaseValue() const {
}
nsresult SVGAnimatedNumberList::SMILAnimatedNumberList::SetAnimValue(
const SMILValue &aValue) {
const SMILValue& aValue) {
NS_ASSERTION(aValue.mType == &SVGNumberListSMILType::sSingleton,
"Unexpected type to assign animated value");
if (aValue.mType == &SVGNumberListSMILType::sSingleton) {
mVal->SetAnimValue(*static_cast<SVGNumberListAndInfo *>(aValue.mU.mPtr),
mVal->SetAnimValue(*static_cast<SVGNumberListAndInfo*>(aValue.mU.mPtr),
mElement, mAttrEnum);
}
return NS_OK;

View File

@@ -18,7 +18,7 @@ using namespace mozilla::dom;
namespace mozilla {
nsresult SVGAnimatedPathSegList::SetBaseValueString(const nsAString &aValue) {
nsresult SVGAnimatedPathSegList::SetBaseValueString(const nsAString& aValue) {
SVGPathData newBaseValue;
// The spec says that the path data is parsed and accepted up to the first
@@ -33,13 +33,13 @@ nsresult SVGAnimatedPathSegList::SetBaseValueString(const nsAString &aValue) {
// change them. See the comments in
// DOMSVGPathSegList::InternalListWillChangeTo().
DOMSVGPathSegList *baseValWrapper =
DOMSVGPathSegList* baseValWrapper =
DOMSVGPathSegList::GetDOMWrapperIfExists(GetBaseValKey());
if (baseValWrapper) {
baseValWrapper->InternalListWillChangeTo(newBaseValue);
}
DOMSVGPathSegList *animValWrapper = nullptr;
DOMSVGPathSegList* animValWrapper = nullptr;
if (!IsAnimating()) { // DOM anim val wraps our base val too!
animValWrapper = DOMSVGPathSegList::GetDOMWrapperIfExists(GetAnimValKey());
if (animValWrapper) {
@@ -71,14 +71,14 @@ nsresult SVGAnimatedPathSegList::SetBaseValueString(const nsAString &aValue) {
void SVGAnimatedPathSegList::ClearBaseValue() {
// We must send these notifications *before* changing mBaseVal! (See above.)
DOMSVGPathSegList *baseValWrapper =
DOMSVGPathSegList* baseValWrapper =
DOMSVGPathSegList::GetDOMWrapperIfExists(GetBaseValKey());
if (baseValWrapper) {
baseValWrapper->InternalListWillChangeTo(SVGPathData());
}
if (!IsAnimating()) { // DOM anim val wraps our base val too!
DOMSVGPathSegList *animValWrapper =
DOMSVGPathSegList* animValWrapper =
DOMSVGPathSegList::GetDOMWrapperIfExists(GetAnimValKey());
if (animValWrapper) {
animValWrapper->InternalListWillChangeTo(SVGPathData());
@@ -89,8 +89,8 @@ void SVGAnimatedPathSegList::ClearBaseValue() {
// Caller notifies
}
nsresult SVGAnimatedPathSegList::SetAnimValue(const SVGPathData &aNewAnimValue,
SVGElement *aElement) {
nsresult SVGAnimatedPathSegList::SetAnimValue(const SVGPathData& aNewAnimValue,
SVGElement* aElement) {
// Note that a new animation may totally change the number of items in the
// animVal list, either replacing what was essentially a mirror of the
// baseVal list, or else replacing and overriding an existing animation.
@@ -104,7 +104,7 @@ nsresult SVGAnimatedPathSegList::SetAnimValue(const SVGPathData &aNewAnimValue,
// We must send these notifications *before* changing mAnimVal! (See above.)
DOMSVGPathSegList *domWrapper =
DOMSVGPathSegList* domWrapper =
DOMSVGPathSegList::GetDOMWrapperIfExists(GetAnimValKey());
if (domWrapper) {
domWrapper->InternalListWillChangeTo(aNewAnimValue);
@@ -122,10 +122,10 @@ nsresult SVGAnimatedPathSegList::SetAnimValue(const SVGPathData &aNewAnimValue,
return rv;
}
void SVGAnimatedPathSegList::ClearAnimValue(SVGElement *aElement) {
void SVGAnimatedPathSegList::ClearAnimValue(SVGElement* aElement) {
// We must send these notifications *before* changing mAnimVal! (See above.)
DOMSVGPathSegList *domWrapper =
DOMSVGPathSegList* domWrapper =
DOMSVGPathSegList::GetDOMWrapperIfExists(GetAnimValKey());
if (domWrapper) {
// When all animation ends, animVal simply mirrors baseVal, which may have
@@ -141,15 +141,15 @@ bool SVGAnimatedPathSegList::IsRendered() const {
return mAnimVal ? !mAnimVal->IsEmpty() : !mBaseVal.IsEmpty();
}
UniquePtr<SMILAttr> SVGAnimatedPathSegList::ToSMILAttr(SVGElement *aElement) {
UniquePtr<SMILAttr> SVGAnimatedPathSegList::ToSMILAttr(SVGElement* aElement) {
return MakeUnique<SMILAnimatedPathSegList>(this, aElement);
}
nsresult SVGAnimatedPathSegList::SMILAnimatedPathSegList::ValueFromString(
const nsAString &aStr, const dom::SVGAnimationElement * /*aSrcElement*/,
SMILValue &aValue, bool &aPreventCachingOfSandwich) const {
const nsAString& aStr, const dom::SVGAnimationElement* /*aSrcElement*/,
SMILValue& aValue, bool& aPreventCachingOfSandwich) const {
SMILValue val(SVGPathSegListSMILType::Singleton());
SVGPathDataAndInfo *list = static_cast<SVGPathDataAndInfo *>(val.mU.mPtr);
SVGPathDataAndInfo* list = static_cast<SVGPathDataAndInfo*>(val.mU.mPtr);
nsresult rv = list->SetValueFromString(aStr);
if (NS_SUCCEEDED(rv)) {
list->SetElement(mElement);
@@ -167,7 +167,7 @@ SMILValue SVGAnimatedPathSegList::SMILAnimatedPathSegList::GetBaseValue()
SMILValue val;
SMILValue tmp(SVGPathSegListSMILType::Singleton());
SVGPathDataAndInfo *list = static_cast<SVGPathDataAndInfo *>(tmp.mU.mPtr);
SVGPathDataAndInfo* list = static_cast<SVGPathDataAndInfo*>(tmp.mU.mPtr);
nsresult rv = list->CopyFrom(mVal->mBaseVal);
if (NS_SUCCEEDED(rv)) {
list->SetElement(mElement);
@@ -177,11 +177,11 @@ SMILValue SVGAnimatedPathSegList::SMILAnimatedPathSegList::GetBaseValue()
}
nsresult SVGAnimatedPathSegList::SMILAnimatedPathSegList::SetAnimValue(
const SMILValue &aValue) {
const SMILValue& aValue) {
NS_ASSERTION(aValue.mType == SVGPathSegListSMILType::Singleton(),
"Unexpected type to assign animated value");
if (aValue.mType == SVGPathSegListSMILType::Singleton()) {
mVal->SetAnimValue(*static_cast<SVGPathDataAndInfo *>(aValue.mU.mPtr),
mVal->SetAnimValue(*static_cast<SVGPathDataAndInfo*>(aValue.mU.mPtr),
mElement);
}
return NS_OK;

Some files were not shown because too many files have changed in this diff Show More