From 319f47336392ec1ccd496274f749de33430453f5 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 4 Apr 2018 12:15:10 +0200 Subject: [PATCH] fix remaining printf warnings --- srsenb/src/enb.cc | 2 +- srsepc/src/hss/hss.cc | 3 ++- srsepc/src/mme/mme_gtpc.cc | 13 +++++++------ srsepc/src/mme/s1ap.cc | 7 ++++--- srsepc/src/spgw/spgw.cc | 7 ++++--- srsue/src/ue_base.cc | 2 +- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index 85cda6185..e91aea7bf 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -296,7 +296,7 @@ void enb::handle_rf_msg(srslte_rf_error_t error) str.erase(std::remove(str.begin(), str.end(), '\n'), str.end()); str.erase(std::remove(str.begin(), str.end(), '\r'), str.end()); str.push_back('\n'); - rf_log.info(str.c_str()); + rf_log.info("%s\n", str.c_str()); } } diff --git a/srsepc/src/hss/hss.cc b/srsepc/src/hss/hss.cc index d9a55960b..9a8db0e3a 100644 --- a/srsepc/src/hss/hss.cc +++ b/srsepc/src/hss/hss.cc @@ -28,6 +28,7 @@ #include #include #include +#include // for printing uint64_t #include "srsepc/hdr/hss/hss.h" #include "srslte/common/security.h" @@ -564,7 +565,7 @@ hss::increment_sqn(uint64_t imsi) sqn++; - m_hss_log->debug("Incremented SQN (IMSI: %015lu) SQN: %d\n", imsi, sqn); + m_hss_log->debug("Incremented SQN (IMSI: %" PRIu64 ") SQN: %" PRIu64 "\n", imsi, sqn); for(int i = 0; i < 6; i++){ ue_ctx->sqn[i] = p[5-i]; diff --git a/srsepc/src/mme/mme_gtpc.cc b/srsepc/src/mme/mme_gtpc.cc index 1f53338c0..7c30bfa3b 100644 --- a/srsepc/src/mme/mme_gtpc.cc +++ b/srsepc/src/mme/mme_gtpc.cc @@ -25,6 +25,7 @@ */ #include +#include // for printing uint64_t #include "srslte/asn1/gtpc.h" #include "srsepc/hdr/mme/mme_gtpc.h" #include "srsepc/hdr/mme/s1ap.h" @@ -115,10 +116,10 @@ mme_gtpc::send_create_session_request(uint64_t imsi) cs_req->sender_f_teid.teid = get_new_ctrl_teid(); cs_req->sender_f_teid.ipv4 = m_mme_gtpc_ip; - m_mme_gtpc_log->info("Next MME control TEID: %lu \n", m_next_ctrl_teid); - m_mme_gtpc_log->info("Allocated MME control TEID: %lu \n", cs_req->sender_f_teid.teid); - m_mme_gtpc_log->console("Creating Session Response -- IMSI: %015lu \n", imsi); - m_mme_gtpc_log->console("Creating Session Response -- MME control TEID: %lu \n", cs_req->sender_f_teid.teid); + m_mme_gtpc_log->info("Next MME control TEID: %d\n", m_next_ctrl_teid); + m_mme_gtpc_log->info("Allocated MME control TEID: %d\n", cs_req->sender_f_teid.teid); + m_mme_gtpc_log->console("Creating Session Response -- IMSI: %" PRIu64 "\n", imsi); + m_mme_gtpc_log->console("Creating Session Response -- MME control TEID: %d\n", cs_req->sender_f_teid.teid); // APN strncpy(cs_req->apn, m_s1ap->m_s1ap_args.mme_apn.c_str(), sizeof(cs_req->apn)-1); @@ -185,7 +186,7 @@ mme_gtpc::handle_create_session_response(srslte::gtpc_pdu *cs_resp_pdu) } uint64_t imsi = id_it->second; - m_mme_gtpc_log->info("MME GTPC Ctrl TEID %d, IMSI %d\n", cs_resp_pdu->header.teid, imsi); + m_mme_gtpc_log->info("MME GTPC Ctrl TEID %" PRIu64 ", IMSI %" PRIu64 "\n", cs_resp_pdu->header.teid, imsi); //Get S-GW Control F-TEID srslte::gtp_fteid_t sgw_ctr_fteid; @@ -309,7 +310,7 @@ mme_gtpc::handle_modify_bearer_response(srslte::gtpc_pdu *mb_resp_pdu) void mme_gtpc::send_delete_session_request(uint64_t imsi) { - m_mme_gtpc_log->info("Sending GTP-C Delete Session Request request. IMSI %d\n",imsi); + m_mme_gtpc_log->info("Sending GTP-C Delete Session Request request. IMSI %" PRIu64 "\n",imsi); srslte::gtpc_pdu del_req_pdu; srslte::gtp_fteid_t sgw_ctr_fteid; srslte::gtp_fteid_t mme_ctr_fteid; diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index 639725ee5..ccd2536c1 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -26,6 +26,7 @@ #include #include +#include // for printing uint64_t #include "srslte/common/bcd_helpers.h" #include "srsepc/hdr/mme/s1ap.h" #include "srslte/asn1/gtpc.h" @@ -486,7 +487,7 @@ s1ap::delete_ue_ctx(uint64_t imsi) ue_ctx_t *ue_ctx = find_ue_ctx_from_imsi(imsi); if(ue_ctx == NULL) { - m_s1ap_log->info("Cannot delete UE context, UE not found. IMSI: %d\n", imsi); + m_s1ap_log->info("Cannot delete UE context, UE not found. IMSI: %" PRIu64 "\n", imsi); return false; } @@ -528,8 +529,8 @@ s1ap::activate_eps_bearer(uint64_t imsi, uint8_t ebi) ue_ecm_ctx_t * ecm_ctx = &ue_ctx_it->second->ecm_ctx; if (ecm_ctx->erabs_ctx[ebi].state != ERAB_CTX_SETUP) { - m_s1ap_log->error("Could not be activate EPS Bearer, bearer in wrong state: MME S1AP Id %d, EPS Bearer id %d, state %d\n",mme_ue_s1ap_id,ebi,ecm_ctx->erabs_ctx[ebi].state); - m_s1ap_log->console("Could not be activate EPS Bearer, bearer in wrong state: MME S1AP Id %d, EPS Bearer id %d\n",mme_ue_s1ap_id,ebi,ecm_ctx->erabs_ctx[ebi].state); + m_s1ap_log->error("Could not be activate EPS Bearer, bearer in wrong state: MME S1AP Id %d, EPS Bearer id %d, state %d\n", mme_ue_s1ap_id, ebi, ecm_ctx->erabs_ctx[ebi].state); + m_s1ap_log->console("Could not be activate EPS Bearer, bearer in wrong state: MME S1AP Id %d, EPS Bearer id %d, state %d\n", mme_ue_s1ap_id, ebi, ecm_ctx->erabs_ctx[ebi].state); return; } diff --git a/srsepc/src/spgw/spgw.cc b/srsepc/src/spgw/spgw.cc index eec7bb4ec..cbd3e524b 100644 --- a/srsepc/src/spgw/spgw.cc +++ b/srsepc/src/spgw/spgw.cc @@ -33,6 +33,7 @@ #include #include #include +#include // for printing uint64_t #include "srsepc/hdr/spgw/spgw.h" #include "srsepc/hdr/mme/mme_gtpc.h" #include "srslte/upper/gtpu.h" @@ -401,7 +402,7 @@ spgw::handle_s1u_pdu(srslte::byte_buffer_t *msg) int n = write(m_sgi_if, msg->msg, msg->N_bytes); if(n<0) { - m_spgw_log->error("Could not write to TUN interface.\n",n); + m_spgw_log->error("Could not write to TUN interface.\n"); } else { @@ -444,8 +445,8 @@ spgw::create_gtp_ctx(struct srslte::gtpc_create_session_request *cs_req) //in_addr_t ue_ip = inet_addr("172.16.0.2"); uint8_t default_bearer_id = 5; - m_spgw_log->console("SPGW: Allocated Ctrl TEID %d\n", spgw_uplink_ctrl_teid); - m_spgw_log->console("SPGW: Allocated User TEID %d\n", spgw_uplink_user_teid); + m_spgw_log->console("SPGW: Allocated Ctrl TEID %" PRIu64 "\n", spgw_uplink_ctrl_teid); + m_spgw_log->console("SPGW: Allocated User TEID %" PRIu64 "\n", spgw_uplink_user_teid); struct in_addr ue_ip_; ue_ip_.s_addr=ue_ip; m_spgw_log->console("SPGW: Allocate UE IP %s\n", inet_ntoa(ue_ip_)); diff --git a/srsue/src/ue_base.cc b/srsue/src/ue_base.cc index c4b4a2a52..b3fc56132 100644 --- a/srsue/src/ue_base.cc +++ b/srsue/src/ue_base.cc @@ -104,7 +104,7 @@ void ue_base::handle_rf_msg(srslte_rf_error_t error) str.erase(std::remove(str.begin(), str.end(), '\n'), str.end()); str.erase(std::remove(str.begin(), str.end(), '\r'), str.end()); str.push_back('\n'); - rf_log.info(str.c_str()); + rf_log.info("%s\n", str.c_str()); } }