Пример #1
0
Msg_reader_core::Msg_reader_core( VSILFILE* fp ) :
    _lines(0),
    _columns(0),
    _line_start(0),
    _col_start(0),
    _col_dir_step(0.0f),
    _line_dir_step(0.0f),
    _f_data_offset(0),
    _f_data_size(0),
    _f_header_offset(0),
    _f_header_size(0),
    _visir_bytes_per_line(0),
    _visir_packet_size(0),
    _hrv_bytes_per_line(0),
    _hrv_packet_size(0),
    _interline_spacing(0),
    _year(0),
    _month(0),
    _day(0),
    _hour(0),
    _minute(0),
    _open_success(false)
{
    memset(&_main_header, 0, sizeof(_main_header));
    memset(&_sec_header, 0, sizeof(_sec_header));

    SecondaryProdHeaderInit(&_sec_header);
    for (size_t i=0; i < MSG_NUM_CHANNELS; ++i) {
      _calibration[i].cal_slope = 0.0;
      _calibration[i].cal_offset = 0.0;
    }

    read_metadata_block(fp);
}
Пример #2
0
static struct hash_table_entry *load_entry(struct PkgData *pdata,
		long long cstart)
{
	// Allocate space for decompressed metadata block.
	void *udata = malloc(SQUASHFS_METADATA_SIZE);
	if (!udata) {
		ERROR("Failed to allocate metadata block\n");
		return NULL;
	}

	long long cnext;
	int usize = read_metadata_block(pdata, cstart, &cnext,
			udata, SQUASHFS_METADATA_SIZE);
	if (usize < 0) {
		ERROR("Failed to read metadata block\n");
		free(udata);
		return NULL;
	}

	struct hash_table_entry *entry = malloc(sizeof(struct hash_table_entry));
	if (!entry) {
		ERROR("Failed to allocate hash table entry\n");
		free(udata);
		return NULL;
	}
	entry->cstart = cstart;
	entry->cnext = cnext;
	entry->udata = udata;
	entry->usize = usize;
	entry->next = NULL;

	return entry;
}
Пример #3
0
Msg_reader_core::Msg_reader_core( const char* fname ) :
    _lines(0),
    _columns(0),
    _line_start(0),
    _col_start(0),
    _col_dir_step(0.0f),
    _line_dir_step(0.0f),
    _f_data_offset(0),
    _f_data_size(0),
    _f_header_offset(0),
    _f_header_size(0),
    _visir_bytes_per_line(0),
    _visir_packet_size(0),
    _hrv_bytes_per_line(0),
    _hrv_packet_size(0),
    _interline_spacing(0),
    _year(0),
    _month(0),
    _day(0),
    _hour(0),
    _minute(0),
    _open_success(false)
{
    memset(&_main_header, 0, sizeof(_main_header));
    memset(&_sec_header, 0, sizeof(_sec_header));
    SecondaryProdHeaderInit(&_sec_header);
    for (size_t i=0; i < MSG_NUM_CHANNELS; ++i) {
      _calibration[i].cal_slope = 0.0;
      _calibration[i].cal_offset = 0.0;
    }

    VSILFILE* fin = VSIFOpenL(fname, "rb");
    if( !fin )
    {
        CPLError(CE_Failure, CPLE_OpenFailed,
                 "Could not open file %s", fname);
        return;
    }
    read_metadata_block(fin);
    VSIFCloseL(fin);
}