nsString updates --> nsString(eOneByte) --> nsCString

This commit is contained in:
mscott%netscape.com 1999-08-25 23:20:10 +00:00
Родитель 87085548ea
Коммит 8309a0f824
8 изменённых файлов: 33 добавлений и 39 удалений

Просмотреть файл

@ -489,16 +489,16 @@ NS_IMETHODIMP nsImapMailFolder::CreateClientSubfolderInfo(const char *folderName
if(NS_FAILED(rv))
return rv;
nsAutoString leafName (folderName, eOneByte);
nsString folderNameStr;
nsString parentName = leafName;
nsAutoString leafName (folderName);
nsAutoString folderNameStr;
nsAutoString parentName = leafName;
PRInt32 folderStart = leafName.FindChar('/');
if (folderStart > 0)
{
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
nsCOMPtr<nsIRDFResource> res;
nsCOMPtr<nsIMsgImapMailFolder> parentFolder;
nsAutoString uri ((const char *) mURI, eOneByte);
nsCAutoString uri (mURI);
parentName.Right(leafName, leafName.Length() - folderStart - 1);
parentName.Truncate(folderStart);
path += parentName;
@ -506,12 +506,12 @@ NS_IMETHODIMP nsImapMailFolder::CreateClientSubfolderInfo(const char *folderName
if (NS_FAILED(rv)) return rv;
uri.Append('/');
uri.Append(parentName);
rv = rdf->GetResource(uri.GetBuffer(),
rv = rdf->GetResource(uri,
getter_AddRefs(res));
if (NS_FAILED(rv)) return rv;
parentFolder = do_QueryInterface(res, &rv);
if (NS_FAILED(rv)) return rv;
return parentFolder->CreateClientSubfolderInfo(leafName.GetBuffer());
return parentFolder->CreateClientSubfolderInfo(nsCAutoString(leafName));
}
folderNameStr = leafName;
@ -1202,7 +1202,7 @@ NS_IMETHODIMP nsImapMailFolder::PossibleImapMailbox(
return rv;
nsAutoString folderName = aSpec->allocatedPathName;
nsAutoString uri ((const char *)"", eOneByte);
nsCAutoString uri;
uri.Append(kImapRootURI);
uri.Append('/');
@ -1224,7 +1224,7 @@ NS_IMETHODIMP nsImapMailFolder::PossibleImapMailbox(
#endif
nsCOMPtr<nsIRDFResource> res;
rv = rdf->GetResource(uri.GetBuffer(), getter_AddRefs(res));
rv = rdf->GetResource(uri, getter_AddRefs(res));
if (NS_FAILED(rv))
return rv;
// OK, this is purely temporary - we either need getParent, or
@ -1244,7 +1244,7 @@ NS_IMETHODIMP nsImapMailFolder::PossibleImapMailbox(
uri.Append('/');
uri.Append(aSpec->allocatedPathName);
a_nsIFolder->GetChildWithURI(uri.GetBuffer(), PR_TRUE, getter_AddRefs(child));
a_nsIFolder->GetChildWithURI(uri, PR_TRUE, getter_AddRefs(child));
if (child)
found = PR_TRUE;
@ -1902,7 +1902,7 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, PRBool *app
{
PRUint32 msgFlags;
nsMsgKey msgKey;
nsString trashNameVal(eOneByte);
nsCAutoString trashNameVal;
msgHdr->GetFlags(&msgFlags);
msgHdr->GetMessageKey(&msgKey);
@ -1923,8 +1923,8 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, PRBool *app
// so we use an nsString from above.
PRUnichar *folderName = nsnull;
rv = mailTrash->GetName(&folderName);
trashNameVal = folderName;
PR_FREEIF(folderName);
trashNameVal = nsCAutoString(folderName);
nsCRT::free(folderName);
value = (void *) trashNameVal.GetBuffer();
}

Просмотреть файл

@ -66,10 +66,10 @@ nsresult nsImapMessage::GetFolderFromURI(nsIMsgFolder **folder)
if(NS_SUCCEEDED( rv = QueryInterface(nsIRDFResource::GetIID(), (void**)&resource)))
{
resource->GetValue( getter_Copies(uri) );
nsString messageFolderURIStr;
nsCAutoString messageFolderURIStr;
nsMsgKey key;
nsParseImapMessageURI(uri, messageFolderURIStr, &key);
nsString folderOnly, folderURIStr;
nsCAutoString folderOnly, folderURIStr;
if (messageFolderURIStr.Find(kImapRootURI) != ((PRInt32)-1))
{
@ -77,7 +77,7 @@ nsresult nsImapMessage::GetFolderFromURI(nsIMsgFolder **folder)
folderURIStr = kImapRootURI;
folderURIStr+= folderOnly;
nsIRDFResource *folderResource;
char *folderURI = folderURIStr.ToNewCString();
const char *folderURI = folderURIStr.GetBuffer();
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
if (NS_SUCCEEDED(rv)) // always check this before proceeding
@ -89,9 +89,6 @@ nsresult nsImapMessage::GetFolderFromURI(nsIMsgFolder **folder)
NS_RELEASE(folderResource);
}
}
delete[] folderURI;
}
NS_RELEASE(resource);

Просмотреть файл

@ -174,7 +174,7 @@ NS_IMETHODIMP nsImapProtocol::QueryInterface(const nsIID &aIID, void** aInstance
}
nsImapProtocol::nsImapProtocol() :
m_currentCommand(""),m_parser(*this), m_flagState(kImapFlagAndUidStateSize, PR_FALSE)
m_parser(*this), m_flagState(kImapFlagAndUidStateSize, PR_FALSE)
{
NS_INIT_REFCNT();
m_flags = 0;
@ -6006,8 +6006,7 @@ nsImapProtocol::GetDeleteIsMoveToTrash()
return rv;
}
nsIMAPMailboxInfo::nsIMAPMailboxInfo(const char *name, char delimiter) :
m_mailboxName("")
nsIMAPMailboxInfo::nsIMAPMailboxInfo(const char *name, char delimiter)
{
m_mailboxName = name;
m_delimiter = delimiter;

Просмотреть файл

@ -249,13 +249,13 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
nsString folderURI ("",eOneByte);
nsCAutoString folderURI;
nsMsgKey msgKey;
rv = nsParseImapMessageURI(aMessageURI, folderURI, &msgKey);
if (NS_SUCCEEDED(rv))
{
nsIRDFResource* res;
rv = rdf->GetResource(folderURI.GetBuffer(), &res);
rv = rdf->GetResource(folderURI, &res);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
@ -265,12 +265,12 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
imapMessageSink(do_QueryInterface(res, &rv));
if (NS_SUCCEEDED(rv))
{
nsCString messageIdString;
nsCAutoString messageIdString;
messageIdString.Append(msgKey, 10);
rv = FetchMessage(queue, folder, imapMessageSink,
aUrlListener, aURL, aDisplayConsumer,
messageIdString.GetBuffer(), PR_TRUE);
messageIdString, PR_TRUE);
}
}
}
@ -302,13 +302,13 @@ nsImapService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListener *
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsString folderURI ("",eOneByte);
nsCAutoString folderURI;
nsMsgKey msgKey;
rv = nsParseImapMessageURI(aSrcMailboxURI, folderURI, &msgKey);
if (NS_SUCCEEDED(rv))
{
nsIRDFResource* res;
rv = rdf->GetResource(folderURI.GetBuffer(), &res);
rv = rdf->GetResource(folderURI, &res);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
@ -323,14 +323,14 @@ nsImapService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListener *
messageIdString.Append(msgKey, 10);
rv = FetchMessage(queue, folder, imapMessageSink,
aUrlListener, aURL, streamSupport,
messageIdString.GetBuffer(), PR_TRUE);
messageIdString, PR_TRUE);
if (NS_SUCCEEDED(rv) && moveMessage)
{
// ** jt -- this really isn't an optimal way of deleting a
// list of messages but I don't have a better way at this
// moment
rv = AddMessageFlags(queue, folder, aUrlListener, nsnull,
messageIdString.GetBuffer(),
messageIdString,
kImapMsgDeletedFlag,
PR_TRUE);
// ** jt -- force to update the folder

Просмотреть файл

@ -25,7 +25,6 @@
static NS_DEFINE_CID(kCImapService, NS_IMAPSERVICE_CID);
nsImapMoveCopyMsgTxn::nsImapMoveCopyMsgTxn() :
m_srcMsgIdString(""), m_dstMsgIdString(""),
m_idsAreUids(PR_FALSE), m_isMove(PR_FALSE), m_srcIsPop3(PR_FALSE)
{
}
@ -35,7 +34,6 @@ nsImapMoveCopyMsgTxn::nsImapMoveCopyMsgTxn(
const char* srcMsgIdString, nsIMsgFolder* dstFolder,
PRBool idsAreUids, PRBool isMove,
nsIEventQueue* eventQueue, nsIUrlListener* urlListener) :
m_srcMsgIdString("", eOneByte), m_dstMsgIdString("", eOneByte),
m_idsAreUids(PR_FALSE), m_isMove(PR_FALSE), m_srcIsPop3(PR_FALSE)
{
Init(srcFolder, srcKeyArray, srcMsgIdString, dstFolder, idsAreUids,
@ -162,7 +160,7 @@ nsImapMoveCopyMsgTxn::Undo(void)
do_QueryInterface(m_srcFolder, &rv);
rv = imapService->SubtractMessageFlags(
m_eventQueue, m_srcFolder, srcListener, nsnull,
m_srcMsgIdString.GetBuffer(), kImapMsgDeletedFlag,
m_srcMsgIdString, kImapMsgDeletedFlag,
m_idsAreUids);
if (NS_SUCCEEDED(rv))
rv = imapService->SelectFolder(m_eventQueue, m_srcFolder,
@ -204,7 +202,7 @@ nsImapMoveCopyMsgTxn::Redo(void)
do_QueryInterface(m_srcFolder, &rv);
rv = imapService->AddMessageFlags(m_eventQueue, m_srcFolder,
srcListener, nsnull,
m_srcMsgIdString.GetBuffer(),
m_srcMsgIdString,
kImapMsgDeletedFlag,
m_idsAreUids);
if (NS_SUCCEEDED(rv))

Просмотреть файл

@ -73,10 +73,10 @@ private:
nsCOMPtr<nsIMsgFolder> m_srcFolder;
nsMsgKeyArray m_srcKeyArray;
nsString m_srcMsgIdString;
nsCString m_srcMsgIdString;
nsCOMPtr<nsIMsgFolder> m_dstFolder;
nsMsgKeyArray m_dstKeyArray;
nsString m_dstMsgIdString;
nsCString m_dstMsgIdString;
nsCOMPtr<nsIEventQueue> m_eventQueue;
nsCOMPtr<nsIUrlListener> m_urlListener;
nsString m_undoString;

Просмотреть файл

@ -232,19 +232,19 @@ nsURI2ProtocolType(const char* uriStr, nsString& type)
}
/* parses ImapMessageURI */
nsresult nsParseImapMessageURI(const char* uri, nsString& folderURI, PRUint32 *key)
nsresult nsParseImapMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key)
{
if(!key)
return NS_ERROR_NULL_POINTER;
nsAutoString uriStr = uri;
nsCAutoString uriStr = uri;
PRInt32 keySeparator = uriStr.FindChar('#');
if(keySeparator != -1)
{
nsAutoString folderPath;
uriStr.Left(folderURI, keySeparator);
folderURI.Cut(4, 8); // cut out the _message part of imap_message:
nsAutoString keyStr;
nsCAutoString keyStr;
uriStr.Right(keyStr, uriStr.Length() - (keySeparator + 1));
PRInt32 errorCode;
*key = keyStr.ToInteger(&errorCode);

Просмотреть файл

@ -48,7 +48,7 @@ extern nsresult
nsURI2ProtocolType(const char* uriStr, nsString& type);
extern nsresult
nsParseImapMessageURI(const char* uri, nsString& folderURI, PRUint32 *key);
nsParseImapMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key);
extern nsresult
nsBuildImapMessageURI(const char *baseURI, PRUint32 key, char **uri);