IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 29, 2008, 2:44:04 PM (18 years ago)
Author:
eugene
Message:

merge cvs HEAD into cleanup branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cleanup/ippTools/src/pxtools.h

    r18076 r18357  
    3636#include "pxfake.h"
    3737#include "pxwarp.h"
    38 #include "pxio.h"
    3938#include "pxregister.h"
    4039#include "pxtag.h"
     
    108107type var; \
    109108{ \
    110     bool status; \
    111  \
    112     var = psMetadataLookup##suffix(&status, md, key); \
    113     if (!status) { \
    114         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for %s", key); \
    115         return ret; \
    116     } \
    117  \
    118     if (required && (var == max)) { \
    119         psError(PS_ERR_UNKNOWN, true, "%s is required", key); \
    120         return ret; \
    121     } \
     109    psMetadataItem *item = psMetadataLookup(md, key); \
     110    if (!item) { \
     111        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for %s", key); \
     112        return ret; \
     113    } \
     114    psAssert(item->comment, "metadata item comment should be defined"); \
     115    if (required && (!psStrcasestr(item->comment, "(found)"))) { \
     116        psError(PS_ERR_UNKNOWN, true, "%s is required", key); \
     117        return ret; \
     118    } \
     119 \
     120    var = item->data.suffix; \
     121 \
    122122}
    123123
     
    171171// XXX the PXOPT_COPY_* macros free 'to' on error
    172172
    173 #define PXOPT_COPY_PRIMITIVE(from, to, type, suffix, oldname, newname, comment) \
    174 { \
    175     bool status = false; \
    176     type var = psMetadataLookup##suffix(&status, from, oldname); \
    177     if (!status) { \
    178         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for " oldname); \
     173#define PXOPT_COPY_PRIMITIVE(from, to, type, suffix, oldname, newname, newcomment) \
     174{ \
     175    psMetadataItem *item = psMetadataLookup(from, oldname); \
     176    if (!item) { \
     177        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for %s", oldname); \
    179178        return false; \
    180179    } \
    181     if (!psMetadataAdd##suffix(to, PS_LIST_TAIL, newname, PS_META_DUPLICATE_OK, comment, var)) { \
    182         psError(PS_ERR_UNKNOWN, false, "failed to add item " newname); \
    183         psFree(to); \
    184         return false; \
     180    psAssert(item->comment, "metadata item comment should be defined"); \
     181\
     182    if (psStrcasestr(item->comment, "(found)")) { \
     183        if (!psMetadataAdd##suffix(to, PS_LIST_TAIL, newname, PS_META_DUPLICATE_OK, newcomment, item->data.suffix)) { \
     184            psError(PS_ERR_UNKNOWN, false, "failed to add item " newname); \
     185            psFree(to); \
     186            return false; \
     187        } \
    185188    } \
    186189}
Note: See TracChangeset for help on using the changeset viewer.