Commit 9b412e31 authored by Matteo Quintiliani's avatar Matteo Quintiliani

Removed fields buffer and length from structure NMXP_DATA_PROCESS


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@1260 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent 9b645544
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxp_data.h,v 1.35 2009-04-21 14:42:05 mtheo Exp $ * $Id: nmxp_data.h,v 1.36 2009-08-17 08:19:46 mtheo Exp $
* *
*/ */
...@@ -122,8 +122,6 @@ typedef struct { ...@@ -122,8 +122,6 @@ typedef struct {
int32_t oldest_seq_no; /*!< \brief Oldest Sequence number */ int32_t oldest_seq_no; /*!< \brief Oldest Sequence number */
int32_t seq_no; /*!< \brief Sequence number */ int32_t seq_no; /*!< \brief Sequence number */
double time; /*!< \brief Time first sample. Epochs. */ double time; /*!< \brief Time first sample. Epochs. */
void *buffer; /*!< \brief Nanometrics packet data */
int32_t length; /*!< \brief Packet length */
int *pDataPtr; /*!< \brief Array of samples */ int *pDataPtr; /*!< \brief Array of samples */
int32_t nSamp; /*!< \brief Number or samples */ int32_t nSamp; /*!< \brief Number or samples */
int32_t sampRate; /*!< \brief Sample rate */ int32_t sampRate; /*!< \brief Sample rate */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxp.c,v 1.92 2009-08-16 07:16:40 mtheo Exp $ * $Id: nmxp.c,v 1.93 2009-08-17 08:19:46 mtheo Exp $
* *
*/ */
...@@ -727,10 +727,6 @@ void nmxp_raw_stream_free(NMXP_RAW_STREAM_DATA *raw_stream_buffer) { ...@@ -727,10 +727,6 @@ void nmxp_raw_stream_free(NMXP_RAW_STREAM_DATA *raw_stream_buffer) {
if(raw_stream_buffer->pdlist) { if(raw_stream_buffer->pdlist) {
for(j=0; j<raw_stream_buffer->n_pdlist; j++) { for(j=0; j<raw_stream_buffer->n_pdlist; j++) {
if(raw_stream_buffer->pdlist[j]) { if(raw_stream_buffer->pdlist[j]) {
if(raw_stream_buffer->pdlist[j]->buffer) {
NMXP_MEM_FREE(raw_stream_buffer->pdlist[j]->buffer);
raw_stream_buffer->pdlist[j]->buffer = NULL;
}
if(raw_stream_buffer->pdlist[j]->pDataPtr) { if(raw_stream_buffer->pdlist[j]->pDataPtr) {
NMXP_MEM_FREE(raw_stream_buffer->pdlist[j]->pDataPtr); NMXP_MEM_FREE(raw_stream_buffer->pdlist[j]->pDataPtr);
raw_stream_buffer->pdlist[j]->pDataPtr = NULL; raw_stream_buffer->pdlist[j]->pDataPtr = NULL;
...@@ -771,12 +767,6 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int ...@@ -771,12 +767,6 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int
/* Allocate memory for pd and copy a_pd */ /* Allocate memory for pd and copy a_pd */
pd = (NMXP_DATA_PROCESS *) NMXP_MEM_MALLOC(sizeof(NMXP_DATA_PROCESS)); pd = (NMXP_DATA_PROCESS *) NMXP_MEM_MALLOC(sizeof(NMXP_DATA_PROCESS));
memcpy(pd, a_pd, sizeof(NMXP_DATA_PROCESS)); memcpy(pd, a_pd, sizeof(NMXP_DATA_PROCESS));
if(a_pd->length > 0) {
pd->buffer = NMXP_MEM_MALLOC(pd->length);
memcpy(pd->buffer, a_pd->buffer, a_pd->length);
} else {
pd->buffer = NULL;
}
if(a_pd->nSamp * sizeof(int) > 0) { if(a_pd->nSamp * sizeof(int) > 0) {
pd->pDataPtr = (int *) NMXP_MEM_MALLOC(a_pd->nSamp * sizeof(int)); pd->pDataPtr = (int *) NMXP_MEM_MALLOC(a_pd->nSamp * sizeof(int));
memcpy(pd->pDataPtr, a_pd->pDataPtr, a_pd->nSamp * sizeof(int)); memcpy(pd->pDataPtr, a_pd->pDataPtr, a_pd->nSamp * sizeof(int));
...@@ -849,10 +839,6 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int ...@@ -849,10 +839,6 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int
} }
/* Free handled packet */ /* Free handled packet */
if(p->pdlist[0]->buffer) {
NMXP_MEM_FREE(p->pdlist[0]->buffer);
p->pdlist[0]->buffer = NULL;
}
if(p->pdlist[0]->pDataPtr) { if(p->pdlist[0]->pDataPtr) {
NMXP_MEM_FREE(p->pdlist[0]->pDataPtr); NMXP_MEM_FREE(p->pdlist[0]->pDataPtr);
p->pdlist[0]->pDataPtr = NULL; p->pdlist[0]->pDataPtr = NULL;
...@@ -997,10 +983,6 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int ...@@ -997,10 +983,6 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int
if(j > 0) { if(j > 0) {
for(k=0; k < p->n_pdlist; k++) { for(k=0; k < p->n_pdlist; k++) {
if(k < j) { if(k < j) {
if(p->pdlist[k]->buffer) {
NMXP_MEM_FREE(p->pdlist[k]->buffer);
p->pdlist[k]->buffer = NULL;
}
if(p->pdlist[k]->pDataPtr) { if(p->pdlist[k]->pDataPtr) {
NMXP_MEM_FREE(p->pdlist[k]->pDataPtr); NMXP_MEM_FREE(p->pdlist[k]->pDataPtr);
p->pdlist[k]->pDataPtr = NULL; p->pdlist[k]->pDataPtr = NULL;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxp_base.c,v 1.78 2009-03-10 17:01:50 mtheo Exp $ * $Id: nmxp_base.c,v 1.79 2009-08-17 08:19:46 mtheo Exp $
* *
*/ */
...@@ -524,8 +524,6 @@ NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_da ...@@ -524,8 +524,6 @@ NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_da
/* pd.oldest_seq_no = ;*/ /* pd.oldest_seq_no = ;*/
/* pd.seq_no = ;*/ /* pd.seq_no = ;*/
pd.time = pTime; pd.time = pTime;
pd.buffer = buffer_data;
pd.length = length_data;
pd.nSamp = pNSamp; pd.nSamp = pNSamp;
pd.pDataPtr = pDataPtr; pd.pDataPtr = pDataPtr;
pd.sampRate = pSampRate; pd.sampRate = pSampRate;
...@@ -714,8 +712,6 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data ...@@ -714,8 +712,6 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data
pd.oldest_seq_no = nmx_oldest_sequence_number; pd.oldest_seq_no = nmx_oldest_sequence_number;
pd.seq_no = nmx_seqno; pd.seq_no = nmx_seqno;
pd.time = pTime; pd.time = pTime;
pd.buffer = buffer_data;
pd.length = length_data;
pd.nSamp = pNSamp; pd.nSamp = pNSamp;
pd.pDataPtr = pDataPtr; pd.pDataPtr = pDataPtr;
pd.sampRate = pSampRate; pd.sampRate = pSampRate;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxp_data.c,v 1.68 2009-08-14 12:59:25 mtheo Exp $ * $Id: nmxp_data.c,v 1.69 2009-08-17 08:19:46 mtheo Exp $
* *
*/ */
...@@ -90,8 +90,6 @@ int nmxp_data_init(NMXP_DATA_PROCESS *pd) { ...@@ -90,8 +90,6 @@ int nmxp_data_init(NMXP_DATA_PROCESS *pd) {
pd->oldest_seq_no = -1; pd->oldest_seq_no = -1;
pd->seq_no = -1; pd->seq_no = -1;
pd->time = -1.0; pd->time = -1.0;
pd->buffer = NULL;
pd->length = 0;
pd->pDataPtr = NULL; pd->pDataPtr = NULL;
pd->nSamp = 0; pd->nSamp = 0;
pd->sampRate = -1; pd->sampRate = -1;
...@@ -364,7 +362,7 @@ int nmxp_data_log(NMXP_DATA_PROCESS *pd, int flag_sample) { ...@@ -364,7 +362,7 @@ int nmxp_data_log(NMXP_DATA_PROCESS *pd, int flag_sample) {
/* nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "%12d %5s.%3s rate=%03d (%s - %s) [%d, %d] pts=%04d (%d, %d, %d, %d) lat=%.1f len=%d\n", */ /* nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "%12d %5s.%3s rate=%03d (%s - %s) [%d, %d] pts=%04d (%d, %d, %d, %d) lat=%.1f len=%d\n", */
/* printf("%10d %5s.%3s 03dHz (%s - %s) lat=%.1fs [%d, %d] pts=%04d (%d, %d, %d, %d) len=%d\n", */ /* printf("%10d %5s.%3s 03dHz (%s - %s) lat=%.1fs [%d, %d] pts=%04d (%d, %d, %d, %d) len=%d\n", */
nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "%s.%s.%3s %3dHz (%s - %s) lat %.1fs [%d, %d] (%d) %4dpts (%d, %d, %d, %d, %d) %d\n", nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "%s.%s.%3s %3dHz (%s - %s) lat %.1fs [%d, %d] (%d) %4dpts (%d, %d, %d, %d, %d)\n",
/* pd->key, */ /* pd->key, */
NMXP_LOG_STR(pd->network), NMXP_LOG_STR(pd->network),
(strlen(pd->station) == 0)? "XXXX" : NMXP_LOG_STR(pd->station), (strlen(pd->station) == 0)? "XXXX" : NMXP_LOG_STR(pd->station),
...@@ -381,8 +379,7 @@ int nmxp_data_log(NMXP_DATA_PROCESS *pd, int flag_sample) { ...@@ -381,8 +379,7 @@ int nmxp_data_log(NMXP_DATA_PROCESS *pd, int flag_sample) {
(pd->pDataPtr == NULL)? 0 : pd->pDataPtr[0], (pd->pDataPtr == NULL)? 0 : pd->pDataPtr[0],
(pd->pDataPtr == NULL || pd->nSamp < 1)? 0 : pd->pDataPtr[pd->nSamp-1], (pd->pDataPtr == NULL || pd->nSamp < 1)? 0 : pd->pDataPtr[pd->nSamp-1],
pd->xn, pd->xn,
pd->x0n_significant, pd->x0n_significant
pd->length
); );
if(pd->pDataPtr && flag_sample != 0 && pd->nSamp > 0) { if(pd->pDataPtr && flag_sample != 0 && pd->nSamp > 0) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxptool.c,v 1.215 2009-08-16 07:12:16 mtheo Exp $ * $Id: nmxptool.c,v 1.216 2009-08-17 08:19:46 mtheo Exp $
* *
*/ */
...@@ -671,12 +671,6 @@ int main (int argc, char **argv) { ...@@ -671,12 +671,6 @@ int main (int argc, char **argv) {
} }
/* Free pd->buffer */
if(pd->buffer) {
NMXP_MEM_FREE(pd->buffer);
pd->buffer = NULL;
}
/* Receive Data */ /* Receive Data */
ret = nmxp_receiveMessage(naqssock, &type, &buffer, &length, 0, &recv_errno); ret = nmxp_receiveMessage(naqssock, &type, &buffer, &length, 0, &recv_errno);
/* nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CONNFLOW, "ret = %d, type = %d\n", ret, type); */ /* nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CONNFLOW, "ret = %d, type = %d\n", ret, type); */
...@@ -979,11 +973,6 @@ int main (int argc, char **argv) { ...@@ -979,11 +973,6 @@ int main (int argc, char **argv) {
if(pd->nSamp > 0) { if(pd->nSamp > 0) {
channelList_Seq[cur_chan].x_1 = pd->pDataPtr[pd->nSamp-1]; channelList_Seq[cur_chan].x_1 = pd->pDataPtr[pd->nSamp-1];
} }
/* Free pd->buffer */
if(pd->buffer) {
NMXP_MEM_FREE(pd->buffer);
pd->buffer = NULL;
}
} }
#ifdef HAVE_EARTHWORMOBJS #ifdef HAVE_EARTHWORMOBJS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment