зеркало из https://github.com/mozilla/pjs.git
Bug #379070 --> remove nsCRT methods from mailnews\news.
Patch by Frank Wein <bugzilla@mcsmurf.de> sr=neil
This commit is contained in:
Родитель
db899a8bbd
Коммит
0dcbc6fdb8
|
@ -44,7 +44,6 @@
|
|||
#include "pratom.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsNewsFolder.h"
|
||||
|
|
|
@ -72,7 +72,6 @@
|
|||
#include "prmem.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
||||
#include "nsMsgDatabase.h"
|
||||
|
|
|
@ -66,8 +66,6 @@
|
|||
|
||||
#include "nsINntpUrl.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "prtime.h"
|
||||
#include "prlog.h"
|
||||
#include "prerror.h"
|
||||
|
@ -1359,9 +1357,9 @@ nsNNTPProtocol::ParseURL(nsIURI * aURL, char ** aGroup, char ** aMessageID,
|
|||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) fullPath = %s",this, fullPath.get()));
|
||||
|
||||
if (fullPath.First() == '/')
|
||||
group = nsCRT::strdup(fullPath.get()+1);
|
||||
group = NS_strdup(fullPath.get()+1);
|
||||
else
|
||||
group = nsCRT::strdup(fullPath.get());
|
||||
group = ToNewCString(fullPath);
|
||||
|
||||
// more to do here, but for now, this works.
|
||||
// only escape if we are doing a search
|
||||
|
@ -1373,7 +1371,7 @@ nsNNTPProtocol::ParseURL(nsIURI * aURL, char ** aGroup, char ** aMessageID,
|
|||
group = 0;
|
||||
}
|
||||
else if (!*group) {
|
||||
nsCRT::free(group);
|
||||
NS_Free(group);
|
||||
group = 0;
|
||||
}
|
||||
|
||||
|
@ -1400,7 +1398,7 @@ nsNNTPProtocol::ParseURL(nsIURI * aURL, char ** aGroup, char ** aMessageID,
|
|||
break;
|
||||
|
||||
if (*s) {
|
||||
command_specific_data = nsCRT::strdup (s);
|
||||
command_specific_data = NS_strdup(s);
|
||||
*s = 0;
|
||||
if (!command_specific_data) {
|
||||
status = MK_OUT_OF_MEMORY;
|
||||
|
@ -1848,7 +1846,7 @@ PRInt32 nsNNTPProtocol::GetPropertiesResponse(nsIInputStream * inputStream, PRUi
|
|||
|
||||
if ('.' != line[0])
|
||||
{
|
||||
char *propertyName = nsCRT::strdup(line);
|
||||
char *propertyName = NS_strdup(line);
|
||||
if (propertyName)
|
||||
{
|
||||
char *space = PL_strchr(propertyName, ' ');
|
||||
|
@ -2565,7 +2563,7 @@ PRInt32 nsNNTPProtocol::ReadArticle(nsIInputStream * inputStream, PRUint32 lengt
|
|||
/* Don't send content-type to mime parser if we're doing a cancel
|
||||
because it confuses mime parser into not parsing.
|
||||
*/
|
||||
if (m_typeWanted != CANCEL_WANTED || nsCRT::strncmp(outputBuffer, "Content-Type:", 13))
|
||||
if (m_typeWanted != CANCEL_WANTED || strncmp(outputBuffer, "Content-Type:", 13))
|
||||
{
|
||||
// if we are attempting to cancel, we want to snarf the headers and save the aside, which is what
|
||||
// ParseHeaderForCancel() does.
|
||||
|
@ -3138,13 +3136,11 @@ PRInt32 nsNNTPProtocol::ReadNewsList(nsIInputStream * inputStream, PRUint32 leng
|
|||
char rate_buf[RATE_STR_BUF_LEN];
|
||||
PR_snprintf(rate_buf,RATE_STR_BUF_LEN,"%.1f", rate);
|
||||
|
||||
nsAutoString rateStr;
|
||||
rateStr.Append(NS_ConvertASCIItoUTF16(rate_buf));
|
||||
|
||||
nsAutoString numGroupsStr;
|
||||
numGroupsStr.AppendInt(mNumGroupsListed);
|
||||
NS_ConvertASCIItoUTF16 rateStr(rate_buf);
|
||||
|
||||
const PRUnichar *formatStrings[3] = { numGroupsStr.get(), bytesStr.get(), rateStr.get() };
|
||||
const PRUnichar *formatStrings[3] = { numGroupsStr.get(), bytesStr.get(), rateStr.get()};
|
||||
rv = bundle->FormatStringFromName(NS_LITERAL_STRING("bytesReceived").get(),
|
||||
formatStrings, 3,
|
||||
getter_Copies(statusString));
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsNewsDownloadDialogArgs.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsNewsDownloadDialogArgs::nsNewsDownloadDialogArgs()
|
||||
|
|
|
@ -1252,7 +1252,7 @@ nsNntpIncomingServer::HandleLine(const char* line, PRUint32 line_size)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (nsCRT::strncmp(line,"begingroups", 11) == 0) {
|
||||
if (strncmp(line,"begingroups", 11) == 0) {
|
||||
mHasSeenBeginGroups = PR_TRUE;
|
||||
}
|
||||
char*equalPos = (char *) PL_strchr(line, '=');
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsCRT.h" // for nsCRT::strtok
|
||||
#include "nsNntpService.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsILoadGroup.h"
|
||||
|
@ -225,7 +224,7 @@ nsNntpService::CreateMessageIDURL(nsIMsgFolder *folder, nsMsgKey key, char **url
|
|||
uri = rootFolderURI.get();
|
||||
uri += '/';
|
||||
uri += escapedMessageID;
|
||||
*url = nsCRT::strdup(uri.get());
|
||||
*url = ToNewCString(uri);
|
||||
|
||||
PR_FREEIF(escapedMessageID);
|
||||
|
||||
|
@ -509,7 +508,7 @@ nsNntpService::DecomposeNewsURI(const char *uri, nsIMsgFolder **folder, nsMsgKey
|
|||
{
|
||||
nsresult rv;
|
||||
// if we fix DecomposeNewsMessage to handle news message scheme, we could use it exclusively
|
||||
if (nsCRT::strncmp(uri, kNewsMessageRootURI, kNewsMessageRootURILen) == 0)
|
||||
if (strncmp(uri, kNewsMessageRootURI, kNewsMessageRootURILen) == 0)
|
||||
{
|
||||
rv = DecomposeNewsMessageURI(uri, folder, aMsgKey);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
@ -796,42 +795,33 @@ nsNntpService::GenerateNewsHeaderValsForPosting(const char *newsgroupsList, char
|
|||
// we are not going to allow the user to cross post to multiple hosts.
|
||||
// if we detect that, we stop and return error.
|
||||
|
||||
// nsCRT::strtok is going destroy what we pass to it, so we need to make a copy of newsgroupsNames.
|
||||
char *list = nsCRT::strdup(newsgroupsList);
|
||||
char *token = nsnull;
|
||||
char *rest = list;
|
||||
nsCAutoString host;
|
||||
nsCAutoString str;
|
||||
nsCAutoString newsgroups;
|
||||
|
||||
token = nsCRT::strtok(rest, ",", &rest);
|
||||
while (token && *token)
|
||||
nsCStringArray list;
|
||||
list.ParseString(newsgroupsList, ",");
|
||||
for (PRInt32 index = 0; index < list.Count(); index++)
|
||||
{
|
||||
str = token;
|
||||
str.StripWhitespace();
|
||||
|
||||
if (!str.IsEmpty())
|
||||
list[index]->StripWhitespace();
|
||||
if (!list[index]->IsEmpty())
|
||||
{
|
||||
nsCAutoString currentHost;
|
||||
nsCAutoString theRest;
|
||||
|
||||
// does str start with "news:/"?
|
||||
if (str.Find(kNewsRootURI) == 0)
|
||||
if (StringBeginsWith(*list[index], NS_LITERAL_CSTRING(kNewsRootURI)))
|
||||
{
|
||||
// we have news://group or news://host/group
|
||||
// set theRest to what's after news://
|
||||
str.Right(theRest, str.Length() - kNewsRootURILen /* for news:/ */ - 1 /* for the slash */);
|
||||
list[index]->Right(theRest, list[index]->Length() - kNewsRootURILen /* for news:/ */ - 1 /* for the slash */);
|
||||
}
|
||||
else if (str.Find(":/") != -1)
|
||||
else if (list[index]->Find(":/") != -1)
|
||||
{
|
||||
// we have x:/y where x != news. this is bad, return failure
|
||||
CRTFREEIF(list);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
theRest = str;
|
||||
}
|
||||
theRest = *list[index];
|
||||
|
||||
// theRest is "group" or "host/group"
|
||||
PRInt32 slashpos = theRest.FindChar('/');
|
||||
|
@ -847,10 +837,7 @@ nsNntpService::GenerateNewsHeaderValsForPosting(const char *newsgroupsList, char
|
|||
|
||||
NS_ASSERTION(!currentGroup.IsEmpty(), "currentGroup is empty");
|
||||
if (currentGroup.IsEmpty())
|
||||
{
|
||||
CRTFREEIF(list);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// build up the newsgroups
|
||||
if (!newsgroups.IsEmpty())
|
||||
|
@ -862,39 +849,26 @@ nsNntpService::GenerateNewsHeaderValsForPosting(const char *newsgroupsList, char
|
|||
// str is "group"
|
||||
rv = FindHostFromGroup(currentHost, str);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
CRTFREEIF(list);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// build up the newsgroups
|
||||
if (!newsgroups.IsEmpty())
|
||||
newsgroups += ",";
|
||||
newsgroups += str;
|
||||
newsgroups += *list[index];
|
||||
}
|
||||
|
||||
if (!currentHost.IsEmpty())
|
||||
{
|
||||
if (host.IsEmpty())
|
||||
{
|
||||
host = currentHost;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!host.Equals(currentHost))
|
||||
{
|
||||
CRTFREEIF(list);
|
||||
return NS_ERROR_NNTP_NO_CROSS_POSTING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
str = "";
|
||||
currentHost = "";
|
||||
}
|
||||
token = nsCRT::strtok(rest, ",", &rest);
|
||||
}
|
||||
CRTFREEIF(list);
|
||||
|
||||
*newshostHeaderVal = ToNewCString(host);
|
||||
if (!*newshostHeaderVal) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -1248,7 +1222,7 @@ NS_IMETHODIMP nsNntpService::GetNewNews(nsINntpIncomingServer *nntpServer, const
|
|||
server = do_QueryInterface(nntpServer);
|
||||
|
||||
/* double check that it is a "news:/" url */
|
||||
if (nsCRT::strncmp(uri, kNewsRootURI, kNewsRootURILen) == 0)
|
||||
if (strncmp(uri, kNewsRootURI, kNewsRootURILen) == 0)
|
||||
{
|
||||
nsCOMPtr<nsIURI> aUrl;
|
||||
rv = ConstructNntpUrl(uri, aUrlListener, aMsgWindow, nsnull, nsINntpUrl::ActionGetNewNews, getter_AddRefs(aUrl));
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
#include "prprf.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsNewsUtils.h"
|
||||
#include "nsISupportsObsolete.h"
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче