IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 5, 2005, 5:04:35 PM (21 years ago)
Author:
drobbin
Message:

made changes based on revisions in psLib SDRS rev. 15

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psMetadata.c

    r4401 r4457  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2005-06-27 20:38:12 $
     14*  @version $Revision: 1.70 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2005-07-06 03:04:35 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    122122    psFree(iter->iter);
    123123
    124     if (iter->preg != NULL) {
    125         regfree(iter->preg);
     124    if (iter->regex != NULL) {
     125        regfree(iter->regex);
    126126    }
    127127}
     
    268268}
    269269
    270 bool psMetadataAddItem(psMetadata *md, const psMetadataItem *item, psS32 location, psS32 flags)
     270bool psMetadataAddItem(psMetadata *md, const psMetadataItem *item, long location, psS32 flags)
    271271{
    272272    char * key = NULL;
     
    360360}
    361361
    362 bool psMetadataAdd(psMetadata *md, int location, const char *name,
     362bool psMetadataAdd(psMetadata *md, long location, const char *name,
    363363                   int format, const char *comment, ...)
    364364{
     
    372372}
    373373
    374 bool psMetadataAddV(psMetadata *md, int location, const char *name,
     374bool psMetadataAddV(psMetadata *md, long location, const char *name,
    375375                    int format, const char *comment, va_list list)
    376376{
     
    391391
    392392#define METADATA_ADD_TYPE(NAME,TYPE,METATYPE) \
    393 psBool psMetadataAdd##NAME(psMetadata* md, psS32 where, const char* name, \
     393psBool psMetadataAdd##NAME(psMetadata* md, long where, const char* name, \
    394394                           const char* comment, TYPE value) { \
    395395    return psMetadataAdd(md,where,name, METATYPE,comment,value); \
     
    409409METADATA_ADD_TYPE(Array,psArray*,PS_META_ARRAY)
    410410
    411 psBool psMetadataRemove(psMetadata *md, psS32 where, const char *key)
     411psBool psMetadataRemove(psMetadata *md, long where, const char *key)
    412412{
    413413    PS_ASSERT_PTR_NON_NULL(md,NULL);
     
    580580psMetadataLookupNumTYPE(Bool)
    581581
    582 psMetadataItem* psMetadataGet(const psMetadata *md, int location)
     582psMetadataItem* psMetadataGet(const psMetadata *md, long location)
    583583{
    584584    psMetadataItem* entry = NULL;
     
    597597
    598598psMetadataIterator* psMetadataIteratorAlloc(psMetadata* md,
    599         int location,
     599        long location,
    600600        const char* regex)
    601601{
     
    604604
    605605    psMetadataIterator* newIter = psAlloc(sizeof(psMetadataIterator));
    606     newIter->preg = NULL;
     606    newIter->regex = NULL;
    607607    newIter->iter = NULL;
    608608
     
    614614        return newIter;
    615615    } else {
    616         int regRtn = regcomp(newIter->preg,regex,0);
     616        int regRtn = regcomp(newIter->regex,regex,0);
    617617        if (regRtn != 0) {
    618618            char errMsg[256];
    619             regerror(regRtn, newIter->preg, errMsg, 256);
    620             regfree(newIter->preg);
     619            regerror(regRtn, newIter->regex, errMsg, 256);
     620            regfree(newIter->regex);
    621621            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    622622                    PS_ERRORTEXT_psMetadata_REGEX_INVALID,
     
    633633
    634634bool psMetadataIteratorSet(psMetadataIterator* iterator,
    635                            int location)
     635                           long location)
    636636{
    637637    int match;
     
    643643    PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL);
    644644
    645     regex_t* preg = iterator->preg;
     645    regex_t* regex = iterator->regex;
    646646
    647647    // handle trivial case where no regex subsetting is required.
    648     if (preg == NULL) {
     648    if (regex == NULL) {
    649649        return psListIteratorSet(iter,location);
    650650    }
     
    655655        psListIteratorSet(iter,PS_LIST_TAIL);
    656656        while ( (cursor=(psMetadataItem*)iter->cursor) != NULL) {
    657             if (regexec(preg, cursor->name, 0, NULL, 0) == 0) {
     657            if (regexec(regex, cursor->name, 0, NULL, 0) == 0) {
    658658                // this key is a match
    659659                match--;
     
    671671    psListIteratorSet(iter,PS_LIST_HEAD);
    672672    while ( (cursor=(psMetadataItem*)iter->cursor) != NULL) {
    673         if (regexec(preg, cursor->name, 0, NULL, 0) == 0) {
     673        if (regexec(regex, cursor->name, 0, NULL, 0) == 0) {
    674674            // this key is a match
    675675            match++;
     
    692692    PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL);
    693693
    694     regex_t* preg = iterator->preg;
     694    regex_t* regex = iterator->regex;
    695695
    696696    // handle trivial case where no regex subsetting is required.
    697     if (preg == NULL) {
     697    if (regex == NULL) {
    698698        return (psMetadataItem*)psListGetAndIncrement(iter);
    699699    }
     
    703703    while (psListGetAndIncrement(iter) != NULL) {
    704704        if (iter->cursor != NULL &&
    705                 regexec(preg, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
     705                regexec(regex, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
    706706            // this key is a match
    707707            break;
     
    720720    PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL);
    721721
    722     regex_t* preg = iterator->preg;
     722    regex_t* regex = iterator->regex;
    723723
    724724    // handle trivial case where no regex subsetting is required.
    725     if (preg == NULL) {
     725    if (regex == NULL) {
    726726        return (psMetadataItem*)psListGetAndDecrement(iter);
    727727    }
     
    731731    while (psListGetAndDecrement(iter) != NULL) {
    732732        if (iter->cursor != NULL &&
    733                 regexec(preg, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
     733                regexec(regex, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
    734734            // this key is a match
    735735            break;
Note: See TracChangeset for help on using the changeset viewer.