Skip to content

Commit 7ee5736

Browse files
author
Chad Trabant
committed
1 parent 72468e1 commit 7ee5736

File tree

19 files changed

+380
-121
lines changed

19 files changed

+380
-121
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2013.056: 3.5
2+
- Update libmseed to 2.10.
3+
14
2011.332: 3.4.3
25
- Fix parsing of match/rejection list files, the error only occurred
36
with multiple lines on systems with specific snprintf() behavior.

libmseed/ChangeLog

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,82 @@
1-
2010.304: 2.6.2
1+
2013.056: 2.10
2+
- Add more sanity checks to msr_unpack_data() to catch bad/corrupted
3+
data records and avoid crashes due to impossible pointer construction.
4+
5+
2013.053: 2.9
6+
- Extend parsing of day-of-year style time strings to allow parsing
7+
of time fields separated by dashes in addition to allowing the day
8+
and time fields to be separated by a 'T' or space. Modifications
9+
were made to ms_seedtimestr2hptime().
10+
- Extend parsing of year-month-day style time strings to allow parsing
11+
of time fields separated by commas. Modifications were made to
12+
ms_timestr2hptime().
13+
14+
2013.050:
15+
- Add MS_ISVALIDYEARDAY() macro to test range for year and day values,
16+
years between 1900 and 2100 and days between 1 and 366.
17+
- Use new macro to determine when byte swapping is needed. This test
18+
leaves a non-determination of byte order for days 1, 256 and 257 in
19+
the year 2056, beware future data users.
20+
21+
2013.007: 2.8 (again)
22+
- Add msr_parse_selection() to libmseed.def for Windows builds.
23+
- Fix errors in pseudo code in doc/msr_parse.3.
24+
25+
2012.363: 2.8
26+
- Implement msr_parse_selection() which is a wrapper of msr_parse()
27+
that searches for the first parsable miniSEED record in a memory
28+
buffer and returns it. Optionally a Selections list may be specified
29+
to limit the returned data to records matching specific criteria.
30+
31+
2012.357:
32+
- Fix corruption of float sample types when opposite byte order than
33+
host in certain architecture combinations. By not addressing
34+
individual float samples directly as floats prior to byte swapping
35+
we avoid the values being placed into the FPU where they may be
36+
corrupted. Thanks to Moritz Beyreuther and Lion Krischer for discovery
37+
and testing.
38+
- Expose the msr_unpack_data() function for use by removing the static
39+
declaration. Change verbose flag type to match others and document.
40+
- Fix some logging messages, typos, etc.
41+
42+
2012.138: 2.7
43+
Add define for MINGW32 to use _fstat and _stat.
44+
45+
2012.114: 2.7rc2
46+
- Change record parsing code to trim trailing spaces from network,
47+
station, location and channel parameters. Spaces in between non-space
48+
characters remain.
49+
50+
2012.111:
51+
- Update example/test.mseed to new data with an earthquake to make it
52+
more recognizable compared to ambient noise in the previous example.
53+
54+
2012.105: 2.7rc1
55+
- Add many type casts to quiet newer GCC and MSVC compilers.
56+
For 32-bit programs there are some places, mostly in packing routines,
57+
where 64-bit integers are converted to 32-bit values for sample buffer
58+
sizes and counts leaving the potential for overflow. This will become
59+
a problem when byte counts for sample buffers are beyond 2^31, for
60+
32-bit integer sample values that is more than 536 million samples.
61+
So programmer beware if using such buffer sizes for packing miniSEED.
62+
63+
2012.088:
64+
- When parsing records copy the ASCII string fields (sequence number,
65+
network, station, location, channel) directly without removing spaces.
66+
This makes the parser more lenient to unallowed characters and
67+
synchronizes read and write capabilities.
68+
69+
- For sampling rates above 32,767 Hz only print a warning for high
70+
verbosity settings and set the sample rate factor and multipler to zero.
71+
Previously an error was printed during rational approximation.
72+
The expectation is that a record with such a high sample rate will
73+
include a blockette 100 to specify the actual sample rate.
74+
This is not an official convention for SEED, but is a kludge to
75+
support extremly high sample rates without printing errors.
76+
77+
- Fix conversion to doubles in examples/msrepack.c.
78+
79+
2011.304: 2.6.2
280
- Increase precision of sample rate in SYNC printing routines to
381
avoid trucation of rate values.
482

