зеркало из https://github.com/mozilla/pjs.git
use #define instead of doing PL_strlen
This commit is contained in:
Родитель
789dc3784a
Коммит
557e810976
|
@ -141,19 +141,17 @@ PRBool
|
|||
nsMsgNewsFolder::isNewsHost()
|
||||
{
|
||||
// this will do for now. Eventually, this will go away...
|
||||
|
||||
PRInt32 rootURIlen = PL_strlen(kNewsRootURI);
|
||||
PRInt32 mURIlen = PL_strlen(mURI);
|
||||
|
||||
// if we are shorter than news://, we are too short to be a host
|
||||
if (mURIlen <= rootURIlen) {
|
||||
if (mURIlen <= kNewsRootURILen) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (PL_strncmp(mURI, kNewsRootURI, rootURIlen) == 0) {
|
||||
if (PL_strncmp(mURI, kNewsRootURI, kNewsRootURILen) == 0) {
|
||||
// if we get here, mURI looks like this: news://x
|
||||
// where x is non-empty, and may contain "/"
|
||||
char *rightAfterTheRoot = mURI+rootURIlen+1;
|
||||
char *rightAfterTheRoot = mURI+kNewsRootURILen+1;
|
||||
#ifdef DEBUG_sspitzer_
|
||||
printf("search for a slash in %s\n",rightAfterTheRoot);
|
||||
#endif
|
||||
|
@ -334,7 +332,7 @@ nsMsgNewsFolder::CreateSubFolders(nsFileSpec &path)
|
|||
// news://foobar
|
||||
// all we want is foobar
|
||||
// so skip over news:// (a.k.a. kNewsRootURI)
|
||||
newshostname = PR_smprintf("%s", mURI + PL_strlen(kNewsRootURI) + 1);
|
||||
newshostname = PR_smprintf("%s", mURI + kNewsRootURILen + 1);
|
||||
if (newshostname == nsnull) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -373,10 +371,7 @@ nsresult nsMsgNewsFolder::AddSubfolder(nsAutoString name, nsIMsgFolder **child)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsIRDFService* rdf;
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
nsIRDFService::GetIID(),
|
||||
(nsISupports**)&rdf);
|
||||
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -404,7 +399,6 @@ nsresult nsMsgNewsFolder::AddSubfolder(nsAutoString name, nsIMsgFolder **child)
|
|||
mSubFolders->AppendElement(folder);
|
||||
*child = folder;
|
||||
NS_ADDREF(*child);
|
||||
(void)nsServiceManager::ReleaseService(kRDFServiceCID, rdf);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ nsresult nsNewsMessage::GetFolderFromURI(nsIMsgFolder **folder)
|
|||
nsString folderOnly, folderURIStr;
|
||||
|
||||
if (messageFolderURIStr.Find(kNewsMessageRootURI) != ((PRInt32)-1)) {
|
||||
messageFolderURIStr.Right(folderOnly, messageFolderURIStr.Length() -nsCRT::strlen(kNewsMessageRootURI));
|
||||
messageFolderURIStr.Right(folderOnly, messageFolderURIStr.Length() - kNewsMessageRootURILen);
|
||||
folderURIStr = kNewsRootURI;
|
||||
folderURIStr+= folderOnly;
|
||||
nsIRDFResource *folderResource;
|
||||
|
|
|
@ -95,7 +95,7 @@ nsNewsURI2Path(const char* rootURI, const char* uriStr, nsFileSpec& pathResult)
|
|||
}
|
||||
|
||||
// the server name is the first component of the path, so extract it out
|
||||
PRInt32 hostStart;
|
||||
PRInt32 hostStart = 0;
|
||||
|
||||
hostStart = uri.Find('/');
|
||||
if (hostStart <= 0) return NS_ERROR_FAILURE;
|
||||
|
@ -202,7 +202,7 @@ nsresult nsBuildNewsMessageURI(const char *baseURI, PRUint32 key, char** uri)
|
|||
|
||||
// chop off news:/
|
||||
if (tailURI.Find(kNewsRootURI) == 0)
|
||||
tailURI.Cut(0, PL_strlen(kNewsRootURI));
|
||||
tailURI.Cut(0, kNewsRootURILen);
|
||||
|
||||
const char *tail = tailURI.ToNewCString();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче