lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/38281?usp=email )


Change subject: Use %d instead of %i
......................................................................

Use %d instead of %i

%d and %i has the same meaning when used in format string for printf.
The linter will warn when using %i. %i was only added to provide
symmetry between scanf() and printf().

Change-Id: Icd5f5f9b0d2ed8fd82afa406787acb4bd95358bf
---
M src/sgsn/gprs_ranap.c
M src/sgsn/slhc.c
M tests/slhc/slhc_test.c
M tests/sndcp_xid/sndcp_xid_test.c
M tests/v42bis/v42bis_test.c
M tests/xid/xid_test.c
6 files changed, 15 insertions(+), 15 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/81/38281/1

diff --git a/src/sgsn/gprs_ranap.c b/src/sgsn/gprs_ranap.c
index 51954ce..76e375f 100644
--- a/src/sgsn/gprs_ranap.c
+++ b/src/sgsn/gprs_ranap.c
@@ -168,7 +168,7 @@
                rc = 0;
                break;
        default:
-               LOGMMCTXP(LOGL_NOTICE, mm, "Unknown event received: %i\n", 
type);
+               LOGMMCTXP(LOGL_NOTICE, mm, "Unknown event received: %d\n", 
type);
                rc = -1;
                break;
        }
diff --git a/src/sgsn/slhc.c b/src/sgsn/slhc.c
index 20e571d..ab13167 100644
--- a/src/sgsn/slhc.c
+++ b/src/sgsn/slhc.c
@@ -388,7 +388,7 @@
                DEBUGP(DSLHC, "slhc_compress(): Unexpected change: th->doff != 
cs->cs_tcp.doff\n");
        if(ip->ihl > 5 && memcmp(ip+1,cs->cs_ipopt,((ip->ihl)-5)*4) != 0) {
                DEBUGP(DSLHC, "slhc_compress(): Unexpected change: (ip->ihl > 5 
&& memcmp(ip+1,cs->cs_ipopt,((ip->ihl)-5)*4) != 0)\n");
-               DEBUGP(DSLHC, "slhc_compress(): ip->ihl = %i\n", ip->ihl);
+               DEBUGP(DSLHC, "slhc_compress(): ip->ihl = %d\n", ip->ihl);
                DEBUGP(DSLHC, "slhc_compress(): ip+1 =          %s\n",
                       osmo_hexdump_nospc((uint8_t*)(ip+1),((ip->ihl)-5)*4));
                DEBUGP(DSLHC, "slhc_compress(): Unexpected change: cs->cs_ipopt 
=  %s\n",
@@ -396,7 +396,7 @@
        }
        if(th->doff > 5 && memcmp(th+1,cs->cs_tcpopt,((th->doff)-5)*4) != 0) {
                DEBUGP(DSLHC, "slhc_compress(): Unexpected change: (th->doff > 
5 && memcmp(th+1,cs->cs_tcpopt,((th->doff)-5)*4) != 0)\n");
-               DEBUGP(DSLHC, "slhc_compress(): th->doff = %i\n", th->doff);
+               DEBUGP(DSLHC, "slhc_compress(): th->doff = %d\n", th->doff);
                DEBUGP(DSLHC, "slhc_compress(): th+1 =          %s\n",
                       osmo_hexdump_nospc((uint8_t*)(th+1),((th->doff)-5)*4));
                DEBUGP(DSLHC, "slhc_compress(): cs->cs_tcpopt = %s\n",
@@ -539,7 +539,7 @@
 /* deltaS is now the size of the change section of the compressed header */

        DEBUGP(DSLHC, "slhc_compress(): Delta-list length (deltaS) = 
%li\n",deltaS);
-       DEBUGP(DSLHC, "slhc_compress(): Original header len (hlen) = 
%i\n",hlen);
+       DEBUGP(DSLHC, "slhc_compress(): Original header len (hlen) = 
%d\n",hlen);

        memcpy(cp,new_seq,deltaS);      /* Write list of deltas */
        memcpy(cp+deltaS,icp+hlen,isize-hlen);
diff --git a/tests/slhc/slhc_test.c b/tests/slhc/slhc_test.c
index 5c13313..9013623 100644
--- a/tests/slhc/slhc_test.c
+++ b/tests/slhc/slhc_test.c
@@ -209,12 +209,12 @@
                        packet_len = DISP_MAX_BYTES;
                if (packet_decompr_len > DISP_MAX_BYTES)
                        packet_decompr_len = DISP_MAX_BYTES;
-               printf("Original Packet:    (%i bytes) %s\n", packet_len,
+               printf("Original Packet:    (%d bytes) %s\n", packet_len,
                       osmo_hexdump_nospc(packet, packet_len));
-               printf("DecompressedPacket: (%i bytes) %s\n",
+               printf("DecompressedPacket: (%d bytes) %s\n",
                       packet_decompr_len, osmo_hexdump_nospc(packet_decompr,
                                                              
packet_decompr_len));
-               printf("CompressedPacket:   (%i bytes) %s\n", packet_compr_len,
+               printf("CompressedPacket:   (%d bytes) %s\n", packet_compr_len,
                       osmo_hexdump_nospc(packet_compr, packet_compr_len));
                slhc_o_status(comp);
                slhc_o_status(comp);
diff --git a/tests/sndcp_xid/sndcp_xid_test.c b/tests/sndcp_xid/sndcp_xid_test.c
index 56b97e3..fca44fc 100644
--- a/tests/sndcp_xid/sndcp_xid_test.c
+++ b/tests/sndcp_xid/sndcp_xid_test.c
@@ -55,7 +55,7 @@
        /* Encode comp-fields again */
        rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields,
                                    DEFAULT_SNDCP_VERSION);
-       printf("Result length=%i\n",rc);
+       printf("Result length=%d\n",rc);
        printf("Encoded:  %s\n", osmo_hexdump_nospc(xid, sizeof(xid)));
        printf("Rencoded: %s\n", osmo_hexdump_nospc(xid_r, rc));

@@ -231,7 +231,7 @@
                                    DEFAULT_SNDCP_VERSION);
        OSMO_ASSERT(rc > 0);

-       printf("Encoded:  %s (%i bytes)\n", osmo_hexdump_nospc(xid, rc), rc);
+       printf("Encoded:  %s (%d bytes)\n", osmo_hexdump_nospc(xid, rc), rc);

        /* Parse and show contained comp fields */
        comp_fields_dec = gprs_sndcp_parse_xid(NULL, ctx, xid, rc, NULL);
diff --git a/tests/v42bis/v42bis_test.c b/tests/v42bis/v42bis_test.c
index e9c5069..7ada0e2 100644
--- a/tests/v42bis/v42bis_test.c
+++ b/tests/v42bis/v42bis_test.c
@@ -268,7 +268,7 @@
        rc_sum += rc;

        /* Check results */
-       printf("Mode: %i\n", mode);
+       printf("Mode: %d\n", mode);
 
        printf("uncompressed_original= %s ASCII:",
               osmo_hexdump_nospc(uncompressed_original, len));
@@ -314,7 +314,7 @@
        int len;
        printf
            ("Testing compression/decompression with realistic TCP/IP 
packets:\n");
-       printf("Packet No.: %i\n", packet_id);
+       printf("Packet No.: %d\n", packet_id);
        len = strlen(uncompr_packets[packet_id]);
        testvec = talloc_zero_size(ctx, len);
        len = osmo_hexparse(uncompr_packets[packet_id], testvec, len);
@@ -339,7 +339,7 @@

        printf
            ("Testing decompression with sniffed compressed TCP/IP packets:\n");
-       printf("Packet No.: %i\n", packet_id);
+       printf("Packet No.: %d\n", packet_id);
        len = strlen(compr_packets[packet_id]);

        uncompressed = talloc_zero_size(ctx, len);
diff --git a/tests/xid/xid_test.c b/tests/xid/xid_test.c
index 89d82e9..5963d4f 100644
--- a/tests/xid/xid_test.c
+++ b/tests/xid/xid_test.c
@@ -73,8 +73,8 @@
        /* Encode data */
        rc = gprs_llc_compile_xid(xid, sizeof(xid), &xid_fields);
        OSMO_ASSERT(rc == 14);
-       printf("Encoded:  %s (%i bytes)\n", osmo_hexdump_nospc(xid, rc), rc);
-       printf("Expected: %s (%i bytes)\n",
+       printf("Encoded:  %s (%d bytes)\n", osmo_hexdump_nospc(xid, rc), rc);
+       printf("Expected: %s (%d bytes)\n",
               osmo_hexdump_nospc(xid_expected, sizeof(xid_expected)),
               (int)sizeof(xid_expected));

@@ -112,7 +112,7 @@

        /* Encode xid-fields again */
        rc = gprs_llc_compile_xid(xid_r, sizeof(xid_r), xid_fields);
-       printf("Result length=%i\n",rc);
+       printf("Result length=%d\n",rc);
        printf("Encoded:  %s\n", osmo_hexdump_nospc(xid, sizeof(xid)));
        printf("Rencoded: %s\n", osmo_hexdump_nospc(xid_r, rc));


--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/38281?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Icd5f5f9b0d2ed8fd82afa406787acb4bd95358bf
Gerrit-Change-Number: 38281
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <[email protected]>

Reply via email to