Changeset 11216 for trunk/psModules/src/camera/pmFPAConstruct.c
- Timestamp:
- Jan 19, 2007, 6:24:42 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAConstruct.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAConstruct.c
r10992 r11216 471 471 const pmFPAview *phuView, // The view corresponding to the PHU, or NULL 472 472 const psMetadata *header, // The PHU header, or NULL 473 const psMetadata *format // Format of file 473 const psMetadata *format, // Format of file 474 bool install // Install the provided header in the location that we find? 474 475 ) 475 476 { … … 540 541 return NULL; 541 542 } 542 if ( processContents(fpa, NULL, NULL, phdu, PM_FPA_LEVEL_FPA, contents, format) < 0) {543 if (install && processContents(fpa, NULL, NULL, phdu, PM_FPA_LEVEL_FPA, contents, format) < 0) { 543 544 psError(PS_ERR_IO, false, "Error setting CONTENTS"); 544 545 psFree(phdu); … … 548 549 psFree(phdu); 549 550 550 if ( header && !pmConceptsRead(fpa, NULL, NULL, PM_CONCEPT_SOURCE_PHU, NULL)) {551 if (install && header && !pmConceptsRead(fpa, NULL, NULL, PM_CONCEPT_SOURCE_PHU, NULL)) { 551 552 psWarning("Unable to read concepts from PHU.\n"); 552 553 } … … 645 646 } 646 647 647 const char *content = getContent(fileInfo, contents, chip, cell); // The chip:cell:cellType triples 648 if (!content || strlen(content) == 0) { 649 psError(PS_ERR_IO, false, "Unable to get CONTENTS.\n"); 650 psFree(phdu); 651 psFree(view); 652 return NULL; 653 } 654 if (processContents(fpa, chip, cell, phdu, level, content, format) < 0) { 655 psError(PS_ERR_IO, false, "Error setting CONTENTS"); 656 psFree(phdu); 657 psFree(view); 658 return NULL; 648 if (install) { 649 const char *content = getContent(fileInfo, contents, chip, cell); // chip:cell:cellType triples 650 if (!content || strlen(content) == 0) { 651 psError(PS_ERR_IO, false, "Unable to get CONTENTS.\n"); 652 psFree(phdu); 653 psFree(view); 654 return NULL; 655 } 656 if (processContents(fpa, chip, cell, phdu, level, content, format) < 0) { 657 psError(PS_ERR_IO, false, "Error setting CONTENTS"); 658 psFree(phdu); 659 psFree(view); 660 return NULL; 661 } 659 662 } 660 663 psFree(phdu); 661 664 662 if ( header && !pmConceptsRead(fpa, chip, cell, PM_CONCEPT_SOURCE_PHU, NULL)) {665 if (install && header && !pmConceptsRead(fpa, chip, cell, PM_CONCEPT_SOURCE_PHU, NULL)) { 663 666 psWarning("Unable to read concepts from PHU.\n"); 664 667 } … … 724 727 } 725 728 726 pmHDU *hdu = pmHDUAlloc(extName); // The extension 727 // Casting to avoid "warning: passing arg 1 of `p_psMemIncrRefCounter' discards qualifiers from 728 // pointer target type" 729 hdu->format = psMemIncrRefCounter((const psPtr)format); 730 731 if (processContents(fpa, chip, cell, hdu, level, contentsItem->data.V, format) < 0) { 732 psError(PS_ERR_IO, false, "Error setting CONTENTS"); 733 psFree(view); 729 if (install) { 730 pmHDU *hdu = pmHDUAlloc(extName); // The extension 731 // Casting to avoid "warning: passing arg 1 of `p_psMemIncrRefCounter' discards qualifiers from 732 // pointer target type" 733 hdu->format = psMemIncrRefCounter((const psPtr)format); 734 735 if (processContents(fpa, chip, cell, hdu, level, contentsItem->data.V, format) < 0) { 736 psError(PS_ERR_IO, false, "Error setting CONTENTS"); 737 psFree(view); 738 psFree(hdu); 739 psFree(contentsIter); 740 return NULL; 741 } 734 742 psFree(hdu); 735 psFree(contentsIter); 736 return NULL; 737 } 738 psFree(hdu); 743 } 739 744 } 740 745 psFree(contentsIter); 741 746 742 if (!pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_DEFAULTS, true, NULL)) { 743 psWarning("Unable to read concepts from defaults for FPA. Attempting to " 744 "proceed anyway.\n"); 745 } 746 747 if (header && !pmConceptsRead(fpa, chip, cell, PM_CONCEPT_SOURCE_PHU, NULL)) { 748 psWarning("Unable to read concepts from PHU.\n"); 747 if (install) { 748 if (!pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_DEFAULTS, true, NULL)) { 749 psWarning("Unable to read concepts from defaults for FPA. Attempting to " 750 "proceed anyway.\n"); 751 } 752 753 if (header && !pmConceptsRead(fpa, chip, cell, PM_CONCEPT_SOURCE_PHU, NULL)) { 754 psWarning("Unable to read concepts from PHU.\n"); 755 } 749 756 } 750 757 … … 759 766 PS_ASSERT_PTR_NON_NULL(format, false); 760 767 761 pmFPAview *view = addSource(fpa, phuView, NULL, format );768 pmFPAview *view = addSource(fpa, phuView, NULL, format, true); 762 769 bool status = (view == NULL); 763 770 psFree(view); … … 795 802 psFree(newFPAname); // Drop reference 796 803 797 return addSource(fpa, NULL, phu, format); 804 return addSource(fpa, NULL, phu, format, true); 805 } 806 807 808 pmFPAview *pmFPAIdentifySourceFromHeader(pmFPA *fpa, psMetadata *phu, const psMetadata *format) 809 { 810 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 811 PS_ASSERT_PTR_NON_NULL(phu, NULL); 812 PS_ASSERT_PTR_NON_NULL(format, NULL); 813 814 return addSource(fpa, NULL, phu, format, false); 798 815 } 799 816
Note:
See TracChangeset
for help on using the changeset viewer.
