Commit f98ab6d9 authored by Matteo Quintiliani's avatar Matteo Quintiliani

Substitude int with int32_t


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@199 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent 4aa85e7d
......@@ -114,16 +114,16 @@ typedef enum {
/*! \brief Body of ConnectRequest message*/
typedef struct {
char username[12];
uint32_t version;
uint32_t connection_time;
uint32_t crc32;
int32_t version;
int32_t connection_time;
int32_t crc32;
} NMXP_CONNECT_REQUEST;
/*! \brief Body of DataRequest message*/
typedef struct {
uint32_t chan_key;
uint32_t start_time;
uint32_t end_time;
int32_t chan_key;
int32_t start_time;
int32_t end_time;
} NMXP_DATA_REQUEST;
......@@ -178,7 +178,7 @@ int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList);
* \retval SOCKET_ERROR on error
*
*/
int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, int32_t shortTermCompletion, uint32_t out_format, NMXP_BUFFER_FLAG buffer_flag);
int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag);
/*! \brief Receive Compressed or Decompressed Data message from a socket and launch func_processData() on the extracted data
......@@ -205,7 +205,7 @@ NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList, cons
* \retval SOCKET_ERROR on error
*
*/
int nmxp_sendConnectRequest(int isock, char *naqs_username, char *naqs_password, uint32_t connection_time);
int nmxp_sendConnectRequest(int isock, char *naqs_username, char *naqs_password, int32_t connection_time);
/*! \brief Read connection time from a socket
......@@ -217,7 +217,7 @@ int nmxp_sendConnectRequest(int isock, char *naqs_username, char *naqs_password,
* \retval SOCKET_ERROR on error
*
*/
int nmxp_readConnectionTime(int isock, uint32_t *connection_time);
int nmxp_readConnectionTime(int isock, int32_t *connection_time);
/*! \brief Wait the message "Ready" from a socket
......@@ -242,7 +242,7 @@ int nmxp_waitReady(int isock);
* \retval SOCKET_ERROR on error
*
*/
int nmxp_sendDataRequest(int isock, uint32_t key, uint32_t start_time, uint32_t end_time);
int nmxp_sendDataRequest(int isock, int32_t key, int32_t start_time, int32_t end_time);
/*! \brief Get the list of available channels from a server
......
......@@ -87,7 +87,7 @@ int nmxp_recv_ctrl(int isock, void *buffer, int length);
* \retval NMXP_SOCKET_ERROR on error
*
*/
int nmxp_sendHeader(int isock, NMXP_MSG_CLIENT type, uint32_t length);
int nmxp_sendHeader(int isock, NMXP_MSG_CLIENT type, int32_t length);
/*! \brief Receives header of a message.
......@@ -100,7 +100,7 @@ int nmxp_sendHeader(int isock, NMXP_MSG_CLIENT type, uint32_t length);
* \retval NMXP_SOCKET_ERROR on error
*
*/
int nmxp_receiveHeader(int isock, NMXP_MSG_SERVER *type, uint32_t *length);
int nmxp_receiveHeader(int isock, NMXP_MSG_SERVER *type, int32_t *length);
/*! \brief Sends header and body of a message.
......@@ -114,7 +114,7 @@ int nmxp_receiveHeader(int isock, NMXP_MSG_SERVER *type, uint32_t *length);
* \retval NMXP_SOCKET_ERROR on error
*
*/
int nmxp_sendMessage(int isock, NMXP_MSG_CLIENT type, void *buffer, uint32_t length);
int nmxp_sendMessage(int isock, NMXP_MSG_CLIENT type, void *buffer, int32_t length);
/*! \brief Receives header and body of a message.
......@@ -130,7 +130,7 @@ int nmxp_sendMessage(int isock, NMXP_MSG_CLIENT type, void *buffer, uint32_t len
* \retval NMXP_SOCKET_ERROR on error
*
*/
int nmxp_receiveMessage(int isock, NMXP_MSG_SERVER *type, void **buffer, uint32_t *length);
int nmxp_receiveMessage(int isock, NMXP_MSG_SERVER *type, void **buffer, int32_t *length);
/*! \brief Process Compressed Data message by function func_processData().
......
......@@ -43,7 +43,7 @@ typedef struct {
/*! \brief Channel list */
typedef struct {
uint32_t number;
int32_t number;
NMXP_CHAN_KEY channel[MAX_N_CHAN];
} NMXP_CHAN_LIST;
......@@ -51,13 +51,13 @@ typedef struct {
typedef struct {
int32_t key;
char name[12];
uint32_t start_time;
uint32_t end_time;
int32_t start_time;
int32_t end_time;
} NMXP_CHAN_PRECISITEM;
/*! \brief Precis Channel list */
typedef struct {
uint32_t number;
int32_t number;
NMXP_CHAN_PRECISITEM channel[MAX_N_CHAN];
} NMXP_CHAN_PRECISLIST;
......
......@@ -82,9 +82,9 @@ typedef enum {
/*! \brief Header for all messages. */
typedef struct {
uint32_t signature;
uint32_t type;
uint32_t length;
int32_t signature;
int32_t type;
int32_t length;
} NMXP_MESSAGE_HEADER;
......@@ -99,22 +99,22 @@ typedef struct {
/*! \brief Parameter structure for functions that process data */
typedef struct {
int key; /*!< \brief Channel Key */
int32_t key; /*!< \brief Channel Key */
char network[NETWORK_LENGTH]; /*!< \brief Network code */
char station[STATION_LENGTH]; /*!< \brief Station code */
char channel[CHANNEL_LENGTH]; /*!< \brief Channel code */
int packet_type; /*!< \brief Packet type */
int x0; /*!< \brief First sample. It is significant only if x0n_significant != 0 */
int xn; /*!< \brief Last sample. It is significant only if x0n_significant != 0 */
int x0n_significant; /*!< \brief Declare if xn significant */
int oldest_seq_no; /*!< \brief Oldest Sequence number */
int seq_no; /*!< \brief Sequence number */
int32_t packet_type; /*!< \brief Packet type */
int32_t x0; /*!< \brief First sample. It is significant only if x0n_significant != 0 */
int32_t xn; /*!< \brief Last sample. It is significant only if x0n_significant != 0 */
int32_t x0n_significant; /*!< \brief Declare if xn significant */
int32_t oldest_seq_no; /*!< \brief Oldest Sequence number */
int32_t seq_no; /*!< \brief Sequence number */
double time; /*!< \brief Time first sample. Epochs. */
void *buffer; /*!< \brief Nanometrics packet data */
int length; /*!< \brief Packet length */
int32_t length; /*!< \brief Packet length */
int *pDataPtr; /*!< \brief Array of samples */
int nSamp; /*!< \brief Number or samples */
int sampRate; /*!< \brief Sample rate */
int32_t nSamp; /*!< \brief Number or samples */
int32_t sampRate; /*!< \brief Sample rate */
} NMXP_DATA_PROCESS;
......@@ -146,7 +146,7 @@ int nmxp_data_init(NMXP_DATA_PROCESS *pd);
* doug@seismo.berkeley.edu
*
*/
int nmxp_data_unpack_bundle (int *outdata, unsigned char *indata, int *prev);
int nmxp_data_unpack_bundle (int32_t *outdata, unsigned char *indata, int32_t *prev);
/* \brief Value for parameter exclude_bitmap in the function nmxp_data_trim() */
......
......@@ -31,7 +31,7 @@ int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList) {
NMXP_MSG_SERVER type;
void *buffer;
uint32_t length;
int32_t length;
*pchannelList = NULL;
......@@ -59,11 +59,11 @@ int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList) {
}
int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, int32_t shortTermCompletion, uint32_t out_format, NMXP_BUFFER_FLAG buffer_flag) {
int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag) {
int ret;
uint32_t buffer_length = 16 + (4 * channelList->number);
int32_t buffer_length = 16 + (4 * channelList->number);
char *buffer = malloc(buffer_length);
uint32_t app, i, disp;
int32_t app, i, disp;
disp=0;
......@@ -101,7 +101,7 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, int32_
NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList, const char *network_code) {
NMXP_MSG_SERVER type;
void *buffer = NULL;
uint32_t length;
int32_t length;
NMXP_DATA_PROCESS *pd = NULL;
if(nmxp_receiveMessage(isock, &type, &buffer, &length) == NMXP_SOCKET_OK) {
......@@ -120,7 +120,7 @@ NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList, cons
}
int nmxp_sendConnectRequest(int isock, char *naqs_username, char *naqs_password, uint32_t connection_time) {
int nmxp_sendConnectRequest(int isock, char *naqs_username, char *naqs_password, int32_t connection_time) {
int ret;
char crc32buf[100];
NMXP_CONNECT_REQUEST connectRequest;
......@@ -161,7 +161,7 @@ int nmxp_sendConnectRequest(int isock, char *naqs_username, char *naqs_password,
}
int nmxp_readConnectionTime(int isock, uint32_t *connection_time) {
int nmxp_readConnectionTime(int isock, int32_t *connection_time) {
int ret;
ret = nmxp_recv_ctrl(isock, connection_time, sizeof(connection_time));
*connection_time = ntohl(*connection_time);
......@@ -239,7 +239,7 @@ int nmxp_waitReady(int isock) {
}
int nmxp_sendDataRequest(int isock, uint32_t key, uint32_t start_time, uint32_t end_time) {
int nmxp_sendDataRequest(int isock, int32_t key, int32_t start_time, int32_t end_time) {
int ret;
NMXP_DATA_REQUEST dataRequest;
......@@ -318,14 +318,14 @@ NMXP_META_CHAN_LIST *nmxp_getMetaChannelList(char * hostname, int portnum, NMXP_
NMXP_META_CHAN_LIST *chan_list = NULL;
NMXP_META_CHAN_LIST *iter = NULL;
int i = 0;
uint32_t connection_time;
int32_t connection_time;
char *datas_username = NULL, *datas_password = NULL;
int ret_sock;
NMXP_MSG_SERVER type;
void *buffer = NULL;
uint32_t length;
int32_t length;
NMXP_MSGBODY_PRECISLISTREQUEST precisListRequestBody;
NMXP_MSGBODY_CHANNELINFOREQUEST channelInfoRequestBody;
NMXP_MSGBODY_CHANNELINFORESPONSE *channelInfo;
......
......@@ -147,7 +147,7 @@ int nmxp_recv_ctrl(int isock, void* buffer, int length)
}
int nmxp_sendHeader(int isock, NMXP_MSG_CLIENT type, uint32_t length)
int nmxp_sendHeader(int isock, NMXP_MSG_CLIENT type, int32_t length)
{
NMXP_MESSAGE_HEADER msg;
......@@ -159,7 +159,7 @@ int nmxp_sendHeader(int isock, NMXP_MSG_CLIENT type, uint32_t length)
}
int nmxp_receiveHeader(int isock, NMXP_MSG_SERVER *type, uint32_t *length)
int nmxp_receiveHeader(int isock, NMXP_MSG_SERVER *type, int32_t *length)
{
int ret ;
NMXP_MESSAGE_HEADER msg;
......@@ -192,7 +192,7 @@ int nmxp_receiveHeader(int isock, NMXP_MSG_SERVER *type, uint32_t *length)
}
int nmxp_sendMessage(int isock, NMXP_MSG_CLIENT type, void *buffer, uint32_t length) {
int nmxp_sendMessage(int isock, NMXP_MSG_CLIENT type, void *buffer, int32_t length) {
int ret;
ret = nmxp_sendHeader(isock, type, length);
if( ret == NMXP_SOCKET_OK) {
......@@ -204,7 +204,7 @@ int nmxp_sendMessage(int isock, NMXP_MSG_CLIENT type, void *buffer, uint32_t len
}
int nmxp_receiveMessage(int isock, NMXP_MSG_SERVER *type, void **buffer, uint32_t *length) {
int nmxp_receiveMessage(int isock, NMXP_MSG_SERVER *type, void **buffer, int32_t *length) {
int ret;
*buffer = NULL;
*length = 0;
......@@ -316,28 +316,28 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data
static NMXP_DATA_PROCESS pd;
const int nmx_rate_code_to_sample_rate[32] = {
int32_t nmx_rate_code_to_sample_rate[32] = {
0,1,2,5,10,20,40,50,
80,100,125,200,250,500,1000,25,
120,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0};
int nmx_oldest_sequence_number;
int32_t nmx_oldest_sequence_number;
char nmx_hdr[25];
unsigned char nmx_ptype;
unsigned int nmx_seconds;
int32_t nmx_seconds;
double nmx_seconds_double;
short int nmx_ticks, nmx_instr_id;
int nmx_seqno;
int16_t nmx_ticks, nmx_instr_id;
int32_t nmx_seqno;
unsigned char nmx_sample_rate;
int nmx_x0;
int rate_code, chan_code, this_sample_rate;
int32_t nmx_x0;
int32_t rate_code, chan_code, this_sample_rate;
int comp_bytecount;
int32_t comp_bytecount;
unsigned char *indata;
int32_t outdata[MAX_OUTDATA];
int nout, i, k;
int prev_xn;
int32_t nout, i, k;
int32_t prev_xn;
// TOREMOVE int my_order = get_my_wordorder();
int my_host_is_bigendian = nmxp_data_bigendianhost();
......@@ -364,8 +364,8 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data
memcpy (&nmx_sample_rate, nmx_hdr+13, 1);
memcpy (&nmx_x0, nmx_hdr+14, 3);
const unsigned int high_scale = 4096 * 2048;
const unsigned int high_scale_p = 4096 * 4096;
const uint32_t high_scale = 4096 * 2048;
const uint32_t high_scale_p = 4096 * 4096;
/* check if nmx_x0 is negative like as signed 3-byte int */
if( (nmx_x0 & high_scale) == high_scale) {
// nmxp_log(0, 1, "WARNING: changed nmx_x0, old value = %d\n", nmx_x0);
......@@ -373,7 +373,7 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data
}
/* TOREMOVE if (my_order != SEED_LITTLE_ENDIAN) { */
if (my_host_is_bigendian) {
nmxp_data_swap_4b ((int *)&nmx_seconds);
nmxp_data_swap_4b ((int32_t *)&nmx_seconds);
nmxp_data_swap_2b (&nmx_ticks);
nmxp_data_swap_2b (&nmx_instr_id);
nmxp_data_swap_4b (&nmx_seqno);
......
......@@ -45,14 +45,14 @@ int nmxp_data_init(NMXP_DATA_PROCESS *pd) {
}
int nmxp_data_unpack_bundle (int *outdata, unsigned char *indata, int *prev)
int nmxp_data_unpack_bundle (int32_t *outdata, unsigned char *indata, int32_t *prev)
{
int nsamples = 0;
int d4[4];
short int d2[2];
int cb[4];
int32_t nsamples = 0;
int32_t d4[4];
int16_t d2[2];
int32_t cb[4];
//mtheo int i, j, k;
int i, j, k=0;
int32_t i, j, k=0;
unsigned char cbits;
/* TOREMOVE int my_order = get_my_wordorder(); */
int my_host_is_bigendian = nmxp_data_bigendianhost();
......@@ -147,8 +147,8 @@ int nmxp_data_trim(NMXP_DATA_PROCESS *pd, double trim_start_time, double trim_en
double first_time, last_time;
int first_nsamples_to_remove = 0;
int last_nsamples_to_remove = 0;
int new_nSamp = 0;
int i;
int32_t new_nSamp = 0;
int32_t i;
if(pd) {
......
......@@ -60,7 +60,7 @@ MSRecord *msr_list_chan[MAX_N_CHAN];
int main (int argc, char **argv) {
uint32_t connection_time;
int32_t connection_time;
int request_SOCKET_OK;
int i_chan, cur_chan;
int exitpdscondition;
......@@ -72,7 +72,7 @@ int main (int argc, char **argv) {
NMXP_MSG_SERVER type;
void *buffer;
uint32_t length;
int32_t length;
int ret;
char filename[500];
......@@ -357,7 +357,7 @@ int main (int argc, char **argv) {
if(params.flag_writefile && outfile) {
/* Write buffer to the output file */
if(outfile && buffer && length > 0) {
int length_int = length;
int32_t length_int = length;
nmxp_data_swap_4b((int32_t *) &length_int);
fwrite(&length_int, sizeof(length_int), 1, outfile);
fwrite(buffer, length, 1, outfile);
......
......@@ -20,14 +20,14 @@ typedef struct {
char *channels;
char *network;
char *location;
uint32_t start_time;
uint32_t end_time;
int32_t start_time;
int32_t end_time;
char *datas_username;
char *datas_password;
int stc;
int rate;
int32_t stc;
int32_t rate;
char *plugin_slink;
int delay;
int32_t delay;
int flag_writeseed;
int flag_verbose;
int flag_listchannels;
......
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