Bug 703239 - Fixing build warnings in editor/, r=ehsan
authorAtul Aggarwal <atulagrwl@gmail.com>
Thu, 22 Dec 2011 23:46:56 +0530
changeset 84571 1f0062478a1f93231064f24b22c443d544ea3e64
parent 84570 45206fca898d121626f890cb2bdde1ac37a1535f
child 84572 559c270ad020751f5862b07ec93d7022505801a0
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs703239
milestone12.0a1
Bug 703239 - Fixing build warnings in editor/, r=ehsan
editor/composer/src/nsComposerController.cpp
editor/libeditor/base/nsEditorController.cpp
editor/libeditor/html/nsHTMLEditorStyle.cpp
--- a/editor/composer/src/nsComposerController.cpp
+++ b/editor/composer/src/nsComposerController.cpp
@@ -40,61 +40,55 @@
 
 #include "nsIControllerCommandTable.h"
 #include "nsComposerController.h"
 #include "nsComposerCommands.h"
 
 #define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName)                    \
   {                                                                     \
     _cmdClass* theCmd = new _cmdClass();                                \
-    NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY);                         \
-    rv = inCommandTable->RegisterCommand(_cmdName,                      \
+    inCommandTable->RegisterCommand(_cmdName,                           \
                        static_cast<nsIControllerCommand *>(theCmd));    \
   }
 
 #define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName)                  \
   {                                                                     \
     _cmdClass* theCmd = new _cmdClass();                                \
-    NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY);                         \
-    rv = inCommandTable->RegisterCommand(_cmdName,                      \
+    inCommandTable->RegisterCommand(_cmdName,                           \
                        static_cast<nsIControllerCommand *>(theCmd));
 
 #define NS_REGISTER_NEXT_COMMAND(_cmdClass, _cmdName)                   \
-    rv = inCommandTable->RegisterCommand(_cmdName,                      \
+    inCommandTable->RegisterCommand(_cmdName,                           \
                         static_cast<nsIControllerCommand *>(theCmd));
 
 #define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName)                   \
-    rv = inCommandTable->RegisterCommand(_cmdName,                      \
+    inCommandTable->RegisterCommand(_cmdName,                           \
                        static_cast<nsIControllerCommand *>(theCmd));    \
   }
 
 #define NS_REGISTER_STYLE_COMMAND(_cmdClass, _cmdName, _styleTag)       \
   {                                                                     \
     _cmdClass* theCmd = new _cmdClass(_styleTag);                       \
-    NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY);                         \
-    rv = inCommandTable->RegisterCommand(_cmdName,                      \
+    inCommandTable->RegisterCommand(_cmdName,                           \
                        static_cast<nsIControllerCommand *>(theCmd));    \
   }
   
 #define NS_REGISTER_TAG_COMMAND(_cmdClass, _cmdName, _tagName)          \
   {                                                                     \
     _cmdClass* theCmd = new _cmdClass(_tagName);                        \
-    NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY);                         \
-    rv = inCommandTable->RegisterCommand(_cmdName,                      \
+    inCommandTable->RegisterCommand(_cmdName,                           \
                        static_cast<nsIControllerCommand *>(theCmd));    \
   }
   
 
 // static
 nsresult
 nsComposerController::RegisterEditorDocStateCommands(
                         nsIControllerCommandTable *inCommandTable)
 {
-  nsresult rv;
-
   // observer commands for document state
   NS_REGISTER_FIRST_COMMAND(nsDocumentStateCommand, "obs_documentCreated")
   NS_REGISTER_NEXT_COMMAND(nsDocumentStateCommand, "obs_documentWillBeDestroyed")
   NS_REGISTER_LAST_COMMAND(nsDocumentStateCommand, "obs_documentLocationChanged")
 
   // commands that may get or change state
   NS_REGISTER_FIRST_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentModified")
   NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentUseCSS")
@@ -108,18 +102,16 @@ nsComposerController::RegisterEditorDocS
   return NS_OK;
 }
 
 // static
 nsresult
 nsComposerController::RegisterHTMLEditorCommands(
                         nsIControllerCommandTable *inCommandTable)
 {
-  nsresult rv;
-  
   // Edit menu
   NS_REGISTER_ONE_COMMAND(nsPasteNoFormattingCommand, "cmd_pasteNoFormatting");
 
   // indent/outdent
   NS_REGISTER_ONE_COMMAND(nsIndentCommand, "cmd_indent");
   NS_REGISTER_ONE_COMMAND(nsOutdentCommand, "cmd_outdent");
 
   // Styles
--- a/editor/libeditor/base/nsEditorController.cpp
+++ b/editor/libeditor/base/nsEditorController.cpp
@@ -43,61 +43,59 @@
 #include "nsEditorCommands.h"
 #include "nsIControllerCommandTable.h"
 
 
 
 #define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName)                                      \
   {                                                                                       \
     _cmdClass* theCmd = new _cmdClass();                                                  \
-    NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY);                                           \
-    rv = inCommandTable->RegisterCommand(_cmdName,                                        \
+    NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY);                                       \
+    inCommandTable->RegisterCommand(_cmdName,                                             \
                                    static_cast<nsIControllerCommand *>(theCmd));          \
   }
 
 #define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName)                                    \
   {                                                                                       \
     _cmdClass* theCmd = new _cmdClass();                                                  \
-    NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY);                                           \
-    rv = inCommandTable->RegisterCommand(_cmdName,                                        \
+    NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY);                                       \
+    inCommandTable->RegisterCommand(_cmdName,                                             \
                                    static_cast<nsIControllerCommand *>(theCmd));
 
 #define NS_REGISTER_NEXT_COMMAND(_cmdClass, _cmdName)                                     \
-    rv = inCommandTable->RegisterCommand(_cmdName,                                        \
+    inCommandTable->RegisterCommand(_cmdName,                                             \
                                    static_cast<nsIControllerCommand *>(theCmd));
 
 #define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName)                                     \
-    rv = inCommandTable->RegisterCommand(_cmdName,                                        \
+    inCommandTable->RegisterCommand(_cmdName,                                             \
                                    static_cast<nsIControllerCommand *>(theCmd));          \
   }
 
 
 // static
 nsresult nsEditorController::RegisterEditorCommands(nsIControllerCommandTable *inCommandTable)
 {
-  nsresult rv;
- 
   // now register all our commands
   // These are commands that will be used in text widgets, and in composer
-  
+
   NS_REGISTER_ONE_COMMAND(nsUndoCommand, "cmd_undo");
   NS_REGISTER_ONE_COMMAND(nsRedoCommand, "cmd_redo");
   NS_REGISTER_ONE_COMMAND(nsClearUndoCommand, "cmd_clearUndo");
 
   NS_REGISTER_ONE_COMMAND(nsCutCommand, "cmd_cut");
   NS_REGISTER_ONE_COMMAND(nsCutOrDeleteCommand, "cmd_cutOrDelete");
   NS_REGISTER_ONE_COMMAND(nsCopyCommand, "cmd_copy");
   NS_REGISTER_ONE_COMMAND(nsCopyOrDeleteCommand, "cmd_copyOrDelete");
   NS_REGISTER_ONE_COMMAND(nsSelectAllCommand, "cmd_selectAll");
-  
+
   NS_REGISTER_ONE_COMMAND(nsPasteCommand, "cmd_paste");
   NS_REGISTER_ONE_COMMAND(nsPasteTransferableCommand, "cmd_pasteTransferable");
 
   NS_REGISTER_ONE_COMMAND(nsSwitchTextDirectionCommand, "cmd_switchTextDirection");
-  
+
   NS_REGISTER_FIRST_COMMAND(nsDeleteCommand, "cmd_delete");
   NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteCharBackward");
   NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteCharForward");
   NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteWordBackward");
   NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteWordForward");
   NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteToBeginningOfLine");
   NS_REGISTER_LAST_COMMAND(nsDeleteCommand, "cmd_deleteToEndOfLine");
 
--- a/editor/libeditor/html/nsHTMLEditorStyle.cpp
+++ b/editor/libeditor/html/nsHTMLEditorStyle.cpp
@@ -534,41 +534,40 @@ nsHTMLEditor::SetInlinePropertyOnNode( n
 
 nsresult nsHTMLEditor::SplitStyleAboveRange(nsIDOMRange *inRange, 
                                             nsIAtom *aProperty, 
                                             const nsAString *aAttribute)
 {
   NS_ENSURE_TRUE(inRange, NS_ERROR_NULL_POINTER);
   nsresult res;
   nsCOMPtr<nsIDOMNode> startNode, endNode, origStartNode;
-  PRInt32 startOffset, endOffset, origStartOffset;
-  
+  PRInt32 startOffset, endOffset;
+
   res = inRange->GetStartContainer(getter_AddRefs(startNode));
   NS_ENSURE_SUCCESS(res, res);
   res = inRange->GetStartOffset(&startOffset);
   NS_ENSURE_SUCCESS(res, res);
   res = inRange->GetEndContainer(getter_AddRefs(endNode));
   NS_ENSURE_SUCCESS(res, res);
   res = inRange->GetEndOffset(&endOffset);
   NS_ENSURE_SUCCESS(res, res);
-  
+
   origStartNode = startNode;
-  origStartOffset = startOffset;
-  
+
   // split any matching style nodes above the start of range
   {
     nsAutoTrackDOMPoint tracker(mRangeUpdater, address_of(endNode), &endOffset);
     res = SplitStyleAbovePoint(address_of(startNode), &startOffset, aProperty, aAttribute);
     NS_ENSURE_SUCCESS(res, res);
   }
 
   // second verse, same as the first...
   res = SplitStyleAbovePoint(address_of(endNode), &endOffset, aProperty, aAttribute);
   NS_ENSURE_SUCCESS(res, res);
-  
+
   // reset the range
   res = inRange->SetStart(startNode, startOffset);
   NS_ENSURE_SUCCESS(res, res);
   res = inRange->SetEnd(endNode, endOffset);
   return res;
 }
 
 nsresult nsHTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
@@ -661,20 +660,20 @@ nsresult nsHTMLEditor::RemoveStyleInside
     // cache next sibling since we might remove child
     child->GetNextSibling(getter_AddRefs(tmp));
     res = RemoveStyleInside(child, aProperty, aAttribute);
     NS_ENSURE_SUCCESS(res, res);
     child = tmp;
   }
 
   // then process the node itself
-  if ( !aChildrenOnly && 
-        (aProperty && NodeIsType(aNode, aProperty) || // node is prop we asked for
+  if ((!aChildrenOnly &&
+        ((aProperty && NodeIsType(aNode, aProperty)) || // node is prop we asked for
         (aProperty == nsEditProperty::href && nsHTMLEditUtils::IsLink(aNode)) || // but check for link (<a href=...)
-        (aProperty == nsEditProperty::name && nsHTMLEditUtils::IsNamedAnchor(aNode))) || // and for named anchors
+        (aProperty == nsEditProperty::name && nsHTMLEditUtils::IsNamedAnchor(aNode)))) || // and for named anchors
         (!aProperty && NodeIsProperty(aNode)))  // or node is any prop and we asked for that
   {
     // if we weren't passed an attribute, then we want to 
     // remove any matching inlinestyles entirely
     if (!aAttribute || aAttribute->IsEmpty())
     {
       NS_NAMED_LITERAL_STRING(styleAttr, "style");
       NS_NAMED_LITERAL_STRING(classAttr, "class");
@@ -1043,36 +1042,33 @@ nsHTMLEditor::GetInlinePropertyBase(nsIA
     {
       range->GetStartContainer(getter_AddRefs(collapsedNode));
       NS_ENSURE_TRUE(collapsedNode, NS_ERROR_FAILURE);
       bool isSet, theSetting;
       if (aAttribute)
       {
         nsString tString(*aAttribute); //MJUDGE SCC NEED HELP
         nsString tOutString;//MJUDGE SCC NEED HELP
-        nsString *tPassString=nsnull;
-        if (outValue)
-            tPassString = &tOutString;
         mTypeInState->GetTypingState(isSet, theSetting, aProperty, tString, &tOutString);
         if (outValue)
           outValue->Assign(tOutString);
       }
       else
         mTypeInState->GetTypingState(isSet, theSetting, aProperty);
-      if (isSet) 
+      if (isSet)
       {
         *aFirst = *aAny = *aAll = theSetting;
         return NS_OK;
       }
       if (!useCSS) {
         nsCOMPtr<nsIDOMNode> resultNode;
         IsTextPropertySetByContent(collapsedNode, aProperty, aAttribute, aValue,
                                    isSet, getter_AddRefs(resultNode), outValue);
         *aFirst = *aAny = *aAll = isSet;
-        
+
         if (!isSet && aCheckDefaults) 
         {
           // style not set, but if it is a default then it will appear if 
           // content is inserted, so we should report it as set (analogous to TypeInState).
           PRInt32 index;
           if (aAttribute &&
               TypeInState::FindPropInList(aProperty, *aAttribute, outValue, mDefaultStyles, index))
           {