libmseed/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LIB_OBJS = fileutils.o genutils.o gswap.o lmplatform.o lookup.o \
1313
parseutils.o unpack.o unpackdata.o selection.o logging.o
1414

1515
MAJOR_VER = 2
16-
MINOR_VER = 6.2
16+
MINOR_VER = 10
1717
CURRENT_VER = $(MAJOR_VER).$(MINOR_VER)
1818
COMPAT_VER = $(MAJOR_VER).$(MINOR_VER)
1919

@@ -39,6 +39,7 @@ $(LIB_A): $(LIB_OBJS)
3939
$(LIB_SO): $(LIB_OBJS)
4040
rm -f $(LIB_SO) $(LIB_SO_FILENAME)
4141
$(GCC) $(GCCFLAGS) -shared -Wl,-soname -Wl,$(LIB_SO_ALIAS) -o $(LIB_SO) $(LIB_OBJS)
42+
ln -s $(LIB_SO) $(LIB_SO_ALIAS)
4243
ln -s $(LIB_SO) $(LIB_SO_FILENAME)
4344

4445
$(LIB_DYN): $(LIB_OBJS)

libmseed/README.byteorder

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ create big endian Mini-SEED records (header and data).
1414
Reading MiniSEED - how libmseed determines the byte order of a record:
1515

1616
The byte order of a record header including blockettes is determined
17-
by checking if the record start year is a sane value (e.g. between 1920
18-
and 2020). The byte order of encoded data samples is determined by the
19-
byte order flag in the Blockette 1000, if a Blockette 1000 is not
20-
present the byte order is assumed to be the same as the header. To
21-
force the byte order determination of either the header or data section
22-
of a record the following environment variables can be set:
17+
by checking if the record start year and day is a sane value (e.g. year
18+
between 1900 and 2100 and day between 1 and 366). The byte order of
19+
encoded data samples is determined by the byte order flag in the
20+
Blockette 1000, if a Blockette 1000 is not present the byte order is
21+
assumed to be the same as the header. To force the byte order
22+
determination of either the header or data section of a record the
23+
following environment variables can be set:
2324

2425
UNPACK_HEADER_BYTEORDER
2526
UNPACK_DATA_BYTEORDER
@@ -47,10 +48,8 @@ These variables should be set to either 0 (little endian) or 1 (big
4748
endian). A programmatic equivalent of setting these environment
4849
variables is provided via the following macros:
4950

50-
.nf
5151
MS_PACKHEADERBYTEORDER(X)
5252
MS_PACKDATABYTEORDER(X)
53-
.fi
5453

5554

5655
Note that some interpretations of the SEED 2.4 format imply that

libmseed/example/msrepack.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Written by Chad Trabant, IRIS Data Management Center
1111
*
12-
* modified 2011.164
12+
* modified 2012.105
1313
***************************************************************************/
1414

1515
#include <stdio.h>
@@ -28,9 +28,9 @@
2828
#define VERSION "[libmseed " LIBMSEED_VERSION " example]"
2929
#define PACKAGE "msrepack"
3030

31-
static short int verbose = 0;
32-
static short int ppackets = 0;
33-
static short int tracepack = 1;
31+
static flag verbose = 0;
32+
static flag ppackets = 0;
33+
static flag tracepack = 1;
3434
static int reclen = 0;
3535
static int packreclen = -1;
3636
static char *encodingstr = 0;
@@ -54,10 +54,8 @@ main (int argc, char **argv)
5454
MSTrace *mst;
5555
int retcode;
5656

57-
int totalrecs = 0;
58-
int totalsamps = 0;
5957
int64_t packedsamples;
60-
int packedrecords;
58+
int64_t packedrecords;
6159
int lastrecord;
6260
int iseqnum = 1;
6361

