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" { extern "C" {
static guint (*gail_add_global_event_listener)(GSignalEmissionHook listener, 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_global_event_listener)(guint remove_listener);
static void (*gail_remove_key_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 { struct MaiUtilListenerInfo {
@@ -41,13 +41,13 @@ struct MaiUtilListenerInfo {
guint gail_listenerid; guint gail_listenerid;
}; };
static GHashTable *sListener_list = nullptr; static GHashTable* sListener_list = nullptr;
static gint sListener_idx = 1; static gint sListener_idx = 1;
extern "C" { extern "C" {
static guint add_listener(GSignalEmissionHook listener, static guint add_listener(GSignalEmissionHook listener,
const gchar *object_type, const gchar *signal, const gchar* object_type, const gchar* signal,
const gchar *hook_data, guint gail_listenerid = 0) { const gchar* hook_data, guint gail_listenerid = 0) {
GType type; GType type;
guint signal_id; guint signal_id;
gint rc = 0; gint rc = 0;
@@ -56,12 +56,12 @@ static guint add_listener(GSignalEmissionHook listener,
if (type) { if (type) {
signal_id = g_signal_lookup(signal, type); signal_id = g_signal_lookup(signal, type);
if (signal_id > 0) { if (signal_id > 0) {
MaiUtilListenerInfo *listener_info; MaiUtilListenerInfo* listener_info;
rc = sListener_idx; rc = sListener_idx;
listener_info = listener_info =
(MaiUtilListenerInfo *)g_malloc(sizeof(MaiUtilListenerInfo)); (MaiUtilListenerInfo*)g_malloc(sizeof(MaiUtilListenerInfo));
listener_info->key = sListener_idx; listener_info->key = sListener_idx;
listener_info->hook_id = g_signal_add_emission_hook( listener_info->hook_id = g_signal_add_emission_hook(
signal_id, 0, listener, g_strdup(hook_data), (GDestroyNotify)g_free); 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, static guint mai_util_add_global_event_listener(GSignalEmissionHook listener,
const gchar *event_type) { const gchar* event_type) {
guint rc = 0; guint rc = 0;
gchar **split_string; gchar** split_string;
split_string = g_strsplit(event_type, ":", 3); 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) { static void mai_util_remove_global_event_listener(guint remove_listener) {
if (remove_listener > 0) { if (remove_listener > 0) {
MaiUtilListenerInfo *listener_info; MaiUtilListenerInfo* listener_info;
gint tmp_idx = remove_listener; gint tmp_idx = remove_listener;
listener_info = 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 (listener_info != nullptr) {
if (gail_remove_global_event_listener && listener_info->gail_listenerid) { 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) { static AtkKeyEventStruct* atk_key_event_from_gdk_event_key(GdkEventKey* key) {
AtkKeyEventStruct *event = g_new0(AtkKeyEventStruct, 1); AtkKeyEventStruct* event = g_new0(AtkKeyEventStruct, 1);
switch (key->type) { switch (key->type) {
case GDK_KEY_PRESS: case GDK_KEY_PRESS:
event->type = ATK_KEY_EVENT_PRESS; event->type = ATK_KEY_EVENT_PRESS;
@@ -173,7 +173,7 @@ static AtkKeyEventStruct *atk_key_event_from_gdk_event_key(GdkEventKey *key) {
} }
struct MaiKeyEventInfo { struct MaiKeyEventInfo {
AtkKeyEventStruct *key_event; AtkKeyEventStruct* key_event;
gpointer func_data; gpointer func_data;
}; };
@@ -183,7 +183,7 @@ union AtkKeySnoopFuncPointer {
}; };
static gboolean notify_hf(gpointer key, gpointer value, gpointer data) { static gboolean notify_hf(gpointer key, gpointer value, gpointer data) {
MaiKeyEventInfo *info = (MaiKeyEventInfo *)data; MaiKeyEventInfo* info = (MaiKeyEventInfo*)data;
AtkKeySnoopFuncPointer atkKeySnoop; AtkKeySnoopFuncPointer atkKeySnoop;
atkKeySnoop.data = value; atkKeySnoop.data = value;
return (atkKeySnoop.func_ptr)(info->key_event, info->func_data) ? TRUE 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) { 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); 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) { gpointer func_data) {
/* notify each AtkKeySnoopFunc in turn... */ /* notify each AtkKeySnoopFunc in turn... */
MaiKeyEventInfo *info = g_new0(MaiKeyEventInfo, 1); MaiKeyEventInfo* info = g_new0(MaiKeyEventInfo, 1);
gint consumed = 0; gint consumed = 0;
if (sKey_listener_list) { 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); g_hash_table_foreach(sKey_listener_list, insert_hf, new_hash);
info->key_event = atk_key_event_from_gdk_event_key(event); info->key_event = atk_key_event_from_gdk_event_key(event);
info->func_data = func_data; 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() { static AtkObject* mai_util_get_root() {
ApplicationAccessible *app = ApplicationAcc(); ApplicationAccessible* app = ApplicationAcc();
if (app) return app->GetAtkObject(); if (app) return app->GetAtkObject();
// We've shutdown, try to use gail instead // We've shutdown, try to use gail instead
@@ -269,28 +269,28 @@ static AtkObject *mai_util_get_root() {
return nullptr; 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 _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; if (!IS_MAI_OBJECT(child)) return;
static guint id = g_signal_lookup("create", MAI_TYPE_ATK_OBJECT); static guint id = g_signal_lookup("create", MAI_TYPE_ATK_OBJECT);
g_signal_emit(child, id, 0); 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; if (!IS_MAI_OBJECT(child)) return;
static guint id = g_signal_lookup("destroy", MAI_TYPE_ATK_OBJECT); static guint id = g_signal_lookup("destroy", MAI_TYPE_ATK_OBJECT);
g_signal_emit(child, id, 0); g_signal_emit(child, id, 0);
} }
static void UtilInterfaceInit(MaiUtilClass *klass) { static void UtilInterfaceInit(MaiUtilClass* klass) {
AtkUtilClass *atk_class; AtkUtilClass* atk_class;
gpointer data; gpointer data;
data = g_type_class_peek(ATK_TYPE_UTIL); 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, sListener_list = g_hash_table_new_full(g_int_hash, g_int_equal, nullptr,
_listener_info_destroy); _listener_info_destroy);
// Keep track of added/removed windows. // 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, g_signal_connect(root, "children-changed::add", (GCallback)window_added,
nullptr); nullptr);
g_signal_connect(root, "children-changed::remove", (GCallback)window_removed, 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 * The MaiHyperlink whose properties and features are exported via this
* hyperlink instance. * hyperlink instance.
*/ */
MaiHyperlink *maiHyperlink; MaiHyperlink* maiHyperlink;
}; };
struct MaiAtkHyperlinkClass { struct MaiAtkHyperlinkClass {
@@ -49,23 +49,23 @@ GType mai_atk_hyperlink_get_type(void);
G_BEGIN_DECLS G_BEGIN_DECLS
/* callbacks for AtkHyperlink */ /* callbacks for AtkHyperlink */
static void classInitCB(AtkHyperlinkClass *aClass); static void classInitCB(AtkHyperlinkClass* aClass);
static void finalizeCB(GObject *aObj); static void finalizeCB(GObject* aObj);
/* callbacks for AtkHyperlink virtual functions */ /* callbacks for AtkHyperlink virtual functions */
static gchar *getUriCB(AtkHyperlink *aLink, gint aLinkIndex); static gchar* getUriCB(AtkHyperlink* aLink, gint aLinkIndex);
static AtkObject *getObjectCB(AtkHyperlink *aLink, gint aLinkIndex); static AtkObject* getObjectCB(AtkHyperlink* aLink, gint aLinkIndex);
static gint getEndIndexCB(AtkHyperlink *aLink); static gint getEndIndexCB(AtkHyperlink* aLink);
static gint getStartIndexCB(AtkHyperlink *aLink); static gint getStartIndexCB(AtkHyperlink* aLink);
static gboolean isValidCB(AtkHyperlink *aLink); static gboolean isValidCB(AtkHyperlink* aLink);
static gint getAnchorCountCB(AtkHyperlink *aLink); static gint getAnchorCountCB(AtkHyperlink* aLink);
G_END_DECLS G_END_DECLS
static gpointer parent_class = nullptr; static gpointer parent_class = nullptr;
static MaiHyperlink *GetMaiHyperlink(AtkHyperlink *aHyperlink) { static MaiHyperlink* GetMaiHyperlink(AtkHyperlink* aHyperlink) {
NS_ENSURE_TRUE(MAI_IS_ATK_HYPERLINK(aHyperlink), nullptr); 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 != nullptr, nullptr);
NS_ENSURE_TRUE(maiHyperlink->GetAtkHyperlink() == aHyperlink, nullptr); NS_ENSURE_TRUE(maiHyperlink->GetAtkHyperlink() == aHyperlink, nullptr);
return maiHyperlink; return maiHyperlink;
@@ -96,7 +96,7 @@ GType mai_atk_hyperlink_get_type(void) {
MaiHyperlink::MaiHyperlink(AccessibleOrProxy aHyperLink) MaiHyperlink::MaiHyperlink(AccessibleOrProxy aHyperLink)
: mHyperlink(aHyperLink), mMaiAtkHyperlink(nullptr) { : mHyperlink(aHyperLink), mMaiAtkHyperlink(nullptr) {
mMaiAtkHyperlink = reinterpret_cast<AtkHyperlink *>( mMaiAtkHyperlink = reinterpret_cast<AtkHyperlink*>(
g_object_new(mai_atk_hyperlink_get_type(), nullptr)); g_object_new(mai_atk_hyperlink_get_type(), nullptr));
NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY"); NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
if (!mMaiAtkHyperlink) return; if (!mMaiAtkHyperlink) return;
@@ -113,8 +113,8 @@ MaiHyperlink::~MaiHyperlink() {
/* static functions for ATK callbacks */ /* static functions for ATK callbacks */
void classInitCB(AtkHyperlinkClass *aClass) { void classInitCB(AtkHyperlinkClass* aClass) {
GObjectClass *gobject_class = G_OBJECT_CLASS(aClass); GObjectClass* gobject_class = G_OBJECT_CLASS(aClass);
parent_class = g_type_class_peek_parent(aClass); parent_class = g_type_class_peek_parent(aClass);
@@ -128,11 +128,11 @@ void classInitCB(AtkHyperlinkClass *aClass) {
gobject_class->finalize = finalizeCB; gobject_class->finalize = finalizeCB;
} }
void finalizeCB(GObject *aObj) { void finalizeCB(GObject* aObj) {
NS_ASSERTION(MAI_IS_ATK_HYPERLINK(aObj), "Invalid MaiAtkHyperlink"); NS_ASSERTION(MAI_IS_ATK_HYPERLINK(aObj), "Invalid MaiAtkHyperlink");
if (!MAI_IS_ATK_HYPERLINK(aObj)) return; if (!MAI_IS_ATK_HYPERLINK(aObj)) return;
MaiAtkHyperlink *maiAtkHyperlink = MAI_ATK_HYPERLINK(aObj); MaiAtkHyperlink* maiAtkHyperlink = MAI_ATK_HYPERLINK(aObj);
maiAtkHyperlink->maiHyperlink = nullptr; maiAtkHyperlink->maiHyperlink = nullptr;
/* call parent finalize function */ /* call parent finalize function */
@@ -140,12 +140,12 @@ void finalizeCB(GObject *aObj) {
G_OBJECT_CLASS(parent_class)->finalize(aObj); G_OBJECT_CLASS(parent_class)->finalize(aObj);
} }
gchar *getUriCB(AtkHyperlink *aLink, gint aLinkIndex) { gchar* getUriCB(AtkHyperlink* aLink, gint aLinkIndex) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink); MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) return nullptr; if (!maiLink) return nullptr;
nsAutoCString cautoStr; nsAutoCString cautoStr;
if (Accessible *hyperlink = maiLink->GetAccHyperlink()) { if (Accessible* hyperlink = maiLink->GetAccHyperlink()) {
nsCOMPtr<nsIURI> uri = hyperlink->AnchorURIAt(aLinkIndex); nsCOMPtr<nsIURI> uri = hyperlink->AnchorURIAt(aLinkIndex);
if (!uri) return nullptr; if (!uri) return nullptr;
@@ -162,28 +162,28 @@ gchar *getUriCB(AtkHyperlink *aLink, gint aLinkIndex) {
return g_strdup(cautoStr.get()); return g_strdup(cautoStr.get());
} }
AtkObject *getObjectCB(AtkHyperlink *aLink, gint aLinkIndex) { AtkObject* getObjectCB(AtkHyperlink* aLink, gint aLinkIndex) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink); MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) { if (!maiLink) {
return nullptr; return nullptr;
} }
if (Accessible *hyperlink = maiLink->GetAccHyperlink()) { if (Accessible* hyperlink = maiLink->GetAccHyperlink()) {
Accessible *anchor = hyperlink->AnchorAt(aLinkIndex); Accessible* anchor = hyperlink->AnchorAt(aLinkIndex);
NS_ENSURE_TRUE(anchor, nullptr); NS_ENSURE_TRUE(anchor, nullptr);
return AccessibleWrap::GetAtkObject(anchor); return AccessibleWrap::GetAtkObject(anchor);
} }
ProxyAccessible *anchor = maiLink->Proxy()->AnchorAt(aLinkIndex); ProxyAccessible* anchor = maiLink->Proxy()->AnchorAt(aLinkIndex);
return anchor ? GetWrapperFor(anchor) : nullptr; return anchor ? GetWrapperFor(anchor) : nullptr;
} }
gint getEndIndexCB(AtkHyperlink *aLink) { gint getEndIndexCB(AtkHyperlink* aLink) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink); MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) return false; if (!maiLink) return false;
if (Accessible *hyperlink = maiLink->GetAccHyperlink()) if (Accessible* hyperlink = maiLink->GetAccHyperlink())
return static_cast<gint>(hyperlink->EndOffset()); return static_cast<gint>(hyperlink->EndOffset());
bool valid = false; bool valid = false;
@@ -191,11 +191,11 @@ gint getEndIndexCB(AtkHyperlink *aLink) {
return valid ? static_cast<gint>(endIdx) : -1; return valid ? static_cast<gint>(endIdx) : -1;
} }
gint getStartIndexCB(AtkHyperlink *aLink) { gint getStartIndexCB(AtkHyperlink* aLink) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink); MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) return -1; if (!maiLink) return -1;
if (Accessible *hyperlink = maiLink->GetAccHyperlink()) if (Accessible* hyperlink = maiLink->GetAccHyperlink())
return static_cast<gint>(hyperlink->StartOffset()); return static_cast<gint>(hyperlink->StartOffset());
bool valid = false; bool valid = false;
@@ -203,21 +203,21 @@ gint getStartIndexCB(AtkHyperlink *aLink) {
return valid ? static_cast<gint>(startIdx) : -1; return valid ? static_cast<gint>(startIdx) : -1;
} }
gboolean isValidCB(AtkHyperlink *aLink) { gboolean isValidCB(AtkHyperlink* aLink) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink); MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) return false; if (!maiLink) return false;
if (Accessible *hyperlink = maiLink->GetAccHyperlink()) if (Accessible* hyperlink = maiLink->GetAccHyperlink())
return static_cast<gboolean>(hyperlink->IsLinkValid()); return static_cast<gboolean>(hyperlink->IsLinkValid());
return static_cast<gboolean>(maiLink->Proxy()->IsLinkValid()); return static_cast<gboolean>(maiLink->Proxy()->IsLinkValid());
} }
gint getAnchorCountCB(AtkHyperlink *aLink) { gint getAnchorCountCB(AtkHyperlink* aLink) {
MaiHyperlink *maiLink = GetMaiHyperlink(aLink); MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
if (!maiLink) return -1; if (!maiLink) return -1;
if (Accessible *hyperlink = maiLink->GetAccHyperlink()) if (Accessible* hyperlink = maiLink->GetAccHyperlink())
return static_cast<gint>(hyperlink->AnchorCount()); return static_cast<gint>(hyperlink->AnchorCount());
bool valid = false; bool valid = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -23,20 +23,20 @@
#undef NAME_MAX #undef NAME_MAX
#define NAME_MAX 256 #define NAME_MAX 256
extern char *program; extern char* program;
extern void fail(const char *format, ...); extern void fail(const char* format, ...);
extern char *getcomponent(char *path, char *name); extern char* getcomponent(char* path, char* name);
extern char *ino2name(ino_t ino); extern char* ino2name(ino_t ino);
extern void *xmalloc(size_t size); extern void* xmalloc(size_t size);
extern char *xstrdup(char *s); extern char* xstrdup(char* s);
extern char *xbasename(char *path); extern char* xbasename(char* path);
extern void xchdir(const char *dir); extern void xchdir(const char* dir);
/* Relate absolute pathnames from and to returning the result in outpath. */ /* 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 */ /* 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___ */ #endif /* pathsub_h___ */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -25,59 +25,59 @@ namespace ubi {
template <> template <>
class Concrete<nsINode> : public Base { class Concrete<nsINode> : public Base {
protected: protected:
explicit Concrete(nsINode *ptr) : Base(ptr) {} explicit Concrete(nsINode* ptr) : Base(ptr) {}
public: public:
static void construct(void *storage, nsINode *ptr); static void construct(void* storage, nsINode* ptr);
Size size(mozilla::MallocSizeOf mallocSizeOf) const override; 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; } CoarseType coarseType() const final { return CoarseType::DOMNode; }
const char16_t *descriptiveTypeName() const override; const char16_t* descriptiveTypeName() const override;
}; };
template <> template <>
class Concrete<nsIContent> : public Concrete<nsINode> { class Concrete<nsIContent> : public Concrete<nsINode> {
protected: protected:
explicit Concrete(nsIContent *ptr) : Concrete<nsINode>(ptr) {} explicit Concrete(nsIContent* ptr) : Concrete<nsINode>(ptr) {}
public: public:
static void construct(void *storage, nsIContent *ptr) { static void construct(void* storage, nsIContent* ptr) {
new (storage) Concrete(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[]; static const char16_t concreteTypeName[];
}; };
template <> template <>
class Concrete<mozilla::dom::Document> : public Concrete<nsINode> { class Concrete<mozilla::dom::Document> : public Concrete<nsINode> {
protected: protected:
explicit Concrete(mozilla::dom::Document *ptr) : Concrete<nsINode>(ptr) {} explicit Concrete(mozilla::dom::Document* ptr) : Concrete<nsINode>(ptr) {}
public: public:
static void construct(void *storage, mozilla::dom::Document *ptr) { static void construct(void* storage, mozilla::dom::Document* ptr) {
new (storage) Concrete(ptr); new (storage) Concrete(ptr);
} }
Size size(mozilla::MallocSizeOf mallocSizeOf) const override; Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
mozilla::dom::Document &getDoc() const { mozilla::dom::Document& getDoc() const {
return *static_cast<mozilla::dom::Document *>(ptr); 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[]; static const char16_t concreteTypeName[];
}; };
template <> template <>
class Concrete<mozilla::dom::Attr> : public Concrete<nsINode> { class Concrete<mozilla::dom::Attr> : public Concrete<nsINode> {
protected: protected:
explicit Concrete(mozilla::dom::Attr *ptr) : Concrete<nsINode>(ptr) {} explicit Concrete(mozilla::dom::Attr* ptr) : Concrete<nsINode>(ptr) {}
public: public:
static void construct(void *storage, mozilla::dom::Attr *ptr) { static void construct(void* storage, mozilla::dom::Attr* ptr) {
new (storage) Concrete(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[]; static const char16_t concreteTypeName[];
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -12,7 +12,7 @@
#include "nsCRT.h" #include "nsCRT.h"
#include "nsIParserUtils.h" #include "nsIParserUtils.h"
void ConvertBufToPlainText(nsString &aConBuf, int aFlag) { void ConvertBufToPlainText(nsString& aConBuf, int aFlag) {
nsCOMPtr<nsIParserUtils> utils = do_GetService(NS_PARSERUTILS_CONTRACTID); nsCOMPtr<nsIParserUtils> utils = do_GetService(NS_PARSERUTILS_CONTRACTID);
utils->ConvertToPlainText(aConBuf, aFlag, 72, aConBuf); 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 // Block read - if your platform needs to do endian-swapping or can only
// handle aligned reads, do the conversion here // 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 // 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) { void MurmurHash3_x86_32(const void* key, int len, uint32_t seed, void* out) {
const uint8_t *data = (const uint8_t *)key; const uint8_t* data = (const uint8_t*)key;
const int nblocks = len / 4; const int nblocks = len / 4;
uint32_t h1 = seed; uint32_t h1 = seed;
@@ -99,7 +99,7 @@ void MurmurHash3_x86_32(const void *key, int len, uint32_t seed, void *out) {
//---------- //----------
// body // 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++) { for (int i = -nblocks; i; i++) {
uint32_t k1 = getblock(blocks, 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 // 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; 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); 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 MurmurHash3_x86_128(const void* key, const int len, uint32_t seed,
void *out) { void* out) {
const uint8_t *data = (const uint8_t *)key; const uint8_t* data = (const uint8_t*)key;
const int nblocks = len / 16; const int nblocks = len / 16;
uint32_t h1 = seed; uint32_t h1 = seed;
@@ -163,7 +163,7 @@ void MurmurHash3_x86_128(const void *key, const int len, uint32_t seed,
//---------- //----------
// body // 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++) { for (int i = -nblocks; i; i++) {
uint32_t k1 = getblock(blocks, i * 4 + 0); 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 // 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 k1 = 0;
uint32_t k2 = 0; uint32_t k2 = 0;
@@ -297,17 +297,17 @@ void MurmurHash3_x86_128(const void *key, const int len, uint32_t seed,
h3 += h1; h3 += h1;
h4 += h1; h4 += h1;
((uint32_t *)out)[0] = h1; ((uint32_t*)out)[0] = h1;
((uint32_t *)out)[1] = h2; ((uint32_t*)out)[1] = h2;
((uint32_t *)out)[2] = h3; ((uint32_t*)out)[2] = h3;
((uint32_t *)out)[3] = h4; ((uint32_t*)out)[3] = h4;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void MurmurHash3_x64_128(const void *key, const int len, const uint32_t seed, void MurmurHash3_x64_128(const void* key, const int len, const uint32_t seed,
void *out) { void* out) {
const uint8_t *data = (const uint8_t *)key; const uint8_t* data = (const uint8_t*)key;
const int nblocks = len / 16; const int nblocks = len / 16;
uint64_t h1 = seed; uint64_t h1 = seed;
@@ -319,7 +319,7 @@ void MurmurHash3_x64_128(const void *key, const int len, const uint32_t seed,
//---------- //----------
// body // body
const uint64_t *blocks = (const uint64_t *)(data); const uint64_t* blocks = (const uint64_t*)(data);
for (int i = 0; i < nblocks; i++) { for (int i = 0; i < nblocks; i++) {
uint64_t k1 = getblock(blocks, i * 2 + 0); 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 // 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 k1 = 0;
uint64_t k2 = 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; h1 += h2;
h2 += h1; h2 += h1;
((uint64_t *)out)[0] = h1; ((uint64_t*)out)[0] = h1;
((uint64_t *)out)[1] = h2; ((uint64_t*)out)[1] = h2;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -37,7 +37,7 @@ class ZeroPole {
public: public:
ZeroPole() : m_zero(0), m_pole(0), m_lastX(0), m_lastY(0) {} 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. // Reset filter state.
void reset() { void reset() {

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -20,44 +20,44 @@ class nsJSNPRuntime {
class nsJSObjWrapperKey { class nsJSObjWrapperKey {
public: 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; return mJSObj == other.mJSObj && mNpp == other.mNpp;
} }
bool operator!=(const nsJSObjWrapperKey &other) const { bool operator!=(const nsJSObjWrapperKey& other) const {
return !(*this == other); return !(*this == other);
} }
void trace(JSTracer *trc) { void trace(JSTracer* trc) {
JS::TraceEdge(trc, &mJSObj, "nsJSObjWrapperKey"); JS::TraceEdge(trc, &mJSObj, "nsJSObjWrapperKey");
} }
nsJSObjWrapperKey(const nsJSObjWrapperKey &other) nsJSObjWrapperKey(const nsJSObjWrapperKey& other)
: mJSObj(other.mJSObj), mNpp(other.mNpp) {} : mJSObj(other.mJSObj), mNpp(other.mNpp) {}
void operator=(const nsJSObjWrapperKey &other) { void operator=(const nsJSObjWrapperKey& other) {
mJSObj = other.mJSObj; mJSObj = other.mJSObj;
mNpp = other.mNpp; mNpp = other.mNpp;
} }
JS::Heap<JSObject *> mJSObj; JS::Heap<JSObject*> mJSObj;
NPP mNpp; NPP mNpp;
}; };
class nsJSObjWrapper : public NPObject { class nsJSObjWrapper : public NPObject {
public: public:
JS::Heap<JSObject *> mJSObj; JS::Heap<JSObject*> mJSObj;
// Because mJSObj might be a cross-compartment wrapper, we can't use it to // 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 // enter the target realm. We use this global instead (it's always
// same-compartment with mJSObj). // same-compartment with mJSObj).
JS::Heap<JSObject *> mJSObjGlobal; JS::Heap<JSObject*> mJSObjGlobal;
const NPP mNpp; const NPP mNpp;
bool mDestroyPending; bool mDestroyPending;
static NPObject *GetNewOrUsed(NPP npp, JS::Handle<JSObject *> obj, static NPObject* GetNewOrUsed(NPP npp, JS::Handle<JSObject*> obj,
JS::Handle<JSObject *> objGlobal); JS::Handle<JSObject*> objGlobal);
void trace(JSTracer *trc) { void trace(JSTracer* trc) {
JS::TraceEdge(trc, &mJSObj, "nsJSObjWrapper::mJSObj"); JS::TraceEdge(trc, &mJSObj, "nsJSObjWrapper::mJSObj");
JS::TraceEdge(trc, &mJSObjGlobal, "nsJSObjWrapper::mJSObjGlobal"); JS::TraceEdge(trc, &mJSObjGlobal, "nsJSObjWrapper::mJSObjGlobal");
} }
@@ -66,25 +66,25 @@ class nsJSObjWrapper : public NPObject {
explicit nsJSObjWrapper(NPP npp); explicit nsJSObjWrapper(NPP npp);
~nsJSObjWrapper(); ~nsJSObjWrapper();
static NPObject *NP_Allocate(NPP npp, NPClass *aClass); static NPObject* NP_Allocate(NPP npp, NPClass* aClass);
static void NP_Deallocate(NPObject *obj); static void NP_Deallocate(NPObject* obj);
static void NP_Invalidate(NPObject *obj); static void NP_Invalidate(NPObject* obj);
static bool NP_HasMethod(NPObject *, NPIdentifier identifier); static bool NP_HasMethod(NPObject*, NPIdentifier identifier);
static bool NP_Invoke(NPObject *obj, NPIdentifier method, static bool NP_Invoke(NPObject* obj, NPIdentifier method,
const NPVariant *args, uint32_t argCount, const NPVariant* args, uint32_t argCount,
NPVariant *result); NPVariant* result);
static bool NP_InvokeDefault(NPObject *obj, const NPVariant *args, static bool NP_InvokeDefault(NPObject* obj, const NPVariant* args,
uint32_t argCount, NPVariant *result); uint32_t argCount, NPVariant* result);
static bool NP_HasProperty(NPObject *obj, NPIdentifier property); static bool NP_HasProperty(NPObject* obj, NPIdentifier property);
static bool NP_GetProperty(NPObject *obj, NPIdentifier property, static bool NP_GetProperty(NPObject* obj, NPIdentifier property,
NPVariant *result); NPVariant* result);
static bool NP_SetProperty(NPObject *obj, NPIdentifier property, static bool NP_SetProperty(NPObject* obj, NPIdentifier property,
const NPVariant *value); const NPVariant* value);
static bool NP_RemoveProperty(NPObject *obj, NPIdentifier property); static bool NP_RemoveProperty(NPObject* obj, NPIdentifier property);
static bool NP_Enumerate(NPObject *npobj, NPIdentifier **identifier, static bool NP_Enumerate(NPObject* npobj, NPIdentifier** identifier,
uint32_t *count); uint32_t* count);
static bool NP_Construct(NPObject *obj, const NPVariant *args, static bool NP_Construct(NPObject* obj, const NPVariant* args,
uint32_t argCount, NPVariant *result); uint32_t argCount, NPVariant* result);
public: public:
static NPClass sJSObjWrapperNPClass; static NPClass sJSObjWrapperNPClass;
@@ -92,12 +92,12 @@ class nsJSObjWrapper : public NPObject {
class nsNPObjWrapper { class nsNPObjWrapper {
public: public:
static bool IsWrapper(JSObject *obj); static bool IsWrapper(JSObject* obj);
static void OnDestroy(NPObject *npobj); static void OnDestroy(NPObject* npobj);
static JSObject *GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj); static JSObject* GetNewOrUsed(NPP npp, JSContext* cx, NPObject* npobj);
}; };
bool JSValToNPVariant(NPP npp, JSContext *cx, const JS::Value &val, bool JSValToNPVariant(NPP npp, JSContext* cx, const JS::Value& val,
NPVariant *variant); NPVariant* variant);
#endif // nsJSNPRuntime_h_ #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 // Constructs and initializes an nsNPAPIPlugin object. A nullptr file path
// will prevent this from calling NP_Initialize. // will prevent this from calling NP_Initialize.
static nsresult CreatePlugin(nsPluginTag *aPluginTag, static nsresult CreatePlugin(nsPluginTag* aPluginTag,
nsNPAPIPlugin **aResult); nsNPAPIPlugin** aResult);
PluginLibrary *GetLibrary(); PluginLibrary* GetLibrary();
// PluginFuncs() can't fail but results are only valid if GetLibrary() // PluginFuncs() can't fail but results are only valid if GetLibrary()
// succeeds // succeeds
NPPluginFuncs *PluginFuncs(); NPPluginFuncs* PluginFuncs();
#if defined(XP_MACOSX) && !defined(__LP64__) #if defined(XP_MACOSX) && !defined(__LP64__)
void SetPluginRefNum(short aRefNum); void SetPluginRefNum(short aRefNum);
@@ -43,18 +43,18 @@ class nsNPAPIPlugin final {
// crashes and is no longer usable. pluginDumpID/browserDumpID are // crashes and is no longer usable. pluginDumpID/browserDumpID are
// the IDs of respective minidumps that were written, or empty if no // the IDs of respective minidumps that were written, or empty if no
// minidump was written. // minidump was written.
void PluginCrashed(const nsAString &pluginDumpID, void PluginCrashed(const nsAString& pluginDumpID,
const nsAString &browserDumpID); const nsAString& browserDumpID);
nsresult Shutdown(); nsresult Shutdown();
static nsresult RetainStream(NPStream *pstream, nsISupports **aRetainedPeer); static nsresult RetainStream(NPStream* pstream, nsISupports** aRetainedPeer);
private: private:
~nsNPAPIPlugin(); ~nsNPAPIPlugin();
NPPluginFuncs mPluginFuncs; NPPluginFuncs mPluginFuncs;
PluginLibrary *mLibrary; PluginLibrary* mLibrary;
}; };
namespace mozilla { namespace mozilla {
@@ -78,11 +78,11 @@ inline bool NPIdentifierIsString(NPIdentifier id) {
return JSID_IS_STRING(NPIdentifierToJSId(id)); return JSID_IS_STRING(NPIdentifierToJSId(id));
} }
inline JSString *NPIdentifierToString(NPIdentifier id) { inline JSString* NPIdentifierToString(NPIdentifier id) {
return JSID_TO_STRING(NPIdentifierToJSId(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)); return JSIdToNPIdentifier(INTERNED_STRING_TO_JSID(cx, str));
} }
@@ -98,7 +98,7 @@ inline NPIdentifier IntToNPIdentifier(int i) {
return JSIdToNPIdentifier(INT_TO_JSID(i)); return JSIdToNPIdentifier(INT_TO_JSID(i));
} }
JSContext *GetJSContext(NPP npp); JSContext* GetJSContext(NPP npp);
inline bool NPStringIdentifierIsPermanent(NPIdentifier id) { inline bool NPStringIdentifierIsPermanent(NPIdentifier id) {
AutoSafeJSContext cx; AutoSafeJSContext cx;
@@ -107,68 +107,68 @@ inline bool NPStringIdentifierIsPermanent(NPIdentifier id) {
#define NPIdentifier_VOID (JSIdToNPIdentifier(JSID_VOID)) #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, void _getstringidentifiers(const NPUTF8** names, int32_t nameCount,
NPIdentifier *identifiers); NPIdentifier* identifiers);
bool _identifierisstring(NPIdentifier identifiers); bool _identifierisstring(NPIdentifier identifiers);
NPIdentifier _getintidentifier(int32_t intid); NPIdentifier _getintidentifier(int32_t intid);
NPUTF8 *_utf8fromidentifier(NPIdentifier identifier); NPUTF8* _utf8fromidentifier(NPIdentifier identifier);
int32_t _intfromidentifier(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, bool _invoke(NPP npp, NPObject* npobj, NPIdentifier method,
const NPVariant *args, uint32_t argCount, NPVariant *result); const NPVariant* args, uint32_t argCount, NPVariant* result);
bool _invokeDefault(NPP npp, NPObject *npobj, const NPVariant *args, bool _invokeDefault(NPP npp, NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant *result); 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, bool _getproperty(NPP npp, NPObject* npobj, NPIdentifier property,
NPVariant *result); NPVariant* result);
bool _setproperty(NPP npp, NPObject *npobj, NPIdentifier property, bool _setproperty(NPP npp, NPObject* npobj, NPIdentifier property,
const NPVariant *value); 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, bool _enumerate(NPP npp, NPObject* npobj, NPIdentifier** identifier,
uint32_t *count); uint32_t* count);
bool _construct(NPP npp, NPObject *npobj, const NPVariant *args, bool _construct(NPP npp, NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant *result); 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 _pushpopupsenabledstate(NPP npp, NPBool enabled);
void _poppopupsenabledstate(NPP npp); void _poppopupsenabledstate(NPP npp);
NPError _getvalueforurl(NPP instance, NPNURLVariable variable, const char *url, NPError _getvalueforurl(NPP instance, NPNURLVariable variable, const char* url,
char **value, uint32_t *len); char** value, uint32_t* len);
NPError _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url, NPError _setvalueforurl(NPP instance, NPNURLVariable variable, const char* url,
const char *value, uint32_t len); const char* value, uint32_t len);
typedef void (*PluginTimerFunc)(NPP npp, uint32_t timerID); 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); 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, NPBool _convertpoint(NPP instance, double sourceX, double sourceY,
NPCoordinateSpace sourceSpace, double *destX, NPCoordinateSpace sourceSpace, double* destX,
double *destY, NPCoordinateSpace destSpace); 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, NPError _geturlnotify(NPP npp, const char* relativeURL, const char* target,
void *notifyData); 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, NPError _posturlnotify(NPP npp, const char* relativeURL, const char* target,
uint32_t len, const char *buf, NPBool file, uint32_t len, const char* buf, NPBool file,
void *notifyData); void* notifyData);
NPError _posturl(NPP npp, const char *relativeURL, const char *target, NPError _posturl(NPP npp, const char* relativeURL, const char* target,
uint32_t len, const char *buf, NPBool file); 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); uint32_t _memflush(uint32_t size);
void _reloadplugins(NPBool reloadPages); void _reloadplugins(NPBool reloadPages);
void _invalidaterect(NPP npp, NPRect *invalidRect); void _invalidaterect(NPP npp, NPRect* invalidRect);
void _invalidateregion(NPP npp, NPRegion invalidRegion); void _invalidateregion(NPP npp, NPRegion invalidRegion);
void _forceredraw(NPP npp); 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. // Deprecated entry points for the old Java plugin.
void * /* OJI type: JRIEnv* */ void* /* OJI type: JRIEnv* */
_getJavaEnv(); _getJavaEnv();
void * /* OJI type: jref */ void* /* OJI type: jref */
_getJavaPeer(NPP npp); _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, NPError _initasyncsurface(NPP instance, NPSize* size, NPImageFormat format,
void *initData, NPAsyncSurface *surface); void* initData, NPAsyncSurface* surface);
NPError _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface); NPError _finalizeasyncsurface(NPP instance, NPAsyncSurface* surface);
void _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, void _setcurrentasyncsurface(NPP instance, NPAsyncSurface* surface,
NPRect *changed); NPRect* changed);
} /* namespace parent */ } /* namespace parent */
} /* namespace plugins */ } /* namespace plugins */
} /* namespace mozilla */ } /* namespace mozilla */
const char *PeekException(); const char* PeekException();
void PopException(); void PopException();
@@ -283,7 +283,7 @@ class NPPExceptionAutoHolder {
~NPPExceptionAutoHolder(); ~NPPExceptionAutoHolder();
protected: protected:
char *mOldException; char* mOldException;
}; };
#endif // nsNPAPIPlugin_h_ #endif // nsNPAPIPlugin_h_

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,8 @@
const char *sPluginName = "Test Plug-in"; const char* sPluginName = "Test Plug-in";
const char *sPluginDescription = const char* sPluginDescription =
"Plug-in for testing purposes.\xE2\x84\xA2 " "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 " "(\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80 "
"\xe4\xb8\xad\xe6\x96\x87 " "\xe4\xb8\xad\xe6\x96\x87 "
"\xd8\xa7\xd9\x84\xd8\xb9\xd8\xb1\xd8\xa8\xd9\x8a\xd8\xa9)"; "\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"; "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, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
const char *sPluginName = "Second Test Plug-in"; const char* sPluginName = "Second Test Plug-in";
const char *sPluginDescription = "Second plug-in for testing purposes."; const char* sPluginDescription = "Second plug-in for testing purposes.";
const char *sMimeDescription = "application/x-Second-Test:ts2:Second test type"; 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, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
const char *sPluginName = "Third Test Plug-in"; const char* sPluginName = "Third Test Plug-in";
const char *sPluginDescription = "Third plug-in for testing purposes."; const char* sPluginDescription = "Third plug-in for testing purposes.";
const char *sMimeDescription = "application/x-Third-Test:ts3:Third test type"; const char* sMimeDescription = "application/x-Third-Test:ts3:Third test type";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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