Back to index

lightning-sunbird  0.9+nobinonly
nsDirectoryIndexStream.cpp File Reference
#include "nsEscape.h"
#include "nsDirectoryIndexStream.h"
#include "nsXPIDLString.h"
#include "prio.h"
#include "prlog.h"
#include "prlong.h"
#include "nsISimpleEnumerator.h"
#include "nsICollation.h"
#include "nsILocale.h"
#include "nsILocaleService.h"
#include "nsCollationCID.h"
#include "nsIPlatformCharset.h"
#include "nsReadableUtils.h"
#include "nsURLHelper.h"
#include "nsNetUtil.h"
#include "nsCRT.h"
#include "nsNativeCharsetUtils.h"

Go to the source code of this file.


static int PR_CALLBACK compare (const void *aElement1, const void *aElement2, void *aData)

Function Documentation

static int PR_CALLBACK compare ( const void aElement1,
const void aElement2,
void aData 
) [static]

Definition at line 96 of file nsDirectoryIndexStream.cpp.

    nsIFile* a = (nsIFile*)aElement1;
    nsIFile* b = (nsIFile*)aElement2;

    if (!NS_IsNativeUTF8()) {
        // don't check for errors, because we can't report them anyway
        nsAutoString name1, name2;

        // Note - we should do the collation to do sorting. Why don't we?
        // Because that is _slow_. Using TestProtocols to list file:///dev/
        // goes from 3 seconds to 22. (This may be why nsXULSortService is
        // so slow as well).
        // Does this have bad effects? Probably, but since nsXULTree appears
        // to use the raw RDF literal value as the sort key (which ammounts to an
        // strcmp), it won't be any worse, I think.
        // This could be made faster, by creating the keys once,
        // but CompareString could still be smarter - see bug 99383 - bbaetz
        // NB - 99393 has been WONTFIXed. So if the I18N code is ever made
        // threadsafe so that this matters, we'd have to pass through a
        // struct { nsIFile*, PRUint8* } with the pre-calculated key.
        return Compare(name1, name2);

    nsCAutoString name1, name2;

    return Compare(name1, name2);

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kCollationFactoryCID  ,
) [static]