Bug 78388 - Fix uses of |new nsAutoString / nsCAutoString|; (Cv1a) <nsDataObj.cpp>; r=emaijala sr=mats.palmgren

This commit is contained in:
Serge Gautherie 2008-09-06 18:24:45 +02:00
Родитель a860c3e8e8
Коммит 2c2734e433
1 изменённых файлов: 12 добавлений и 14 удалений

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

@ -368,7 +368,6 @@ nsDataObj::nsDataObj(nsIURI * uri)
m_enumFE->AddRef();
if (uri) {
// A URI was obtained, so pass this through to the DataObject
// so it can create a SourceURL for CF_HTML flavour
uri->GetSpec(mSourceURL);
@ -383,12 +382,11 @@ nsDataObj::nsDataObj(nsIURI * uri)
nsDataObj::~nsDataObj()
{
NS_IF_RELEASE(mTransferable);
PRInt32 i;
for (i=0;i<mDataFlavors->Count();i++) {
nsCAutoString* df = reinterpret_cast<nsCAutoString *>(mDataFlavors->ElementAt(i));
for (PRInt32 i = 0; i < mDataFlavors->Count(); ++i) {
nsCString* df = reinterpret_cast<nsCString *>(mDataFlavors->ElementAt(i));
delete df;
}
delete mDataFlavors;
m_cRef = 0;
@ -496,7 +494,7 @@ STDMETHODIMP nsDataObj::GetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
FORMATETC fe;
m_enumFE->Reset();
while (NOERROR == m_enumFE->Next(1, &fe, &count)) {
nsCAutoString * df = reinterpret_cast<nsCAutoString*>(mDataFlavors->SafeElementAt(dfInx));
nsCString * df = reinterpret_cast<nsCString*>(mDataFlavors->SafeElementAt(dfInx));
if ( df ) {
if (FormatsMatch(fe, *pFE)) {
pSTM->pUnkForRelease = NULL; // caller is responsible for deleting this data
@ -1441,25 +1439,25 @@ CLSID nsDataObj::GetClassID() const
}
//-----------------------------------------------------
// Registers a the DataFlavor/FE pair
// Registers the DataFlavor/FE pair.
//-----------------------------------------------------
void nsDataObj::AddDataFlavor(const char* aDataFlavor, LPFORMATETC aFE)
{
// These two lists are the mapping to and from data flavors and FEs
// Later, OLE will tell us it's needs a certain type of FORMATETC (text, unicode, etc)
// so we will look up data flavor that corresponds to the FE
// and then ask the transferable for that type of data
// These two lists are the mapping to and from data flavors and FEs.
// Later, OLE will tell us it needs a certain type of FORMATETC (text,
// unicode, etc), so we will look up the data flavor that corresponds to
// the FE and then ask the transferable for that type of data.
// Just ignore the CF_HDROP here
// all file drags are now hangled by CFSTR_FileContents format
#ifndef WINCE
// Just ignore the CF_HDROP here
// all file drags are now handled by CFSTR_FileContents format
if (aFE->cfFormat == CF_HDROP) {
return;
}
else
#endif
{
mDataFlavors->AppendElement(new nsCAutoString(aDataFlavor));
mDataFlavors->AppendElement(new nsCString(aDataFlavor));
m_enumFE->AddFE(aFE);
}
}