IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14798


Ignore:
Timestamp:
Sep 10, 2007, 9:10:43 AM (19 years ago)
Author:
Paul Price
Message:

Fixing uninitialised variable warnings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSimUtils.c

    r14531 r14798  
    44// this function is called with only one of fpa, chip, cell not NULL
    55bool ppSimInitHeader(pmConfig *config,
    6                      pmFPA *fpa,
    7                      pmChip *chip,
    8                      pmCell *cell)
     6                     pmFPA *fpa,
     7                     pmChip *chip,
     8                     pmCell *cell)
    99{
    1010
     
    1717    int binning = psMetadataLookupS32(NULL, config->arguments, "BINNING"); // Binning in x and y
    1818
    19     float x0, y0;
    20     int xParity, yParity;
     19    float x0 = 0.0, y0 = 0.0;
     20    int xParity = 0, yParity = 0;
    2121    if (cell) {
    22         int x0Chip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.X0");
    23         int y0Chip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.Y0");
    24         int xParityChip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.XPARITY");
    25         int yParityChip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.YPARITY");
     22        int x0Chip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.X0");
     23        int y0Chip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.Y0");
     24        int xParityChip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.XPARITY");
     25        int yParityChip = psMetadataLookupS32(NULL, cell->parent->concepts, "CHIP.YPARITY");
    2626
    27         int x0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0");
    28         int y0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0");
    29         int xParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY");
    30         int yParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY");
     27        int x0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0");
     28        int y0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0");
     29        int xParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY");
     30        int yParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY");
    3131
    32         x0 = PPSIM_FPA_TO_CELL(0.0, x0Cell, xParityCell, binning, x0Chip, xParityChip);
    33         y0 = PPSIM_FPA_TO_CELL(0.0, y0Cell, yParityCell, binning, y0Chip, yParityChip);
    34         xParity = xParityCell * xParityChip;
    35         yParity = yParityCell * yParityChip;
     32        x0 = PPSIM_FPA_TO_CELL(0.0, x0Cell, xParityCell, binning, x0Chip, xParityChip);
     33        y0 = PPSIM_FPA_TO_CELL(0.0, y0Cell, yParityCell, binning, y0Chip, yParityChip);
     34        xParity = xParityCell * xParityChip;
     35        yParity = yParityCell * yParityChip;
    3636    }
    3737    if (chip) {
    38         int x0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.X0");
    39         int y0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.Y0");
    40         int xParityChip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.XPARITY");
    41         int yParityChip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.YPARITY");
     38        int x0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.X0");
     39        int y0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.Y0");
     40        int xParityChip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.XPARITY");
     41        int yParityChip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.YPARITY");
    4242
    43         x0 = PPSIM_FPA_TO_CELL(0.0, 0, 1, binning, x0Chip, xParityChip);
    44         y0 = PPSIM_FPA_TO_CELL(0.0, 0, 1, binning, y0Chip, yParityChip);
    45         xParity = xParityChip;
    46         yParity = yParityChip;
     43        x0 = PPSIM_FPA_TO_CELL(0.0, 0, 1, binning, x0Chip, xParityChip);
     44        y0 = PPSIM_FPA_TO_CELL(0.0, 0, 1, binning, y0Chip, yParityChip);
     45        xParity = xParityChip;
     46        yParity = yParityChip;
    4747    }
    4848    if (fpa) {
    49         psRegion *bounds = ppSimFPABounds (fpa);
    50         x0 = 0.5 * (bounds->x1 - bounds->x0);
    51         y0 = 0.5 * (bounds->y1 - bounds->y0);
    52         xParity = 1;
    53         yParity = 1;
    54         psFree (bounds);
     49        psRegion *bounds = ppSimFPABounds (fpa);
     50        x0 = 0.5 * (bounds->x1 - bounds->x0);
     51        y0 = 0.5 * (bounds->y1 - bounds->y0);
     52        xParity = 1;
     53        yParity = 1;
     54        psFree (bounds);
    5555    }
     56    assert(xParity != 0 && yParity != 0);
    5657
    5758    psMetadata *header = psMetadataAlloc(); // Header, to return
     
    7778
    7879    if (cell) {
    79         cell->hdu->header = header;
    80         cell->data_exists = true;
     80        cell->hdu->header = header;
     81        cell->data_exists = true;
    8182    }
    8283    if (chip) {
    83         chip->hdu->header = header;
     84        chip->hdu->header = header;
    8485        chip->data_exists = true;
    8586    }
    8687    if (fpa) {
    87         fpa->hdu->header = header;
     88        fpa->hdu->header = header;
    8889    }
    8990
     
    131132
    132133    psMetadataAddF32(cell->concepts, PS_LIST_TAIL, "CELL.EXPOSURE", PS_META_REPLACE,
    133                      "Exposure time (sec)", expTime);
     134                     "Exposure time (sec)", expTime);
    134135    psMetadataAddF32(cell->concepts, PS_LIST_TAIL, "CELL.DARKTIME", PS_META_REPLACE,
    135                      "Dark time (sec)", expTime);
     136                     "Dark time (sec)", expTime);
    136137    psMetadataAddS32(cell->concepts, PS_LIST_TAIL, "CELL.XBIN", PS_META_REPLACE,
    137                      "Binning in x", binning);
     138                     "Binning in x", binning);
    138139    psMetadataAddS32(cell->concepts, PS_LIST_TAIL, "CELL.YBIN", PS_META_REPLACE,
    139                      "Binning in y", binning);
     140                     "Binning in y", binning);
    140141
    141142    return true;
Note: See TracChangeset for help on using the changeset viewer.