fix various compiler warnings

Change-Id: I65a862132563f578eff11b8d085960b820f5d4b7
This commit is contained in:
Harald Welte 2019-11-06 16:21:55 +01:00
parent 6f45dcdc25
commit 6df0729271
3 changed files with 13 additions and 5 deletions

View File

@ -53,7 +53,7 @@ static char *timeval2str(struct timeval *tv)
time_t nowtime;
struct tm *nowtm;
char tmbuf[64];
static char buf[64];
static char buf[64+20];
nowtime = tv->tv_sec;
nowtm = localtime(&nowtime);
@ -62,6 +62,7 @@ static char *timeval2str(struct timeval *tv)
return buf;
}
#if 0
static int all_bytes_are(unsigned char ch, const uint8_t *data, int len)
{
int i;
@ -72,6 +73,7 @@ static int all_bytes_are(unsigned char ch, const uint8_t *data, int len)
}
return 1;
}
#endif
static void handle_hdlc_frame_content(const uint8_t *data, unsigned int len,
void *priv)
@ -151,6 +153,8 @@ static void handle_sc_in(struct osmo_e1cap_pkthdr *pkt, const uint8_t *data, uns
static void handle_data(struct osmo_e1cap_pkthdr *pkt, uint8_t *data, int len)
{
struct timeval tv;
flip_buf_bits(data, len);
#if 0
/* filter out all-ff/all-fe/all-7f */
@ -170,8 +174,10 @@ static void handle_data(struct osmo_e1cap_pkthdr *pkt, uint8_t *data, int len)
switch (g_mode) {
case MODE_PRINT:
tv.tv_sec = pkt->ts.tv_sec;
tv.tv_usec = pkt->ts.tv_usec;
printf("%s %02u/%02u %u (%u): %s\n",
timeval2str(&pkt->ts),
timeval2str(&tv),
pkt->line_nr, pkt->ts_nr, pkt->capture_mode,
pkt->len,
osmo_hexdump_nospc(data, len));

View File

@ -12,12 +12,11 @@ static void hdlc_process_hex_str(struct hdlc_proc *hdlc, const char *hex)
int string_len = strlen(hex);
int byte_len = string_len/2;
int bit_len = byte_len*8;
int rc;
printf("hex string = %s\n", hex);
bytes = alloca(byte_len);
bits = alloca(bit_len);
rc = osmo_hexparse(hex, bytes, byte_len);
osmo_hexparse(hex, bytes, byte_len);
printf("parsed bytes = %s\n", osmo_hexdump(bytes, byte_len));
printf("MSB mode\n");

View File

@ -66,6 +66,7 @@ static int storage_reopen_if_needed(void)
int e1frame_store(struct e1inp_ts *ts, struct msgb *msg, enum osmo_e1cap_capture_mode mode)
{
struct osmo_e1cap_pkthdr _h, *h = &_h;
struct timeval tv;
int rc;
struct iovec iov[2] = {
{
@ -78,7 +79,9 @@ int e1frame_store(struct e1inp_ts *ts, struct msgb *msg, enum osmo_e1cap_capture
};
h->len = htonl(msg->len);
gettimeofday(&h->ts, NULL);
gettimeofday(&tv, NULL);
h->ts.tv_sec = tv.tv_sec;
h->ts.tv_usec = tv.tv_usec;
h->line_nr = ts->line->num;
h->ts_nr = ts->num;
h->capture_mode = mode;