Change in osmo-e1-recorder[master]: fix various compiler warnings

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sun Nov 24 17:44:07 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1-recorder/+/16181 )

Change subject: fix various compiler warnings
......................................................................

fix various compiler warnings

Change-Id: I65a862132563f578eff11b8d085960b820f5d4b7
---
M src/e1cap_dump.c
M src/hdlc-test.c
M src/storage.c
3 files changed, 13 insertions(+), 5 deletions(-)

Approvals:
  laforge: Looks good to me, approved; Verified



diff --git a/src/e1cap_dump.c b/src/e1cap_dump.c
index 1986041..027aa82 100644
--- a/src/e1cap_dump.c
+++ b/src/e1cap_dump.c
@@ -53,7 +53,7 @@
 	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 @@
 	return buf;
 }
 
+#if 0
 static int all_bytes_are(unsigned char ch, const uint8_t *data, int len)
 {
 	int i;
@@ -72,6 +73,7 @@
 	}
 	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_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 @@
 
 	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));
diff --git a/src/hdlc-test.c b/src/hdlc-test.c
index 1c7c6ef..0814ca0 100644
--- a/src/hdlc-test.c
+++ b/src/hdlc-test.c
@@ -12,12 +12,11 @@
 	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");
diff --git a/src/storage.c b/src/storage.c
index bcb50a2..a084535 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -66,6 +66,7 @@
 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 @@
 	};
 
 	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;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-e1-recorder/+/16181
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1-recorder
Gerrit-Branch: master
Gerrit-Change-Id: I65a862132563f578eff11b8d085960b820f5d4b7
Gerrit-Change-Number: 16181
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191124/a3121d68/attachment.htm>


More information about the gerrit-log mailing list