From 241c136c3351f3b7cb2a4c10371d41c6666dab02 Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Thu, 13 May 1999 05:28:31 +0000 Subject: [PATCH] Fixed mac and linux uses of Count git-svn-id: svn://10.0.0.236/trunk@31414 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/gtk/nsClipboard.cpp | 5 ++++- mozilla/widget/src/mac/nsClipboard.cpp | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mozilla/widget/src/gtk/nsClipboard.cpp b/mozilla/widget/src/gtk/nsClipboard.cpp index a186c29e8a7..9b1eb8393bd 100644 --- a/mozilla/widget/src/gtk/nsClipboard.cpp +++ b/mozilla/widget/src/gtk/nsClipboard.cpp @@ -326,7 +326,10 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable) // Walk through flavors and see which flavor matches the one being pasted: PRUint32 i; - for (i=0;iCount();i++) { + PRUint32 cnt = 0; + nsresult rv = dfList->Count(&cnt); + NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed"); + for (i=0;iElementAt(i); if (NS_OK == supports->QueryInterface(kIDataFlavorIID, (void **)&df)) { diff --git a/mozilla/widget/src/mac/nsClipboard.cpp b/mozilla/widget/src/mac/nsClipboard.cpp index 18cb2b57d3f..f6230c7284f 100644 --- a/mozilla/widget/src/mac/nsClipboard.cpp +++ b/mozilla/widget/src/mac/nsClipboard.cpp @@ -122,7 +122,10 @@ nsClipboard :: SetNativeClipboardData() // converter knows about) put it on the clipboard. Luckily, GetTransferData() // handles conversions for us, so we really don't need to know if a conversion // is required or not. - for ( int i = 0; i < flavorList->Count(); ++i ) { + PRUint32 cnt = 0; + nsresult rv = flavorList->Count(&cnt); + NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed"); + for ( int i = 0; i < cnt; ++i ) { nsCOMPtr temp = getter_AddRefs(flavorList->ElementAt(i)); nsCOMPtr currentFlavor ( do_QueryInterface(temp) ); if ( currentFlavor ) { @@ -181,7 +184,10 @@ nsClipboard :: GetNativeClipboardData(nsITransferable * aTransferable) // Now walk down the list of flavors. When we find one that is actually on the // clipboard, copy out the data into the transferable in that format. SetTransferData() // implicitly handles conversions. - for ( int i = 0; i < flavorList->Count(); ++i ) { + PRUint32 cnt = 0; + nsresult rv = flavorList->Count(&cnt); + NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed"); + for ( int i = 0; i < cnt; ++i ) { nsCOMPtr temp = getter_AddRefs(flavorList->ElementAt(i)); nsCOMPtr currentFlavor ( do_QueryInterface(temp) ); if ( currentFlavor ) {