Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
TypeEaEnumerator Class Reference
Collaboration diagram for TypeEaEnumerator:
Collaboration graph

List of all members.

Public Member Functions

 TypeEaEnumerator ()
 ~TypeEaEnumerator ()
nsresult Init (nsLocalFile *aFile)
char * GetNext (PRUint32 *lth)

Private Attributes

char * mEaBuf
char * mpCur

Detailed Description

Definition at line 497 of file nsLocalFileOS2.cpp.

Constructor & Destructor Documentation

Definition at line 500 of file nsLocalFileOS2.cpp.

: mEaBuf(nsnull) { }

Definition at line 501 of file nsLocalFileOS2.cpp.

{ if (mEaBuf) NS_Free(mEaBuf); }

Here is the call graph for this function:

Member Function Documentation

Definition at line 549 of file nsLocalFileOS2.cpp.

    char *  result = nsnull;

    // this is a loop so we can skip invalid entries if needed;
    // normally, it will break out on the first iteration
    while (mCtr++ < mpMvh->usNumEntries) {

        // advance to the next entry
        mpCur += mLth;

        // if MVMT, ensure the datatype is OK, then advance
        // to the length field present in both formats
        if (mpMvh->usEAType == EAT_MVMT) {
            if (*((PUSHORT)mpCur) != EAT_ASCII)
            mpCur += sizeof(USHORT);

        // get the data's length, point at the data itself, then exit
        mLth = *lth = *((PUSHORT)mpCur);
        mpCur += sizeof(USHORT);
        result = mpCur;

    return result;

Definition at line 515 of file nsLocalFileOS2.cpp.

#define EABUFSIZE 512

    // provide a buffer for the results
    mEaBuf = (char*)NS_Alloc(EABUFSIZE);
    if (!mEaBuf)
        return NS_ERROR_OUT_OF_MEMORY;

    PFEA2LIST   pfea2list = (PFEA2LIST)mEaBuf;
    pfea2list->cbList = EABUFSIZE;

    // ask for the .TYPE extended attribute
    nsresult rv = aFile->GetEA(".TYPE", pfea2list);
    if (NS_FAILED(rv))
        return rv;

    // point at the data - it starts immediately after the EA's name;
    // then confirm the EA is MVMT (correct) or MVST (acceptable)
    mpMvh = (PMVHDR)&(pfea2list->list[0].szName[pfea2list->list[0].cbName+1]);
    if (mpMvh->usEAType != EAT_MVMT)
        if (mpMvh->usEAType != EAT_MVST || mpMvh->usDataType != EAT_ASCII)
            return NS_ERROR_FAILURE;

    // init the variables that tell us where we are in the lsit
    mLth = 0;
    mCtr = 0;
    mpCur = (char*)(mpMvh->usEAType == EAT_MVMT ?
                    &mpMvh->usDataType : &mpMvh->usDataLth);

    return NS_OK;

Here is the call graph for this function:

Member Data Documentation

Definition at line 511 of file nsLocalFileOS2.cpp.

char* TypeEaEnumerator::mEaBuf [private]

Definition at line 507 of file nsLocalFileOS2.cpp.

Definition at line 510 of file nsLocalFileOS2.cpp.

char* TypeEaEnumerator::mpCur [private]

Definition at line 508 of file nsLocalFileOS2.cpp.

Definition at line 509 of file nsLocalFileOS2.cpp.

The documentation for this class was generated from the following file: