Bug 491843 - IPv6 address literal is not usable as server name r=dbienvenu a=mbanner for comm-aurora
authorIan Neal <iann_cvs@blueyonder.co.uk>
Wed, 07 Mar 2012 23:09:00 +0000
changeset 10626 d30a1377f5bce803491c159bf8acb6ed6999fc3b
parent 10625 4138254af9bf2a14382f974d19a0183ef8e6bfd5
child 10627 2b2a01474c5747fb756a12f7cea6ada8ac6667f3
push id402
push userbugzilla@standard8.plus.com
push dateTue, 13 Mar 2012 21:17:18 +0000
treeherdercomm-beta@d080a8ebf16a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbienvenu, mbanner
bugs491843
Bug 491843 - IPv6 address literal is not usable as server name r=dbienvenu a=mbanner for comm-aurora
mailnews/base/util/nsMsgIncomingServer.cpp
--- a/mailnews/base/util/nsMsgIncomingServer.cpp
+++ b/mailnews/base/util/nsMsgIncomingServer.cpp
@@ -1208,19 +1208,19 @@ nsMsgIncomingServer::GetEditableFilterLi
 
 // If the hostname contains ':' (like hostname:1431)
 // then parse and set the port number.
 nsresult
 nsMsgIncomingServer::InternalSetHostName(const nsACString& aHostname, const char * prefName)
 {
   nsCString hostname;
   hostname = aHostname;
-  PRInt32 colonPos = hostname.FindChar(':');
-  if (colonPos != -1)
+  if (hostname.CountChar(':') == 1)
   {
+    PRInt32 colonPos = hostname.FindChar(':');
     nsCAutoString portString(Substring(hostname, colonPos));
     hostname.SetLength(colonPos);
     nsresult err;
     PRInt32 port = portString.ToInteger(&err);
     if (NS_SUCCEEDED(err))
       SetPort(port);
   }
   return SetCharValue(prefName, hostname);
@@ -1290,17 +1290,17 @@ nsMsgIncomingServer::SetRealHostName(con
   return rv;
 }
 
 NS_IMETHODIMP
 nsMsgIncomingServer::GetHostName(nsACString& aResult)
 {
   nsresult rv;
   rv = GetCharValue("hostname", aResult);
-  if (aResult.FindChar(':') != -1)
+  if (aResult.CountChar(':') == 1)
   {
     // gack, we need to reformat the hostname - SetHostName will do that
     SetHostName(aResult);
     rv = GetCharValue("hostname", aResult);
   }
   return rv;
 }
 
@@ -1310,17 +1310,17 @@ nsMsgIncomingServer::GetRealHostName(nsA
   // If 'realhostname' is set (was changed) then use it, otherwise use 'hostname'
   nsresult rv;
   rv = GetCharValue("realhostname", aResult);
   NS_ENSURE_SUCCESS(rv, rv);
   
   if (aResult.IsEmpty())
     return GetHostName(aResult);
 
-  if (aResult.FindChar(':') != -1)
+  if (aResult.CountChar(':') == 1)
   {
     SetRealHostName(aResult);
     rv = GetCharValue("realhostname", aResult);
   }
 
   return rv;
 }