84 fprintf(stderr,
"ERROR: file name pointer is zero\n");
90 fprintf(stderr,
"ERROR: wave packet descriptor pointer is zero\n");
99 for (i = 0; i < 256; i++)
111 if (!
compressed && (strstr(
".wdp", file_name) || strstr(
".WDP", file_name)))
113 file = fopen(file_name,
"rb");
115 else if (
compressed && (strstr(
".wdz", file_name) || strstr(
".WDZ", file_name)))
117 file = fopen(file_name,
"rb");
121 char* file_name_temp = strdup(file_name);
122 int len = strlen(file_name_temp);
123 if ((file_name_temp[len-3] ==
'L') || (file_name_temp[len-3] ==
'W'))
125 file_name_temp[len-3] =
'W';
126 file_name_temp[len-2] =
'D';
127 file_name_temp[len-1] = (
compressed ?
'Z' :
'P');
131 file_name_temp[len-3] =
'w';
132 file_name_temp[len-2] =
'd';
133 file_name_temp[len-1] = (
compressed ?
'z' :
'p');
135 file = fopen(file_name_temp,
"rb");
136 free(file_name_temp);
141 file = fopen(file_name,
"rb");
146 fprintf(stderr,
"ERROR: cannot open waveform file '%s'\n", file_name);
170 fprintf(stderr,
"ERROR: reading waveform descriptor cross-check\n");
174 if (strncmp(magic,
"LAStools waveform ", 18) == 0)
181 fprintf(stderr,
"ERROR: reading number of waveform descriptors\n");
184 for (i = 0; i < number; i++)
189 fprintf(stderr,
"ERROR: reading index of waveform descriptor %d\n", i);
194 fprintf(stderr,
"ERROR: cross-check - index %d of waveform descriptor %d out-of-range\n", index, i);
199 fprintf(stderr,
"WARNING: cross-check - waveform descriptor %d with index %d unknown\n", i, index);
203 fprintf(stderr,
"ERROR: cross-check - reading rest of waveform descriptor %d\n", i);
211 fprintf(stderr,
"ERROR: reading compression of waveform descriptor %d\n", i);
216 fprintf(stderr,
"ERROR: cross-check - compression %d %d of waveform descriptor %d with index %d is different\n", compression,
wave_packet_descr[index]->getCompressionType(), i, index);
222 fprintf(stderr,
"ERROR: reading nbits of waveform descriptor %d\n", i);
227 fprintf(stderr,
"ERROR: cross-check - nbits %d %d of waveform descriptor %d with index %d is different\n",
nbits,
wave_packet_descr[index]->getBitsPerSample(), i, index);
233 fprintf(stderr,
"ERROR: reading nsamples of waveform descriptor %d\n", i);
238 fprintf(stderr,
"ERROR: cross-check - nsamples %d %d of waveform descriptor %d with index %d is different\n",
nsamples,
wave_packet_descr[index]->getNumberOfSamples(), i, index);
268 fprintf(stderr,
"ERROR: waveform with %d bits per samples not supported yet\n",
nbits);
275 fprintf(stderr,
"ERROR: waveform has no samples\n");
309 fprintf(stderr,
"ERROR: cannot read %u bytes for waveform with %u samples of %u bits\n",
size,
nsamples,
nbits);