IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 1, 2007, 1:29:47 PM (19 years ago)
Author:
Paul Price
Message:

Fixing response when requested format can't be found --- it's an error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r11876 r12152  
    163163    if (file->type == PM_FPA_FILE_NONE) {
    164164        psError(PS_ERR_IO, true, "FILE.TYPE is not defined for %s\n", name);
     165        psFree(file);
    165166        return NULL;
    166167    }
     
    176177        } else {
    177178            psError(PS_ERR_IO, true, "Illegal value \"%s\" for FILE.SAVE for %s", save, name);
     179            psFree(file);
    178180            return NULL;
    179181        }
     
    190192    // select the format list from the selected camera
    191193    const char *formatName = psMetadataLookupStr (&status, data, "FILE.FORMAT");
    192     if (!formatName) {
     194    if (!formatName || strcmp(formatName, "NONE") == 0) {
     195        // Try to get by with the default
    193196        formatName = config->formatName;
    194197    }
     
    196199    psMetadata *format = psMetadataLookupMetadata(&status, formats, formatName); // Camera format to use
    197200    if (!format) {
    198         // Try to get by with the default
    199         format = config->format;
     201        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unable to find format %s for file %s.\n",
     202                formatName, file->name);
     203        psFree(file);
     204        return NULL;
    200205    }
    201206    file->format = psMemIncrRefCounter(format);
     
    206211    if (file->fileLevel == PM_FPA_LEVEL_NONE) {
    207212        psError(PS_ERR_IO, true, "Unable to determine file level for %s\n", name);
     213        psFree(file);
    208214        return NULL;
    209215    }
     
    212218    if (file->dataLevel == PM_FPA_LEVEL_NONE) {
    213219        psError(PS_ERR_IO, true, "DATA.LEVEL is not set for %s\n", name);
     220        psFree(file);
    214221        return NULL;
    215222    }
     
    820827        char *concept = item->data.V;
    821828
    822         // these items refer to the corresponding values for the input image
    823         // (ie, -filter input:filter or -exptime input:exptime)
     829        // these items refer to the corresponding values for the input image
     830        // (ie, -filter input:filter or -exptime input:exptime)
    824831        if (!strcasecmp (option, "filter")) {
    825832            options->filter = psMetadataLookupPtr (&status, input->concepts, concept);
    826             psMemIncrRefCounter (options->filter);
     833            psMemIncrRefCounter (options->filter);
    827834            if (!status)
    828835                psAbort("failed to find filter (concept %s)", concept);
     
    831838        if (!strcasecmp (option, "exptime")) {
    832839            options->exptime = psMetadataLookupF32 (&status, input->concepts, concept);
    833             options->exptimeSet = true;
     840            options->exptimeSet = true;
    834841            if (!status)
    835842                psAbort("exptime not found (concept %s)", concept);
     
    837844        if (!strcasecmp (option, "airmass")) {
    838845            options->airmass = psMetadataLookupF32 (&status, input->concepts, concept);
    839             options->airmassSet = true;
     846            options->airmassSet = true;
    840847            if (!status)
    841848                psAbort("airmass not found (concept %s)", concept);
    842849        }
    843         if (!strcasecmp (option, "dettemp")) {
    844             options->dettemp = psMetadataLookupF32 (&status, input->concepts, concept);
    845             options->dettempSet = true;
    846             if (!status)
    847                 psAbort("dettemp not found (concept %s)", concept);
    848         }
     850        if (!strcasecmp (option, "dettemp")) {
     851            options->dettemp = psMetadataLookupF32 (&status, input->concepts, concept);
     852            options->dettempSet = true;
     853            if (!status)
     854                psAbort("dettemp not found (concept %s)", concept);
     855        }
    849856        if (!strcasecmp (option, "twilight")) {
    850857            options->twilight = psMetadataLookupF32 (&status, input->concepts, concept);
    851             options->twilightSet = true;
     858            options->twilightSet = true;
    852859            if (!status)
    853860                psAbort("twilight not found (concept %s)", concept);
    854861        }
    855862
    856         // the version is applied literally
     863        // the version is applied literally
    857864        if (!strcasecmp (option, "version")) {
    858865            options->version = psMemIncrRefCounter (concept);
    859866        }
    860         // we can override the detrend database dettype if desired
    861         // ie, use DOMEFLAT for type FLAT
    862         // the dettype string is applied literally
     867        // we can override the detrend database dettype if desired
     868        // ie, use DOMEFLAT for type FLAT
     869        // the dettype string is applied literally
    863870        if (!strcasecmp (option, "dettype")) {
    864871            options->dettype = psMemIncrRefCounter (concept);
Note: See TracChangeset for help on using the changeset viewer.