fix warnings. use nsCOMPtr
This commit is contained in:
Родитель
dcd3528312
Коммит
e338d0d8ee
|
@ -974,7 +974,7 @@ nsNNTPHost::AddGroup(const char *name,
|
|||
printf("nsNNTPHost::AddGroup(%s)\n",name);
|
||||
#endif
|
||||
nsINNTPNewsgroup *newsInfo = nsnull;
|
||||
nsINNTPCategoryContainer *categoryContainer = nsnull;
|
||||
nsCOMPtr <nsINNTPCategoryContainer> categoryContainer;
|
||||
char* containerName = nsnull;
|
||||
PRBool needpaneupdate = PR_FALSE;
|
||||
PRBool isSubscribed=FALSE;
|
||||
|
@ -993,7 +993,7 @@ nsNNTPHost::AddGroup(const char *name,
|
|||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = newsInfo->QueryInterface(nsINNTPCategoryContainer::GetIID(),
|
||||
(void **)&categoryContainer);
|
||||
getter_AddRefs(categoryContainer));
|
||||
|
||||
// if we're not subscribed to container, do that instead.
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -1149,7 +1149,6 @@ nsNNTPHost::AddGroup(const char *name,
|
|||
|
||||
DONE:
|
||||
|
||||
NS_IF_RELEASE(categoryContainer);
|
||||
|
||||
if (containerName) delete [] containerName;
|
||||
if (_retval) *_retval = newsInfo;
|
||||
|
|
|
@ -156,9 +156,9 @@ nsNNTPNewsgroupList::GetDatabase(const char *uri, nsIMsgDatabase **db)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsresult newsDBOpen = NS_OK;
|
||||
nsIMsgDatabase *newsDBFactory = nsnull;
|
||||
nsCOMPtr <nsIMsgDatabase> newsDBFactory;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kCNewsDB, nsnull, nsIMsgDatabase::GetIID(), (void **) &newsDBFactory);
|
||||
rv = nsComponentManager::CreateInstance(kCNewsDB, nsnull, nsIMsgDatabase::GetIID(), getter_AddRefs(newsDBFactory));
|
||||
if (NS_SUCCEEDED(rv) && newsDBFactory) {
|
||||
nsCOMPtr <nsIFileSpec> dbFileSpec;
|
||||
NS_NewFileSpecWithSpec(path, getter_AddRefs(dbFileSpec));
|
||||
|
@ -171,8 +171,6 @@ nsNNTPNewsgroupList::GetDatabase(const char *uri, nsIMsgDatabase **db)
|
|||
printf ("newsDBFactory->Open() failed\n");
|
||||
}
|
||||
#endif /* DEBUG_NEWS */
|
||||
NS_RELEASE(newsDBFactory);
|
||||
newsDBFactory = nsnull;
|
||||
return rv;
|
||||
}
|
||||
#ifdef DEBUG_NEWS
|
||||
|
@ -226,8 +224,8 @@ nsNNTPNewsgroupList::GetRangeOfArtsToDownload(
|
|||
}
|
||||
|
||||
m_set->SetLastMember(last_possible); // make sure highwater mark is valid.
|
||||
nsIDBFolderInfo *newsGroupInfo = nsnull;
|
||||
rv = m_newsDB->GetDBFolderInfo(&newsGroupInfo);
|
||||
nsCOMPtr <nsIDBFolderInfo> newsGroupInfo;
|
||||
rv = m_newsDB->GetDBFolderInfo(getter_AddRefs(newsGroupInfo));
|
||||
if (NS_SUCCEEDED(rv) && newsGroupInfo)
|
||||
{
|
||||
nsAutoString knownArtsString (eOneByte);
|
||||
|
@ -441,7 +439,8 @@ nsNNTPNewsgroupList::AddToKnownArticles(PRInt32 first, PRInt32 last)
|
|||
nsString str(output);
|
||||
newsGroupInfo->SetKnownArtsSet(&str);
|
||||
}
|
||||
delete[] output;
|
||||
delete [] output;
|
||||
output = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,7 +549,7 @@ nsresult
|
|||
nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIMsgDBHdr *newMsgHdr = nsnull;
|
||||
nsCOMPtr <nsIMsgDBHdr> newMsgHdr;
|
||||
|
||||
if (!line || !message_number) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -572,10 +571,8 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
|
|||
if (atol(line) == 0) /* bogus xover data */
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
m_newsDB->CreateNewHdr(*message_number, &newMsgHdr);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
m_newsDB->CreateNewHdr(*message_number, getter_AddRefs(newMsgHdr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
GET_TOKEN (); /* subject */
|
||||
if (line)
|
||||
|
@ -592,14 +589,18 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
|
|||
// use OrFlags()?
|
||||
// I don't think I need to get flags, since
|
||||
// this is a new header.
|
||||
(void)newMsgHdr->GetFlags(&flags);
|
||||
(void)newMsgHdr->SetFlags(flags | MSG_FLAG_HAS_RE);
|
||||
rv = newMsgHdr->GetFlags(&flags);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = newMsgHdr->SetFlags(flags | MSG_FLAG_HAS_RE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("subject = %s\n",subject);
|
||||
#endif
|
||||
newMsgHdr->SetSubject(subject);
|
||||
rv = newMsgHdr->SetSubject(subject);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
}
|
||||
|
||||
GET_TOKEN (); /* author */
|
||||
|
@ -607,7 +608,8 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
|
|||
#ifdef DEBUG_spitzer
|
||||
printf("author = %s\n", line);
|
||||
#endif
|
||||
newMsgHdr->SetAuthor(line);
|
||||
rv = newMsgHdr->SetAuthor(line);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
GET_TOKEN ();
|
||||
|
@ -626,7 +628,8 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
|
|||
#ifdef DEBUG_NEWS
|
||||
printf("date = %s, %ld\n", line, resDate);
|
||||
#endif
|
||||
newMsgHdr->SetDate(resDate); /* date */
|
||||
rv = newMsgHdr->SetDate(resDate); /* date */
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,7 +648,8 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
|
|||
if (*lastChar == '>')
|
||||
*lastChar = '\0';
|
||||
|
||||
newMsgHdr->SetMessageId(strippedId);
|
||||
rv = newMsgHdr->SetMessageId(strippedId);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
GET_TOKEN (); /* references */
|
||||
|
@ -653,7 +657,8 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
|
|||
#ifdef DEBUG_NEWS
|
||||
printf("references = %s\n",line);
|
||||
#endif
|
||||
newMsgHdr->SetReferences(line);
|
||||
rv = newMsgHdr->SetReferences(line);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
GET_TOKEN (); /* bytes */
|
||||
|
@ -664,7 +669,8 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
|
|||
#ifdef DEBUG_NEWS
|
||||
printf("bytes = %d\n", msgSize);
|
||||
#endif
|
||||
newMsgHdr->SetMessageSize(msgSize);
|
||||
rv = newMsgHdr->SetMessageSize(msgSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
GET_TOKEN (); /* lines */
|
||||
|
@ -674,18 +680,15 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number)
|
|||
#ifdef DEBUG_NEWS
|
||||
printf("lines = %d\n", numLines);
|
||||
#endif
|
||||
newMsgHdr->SetLineCount(numLines);
|
||||
rv = newMsgHdr->SetLineCount(numLines);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
GET_TOKEN (); /* xref */
|
||||
|
||||
rv = m_newsDB->AddNewHdrToDB(newMsgHdr, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_IF_RELEASE(newMsgHdr);
|
||||
newMsgHdr = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -701,11 +704,14 @@ nsNNTPNewsgroupList::ProcessXOVERLINE(const char *line, PRUint32 *status)
|
|||
if (!line)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (m_newsDB != nsnull)
|
||||
if (m_newsDB)
|
||||
{
|
||||
char *xoverline = PL_strdup(line);
|
||||
if (!xoverline) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = ParseLine(xoverline, &message_number);
|
||||
PL_strfree(xoverline);
|
||||
xoverline = nsnull;
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
@ -799,7 +805,7 @@ nsresult
|
|||
nsNNTPNewsgroupList::ProcessNonXOVER (const char * /*line*/)
|
||||
{
|
||||
// ### dmb write me
|
||||
return NS_OK;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -829,7 +835,7 @@ nsNNTPNewsgroupList::FinishXOVERLINE(int status, int *newstatus)
|
|||
|
||||
k = &m_knownArts;
|
||||
|
||||
if (k == nsnull) {
|
||||
if (!k) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
|
|
|
@ -1888,10 +1888,9 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommandResponse()
|
|||
char outputBuffer[OUTPUT_BUFFER_SIZE];
|
||||
|
||||
m_tempErrorFile.Delete(PR_FALSE);
|
||||
nsISupports * supports;
|
||||
NS_NewIOFileStream(&supports, m_tempErrorFile, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 00700);
|
||||
nsCOMPtr <nsISupports> supports;
|
||||
NS_NewIOFileStream(getter_AddRefs(supports), m_tempErrorFile, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 00700);
|
||||
m_tempErrorStream = do_QueryInterface(supports);
|
||||
NS_IF_RELEASE(supports);
|
||||
|
||||
if (m_newsgroup) {
|
||||
rv = m_newsgroup->GetName(&group_name);
|
||||
|
@ -2062,10 +2061,9 @@ PRInt32 nsNNTPProtocol::BeginArticle()
|
|||
|
||||
// we are about to display an article so open up a temp file on the article...
|
||||
m_tempArticleFile.Delete(PR_FALSE);
|
||||
nsISupports * supports;
|
||||
NS_NewIOFileStream(&supports, m_tempArticleFile, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 00700);
|
||||
nsCOMPtr <nsISupports> supports;
|
||||
NS_NewIOFileStream(getter_AddRefs(supports), m_tempArticleFile, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 00700);
|
||||
m_tempArticleStream = do_QueryInterface(supports);
|
||||
NS_IF_RELEASE(supports);
|
||||
m_nextState = NNTP_READ_ARTICLE;
|
||||
|
||||
return 0;
|
||||
|
@ -3931,7 +3929,7 @@ PRInt32 nsNNTPProtocol::Cancel()
|
|||
rv = m_runningURL->GetNewsgroupName(&newsgroupname);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && newsgroupname && (key != nsMsgKey_None), "need more to remove this message from the db");
|
||||
if ((key != nsMsgKey_None) && (newsgroupname)) {
|
||||
printf("delete %lu from %s\n",key,newsgroupname);
|
||||
printf("delete %u from %s\n",key,newsgroupname);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -65,8 +65,8 @@ nsresult nsNewsMessage::GetFolderFromURI(nsIMsgFolder **folder)
|
|||
{
|
||||
nsresult rv;
|
||||
nsXPIDLCString uri;
|
||||
nsIRDFResource *resource;
|
||||
if(NS_SUCCEEDED( rv = QueryInterface(nsIRDFResource::GetIID(), (void**)&resource)))
|
||||
nsCOMPtr <nsIRDFResource> resource;
|
||||
if(NS_SUCCEEDED( rv = QueryInterface(nsIRDFResource::GetIID(), getter_AddRefs(resource))))
|
||||
{
|
||||
resource->GetValue( getter_Copies(uri) );
|
||||
nsString messageFolderURIStr;
|
||||
|
@ -78,21 +78,18 @@ nsresult nsNewsMessage::GetFolderFromURI(nsIMsgFolder **folder)
|
|||
messageFolderURIStr.Right(folderOnly, messageFolderURIStr.Length() - kNewsMessageRootURILen);
|
||||
folderURIStr = kNewsRootURI;
|
||||
folderURIStr+= folderOnly;
|
||||
nsIRDFResource *folderResource;
|
||||
nsCOMPtr <nsIRDFResource> folderResource;
|
||||
|
||||
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) // always check this before proceeding
|
||||
{
|
||||
rv = rdfService->GetResource(folderURIStr.GetBuffer(), &folderResource);
|
||||
rv = rdfService->GetResource(folderURIStr.GetBuffer(), getter_AddRefs(folderResource));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = NS_SUCCEEDED(folderResource->QueryInterface(nsIMsgFolder::GetIID(), (void**)folder));
|
||||
NS_RELEASE(folderResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(resource);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -466,7 +466,7 @@ nsresult
|
|||
nsNntpService::RunNewsUrl(nsString& urlString, nsString &newsgroupName, nsMsgKey key, nsISupports * aConsumer, nsIUrlListener *aUrlListener, nsIURI **_retval)
|
||||
{
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("nsNntpService::RunNewsUrl(%s,%s,%lu,...)\n", (const char *)nsAutoCString(urlString), (const char *)nsAutoCString(newsgroupName), key);
|
||||
printf("nsNntpService::RunNewsUrl(%s,%s,%u,...)\n", (const char *)nsAutoCString(urlString), (const char *)nsAutoCString(newsgroupName), key);
|
||||
#endif
|
||||
|
||||
nsCOMPtr <nsINntpUrl> nntpUrl;
|
||||
|
|
Загрузка…
Ссылка в новой задаче