Changeset 17988 for trunk/psModules
- Timestamp:
- Jun 8, 2008, 2:35:06 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAfileDefine.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfileDefine.c
r17911 r17988 429 429 psMetadata *phu = NULL; 430 430 psMetadata *format = NULL; 431 psMetadata *camera = NULL; 432 psString formatName = NULL; 431 433 432 434 // use success to identify valid exit conditions (as opposed to 'argument not supplied') … … 471 473 psFitsClose(fits); 472 474 473 // determine the current format from the header474 // determine camera if not specified already475 format = pmConfigCameraFormatFromHeader( config, phu, true);475 // Determine the current format from the header; Determine camera if not specified already. 476 // the returned pointers 'camera' and 'formatName' are allocated here 477 format = pmConfigCameraFormatFromHeader(&camera, &formatName, config, phu, true); 476 478 if (!format) { 477 479 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", realName); 478 480 psFree(phu); 479 psFree (realName); 481 psFree(camera); 482 psFree(formatName); 483 psFree(realName); 480 484 return NULL; 481 485 } 482 486 483 487 // build the template fpa, set up the basic view 484 fpa = pmFPAConstruct(config->camera, config->cameraName); 488 // XXX do we want this to be the baseCamera name or the metaCamera name? 489 fpa = pmFPAConstruct(camera, config->cameraName); 485 490 if (!fpa) { 486 491 psError(PS_ERR_IO, false, "Failed to construct FPA from %s", realName); 487 psFree (realName); 492 psFree(phu); 493 psFree(camera); 494 psFree(formatName); 495 psFree(realName); 496 psFree(format); 488 497 return NULL; 489 498 } 490 499 psFree (realName); 500 psFree (camera); 491 501 492 502 // load the given filerule (from config->camera) and bind it to the fpa … … 496 506 psError(PS_ERR_IO, false, "file %s not defined\n", filename); 497 507 psFree(phu); 508 psFree(formatName); 509 psFree(format); 498 510 psFree(fpa); 499 psFree(format); 500 return NULL; 501 } 502 psFree (format); 503 file->format = psMemIncrRefCounter(format); 504 file->formatName = psStringCopy(config->formatName); 511 return NULL; 512 } 513 file->format = format; 514 file->formatName = formatName; 505 515 506 516 // adjust the rules to identify these files in the file->names data 507 psFree (file->filerule);508 517 file->filerule = psStringCopy("@FILES"); 509 518 file->filesrc = psStringCopy("{CHIP.NAME}.{CELL.NAME}"); … … 514 523 psFree(phu); 515 524 psFree(fpa); 516 psFree(format);517 525 return NULL; 518 526 } … … 527 535 if (!realName) { 528 536 psError(PS_ERR_IO, false, "Failed to convert file name %s", (char *) infiles->data[i]); 537 psFree(phu); 538 psFree(fpa); 529 539 return NULL; 530 540 } … … 534 544 psError(PS_ERR_IO, false, "Failed to open file %s\n", realName); 535 545 psFree(realName); 546 psFree(phu); 547 psFree(fpa); 536 548 return NULL; 537 549 } … … 541 553 psFree(realName); 542 554 psFitsClose(fits); 555 psFree(phu); 556 psFree(fpa); 543 557 return NULL; 544 558 } … … 548 562 psFree(realName); 549 563 psFitsClose(fits); 564 psFree(phu); 565 psFree(fpa); 550 566 return NULL; 551 567 } … … 554 570 psFree(realName); 555 571 psFitsClose(fits); 572 psFree(phu); 573 psFree(fpa); 556 574 return NULL; 557 575 } … … 566 584 psFree(phu); 567 585 psFree(fpa); 568 psFree(format);569 586 return NULL; 570 587 } … … 670 687 671 688 if (!format) { 672 format = pmConfigCameraFormatFromHeader( config, phu, true);689 format = pmConfigCameraFormatFromHeader(NULL, NULL, config, phu, true); 673 690 if (!format) { 674 691 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", realName); … … 716 733 psFree(phu); 717 734 } 718 psFree(file->format);719 735 file->format = format; 720 736 file->formatName = psStringCopy(config->formatName); … … 775 791 // on first call to this function, config->camera is not set. 776 792 // later calls will give an error if the cameras do not match 777 format = pmConfigCameraFormatFromHeader (config, phu, true); 793 psMetadata *camera = NULL; 794 psString formatName = NULL; 795 format = pmConfigCameraFormatFromHeader (&camera, &formatName, config, phu, true); 778 796 if (!format) { 779 797 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", (char *)infiles->data[0]); 780 798 psFree(phu); 799 psFree(camera); 800 psFree(formatName); 781 801 return NULL; 782 802 } 783 803 784 804 // build the template fpa, set up the basic view 785 fpa = pmFPAConstruct (config->camera, config->cameraName);805 fpa = pmFPAConstruct (camera, config->cameraName); 786 806 if (!fpa) { 787 807 psError(PS_ERR_IO, false, "Failed to construct FPA from %s", (char *)infiles->data[0]); 788 808 psFree(phu); 809 psFree(camera); 810 psFree(formatName); 789 811 psFree(format); 790 812 return NULL; 791 813 } 814 psFree(camera); 792 815 793 816 // load the given filerule (from config->camera) and bind it to the fpa … … 802 825 return NULL; 803 826 } 804 psFree (file->format);805 827 file->format = format; 806 file->formatName = psStringCopy(config->formatName);828 file->formatName = formatName; 807 829 808 830 // adjust the rules to identify these files in the file->names data 809 psFree (file->filerule);810 psFree (file->filesrc);811 831 file->filerule = psStringCopy ("@FILES"); 812 832 file->filesrc = psStringCopy ("{CHIP.NAME}.{CELL.NAME}"); … … 817 837 psFree(phu); 818 838 psFree(fpa); 819 psFree(format);820 839 return NULL; 821 840 } … … 827 846 psFree(phu); 828 847 psFree(fpa); 829 psFree(format);830 848 return NULL; 831 849 } … … 841 859 psFree(view); 842 860 psFree(name); 843 psFree(format);844 861 845 862 if (success) {
Note:
See TracChangeset
for help on using the changeset viewer.