@@ -103,9 +101,6 @@ main (int argc, char **argv)
103101
while ( (retcode = ms_readmsr (&msr, inputfile, reclen, NULL, &lastrecord,
104102
1, 1, verbose)) == MS_NOERROR )
105103
{
106-
totalrecs++;
107-
totalsamps += msr->samplecnt;
108-
109104
msr_print (msr, ppackets);
110105

111106
/* Convert sample type as needed for packencoding */
@@ -359,7 +354,7 @@ convertsamples (MSRecord *msr, int packencoding)
359354
}
360355

361356
/* Reallocate buffer for reduced size needed */
362-
if ( realloc (msr->datasamples, (msr->numsamples * sizeof(int32_t))) )
357+
if ( ! (msr->datasamples = realloc (msr->datasamples,(size_t)(msr->numsamples * sizeof(int32_t)))) )
363358
{
364359
ms_log (2, "Error, cannot re-allocate buffer for sample conversion\n");
365360
return -1;
@@ -383,7 +378,7 @@ convertsamples (MSRecord *msr, int packencoding)
383378
fdata[idx] = (float) ddata[idx];
384379

385380
/* Reallocate buffer for reduced size needed */
386-
if ( realloc (msr->datasamples, (msr->numsamples * sizeof(float))) )
381+
if ( ! (msr->datasamples = realloc (msr->datasamples, (size_t)(msr->numsamples * sizeof(float)))) )
387382
{
388383
ms_log (2, "Error, cannot re-allocate buffer for sample conversion\n");
389384
return -1;
@@ -396,7 +391,7 @@ convertsamples (MSRecord *msr, int packencoding)
396391
/* Convert to doubles */
397392
else if ( encodingtype == 'd' )
398393
{
399-
if ( (ddata = (double *) malloc (msr->sampletype * sizeof(double))) )
394+
if ( ! (ddata = (double *) malloc ((size_t)(msr->numsamples * sizeof(double)))) )
400395
{
401396
ms_log (2, "Error, cannot allocate buffer for sample conversion to doubles\n");
402397
return -1;
@@ -423,7 +418,7 @@ convertsamples (MSRecord *msr, int packencoding)
423418
}
424419

425420
return 0;
426-
} /* End of packencoding() */
421+
} /* End of convertsamples() */
427422

428423

429424
/***************************************************************************
@@ -542,7 +537,7 @@ parameter_proc (int argcount, char **argvec)
542537
/* Make sure network code is valid */
543538
if ( netcode )
544539
{
545-
if ( strlen(netcode) > 2 || strlen(netcode) < 0 )
540+
if ( strlen(netcode) > 2 || strlen(netcode) < 1 )
546541
{
547542
ms_log (2, "Error, invalid output network code: '%s'\n", netcode);
548543
exit (1);

libmseed/example/msview.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
#define VERSION "[libmseed " LIBMSEED_VERSION " example]"
2828
#define PACKAGE "msview"
2929

30-
static short int verbose = 0;
31-
static short int ppackets = 0;
32-
static short int basicsum = 0;
33-
static int reclen = -1;
34-
static char *inputfile = 0;
30+
static flag verbose = 0;
31+
static flag ppackets = 0;
32+
static flag basicsum = 0;
33+
static int reclen = -1;
34+
static char *inputfile = 0;
3535

3636
static int parameter_proc (int argcount, char **argvec);
3737
static void usage (void);
@@ -43,8 +43,8 @@ main (int argc, char **argv)
4343
MSRecord *msr = 0;
4444

4545
int dataflag = 0;
46-
int totalrecs = 0;
47-
int totalsamps = 0;
46+
int64_t totalrecs = 0;
47+
int64_t totalsamps = 0;
4848
int retcode;
4949

5050
#ifndef WIN32
@@ -85,7 +85,8 @@ main (int argc, char **argv)
8585
ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, 0);
8686

8787
if ( basicsum )
88-
ms_log (1, "Records: %d, Samples: %d\n", totalrecs, totalsamps);
88+
ms_log (1, "Records: %lld, Samples: %lld\n",
89+
(long long int)totalrecs, (long long int)totalsamps);
8990

9091
return 0;
9192
} /* End of main() */

libmseed/example/test.mseed

10 KB
Binary file not shown.

0 commit comments

Comments
 (0)