From 478221e5d3b8e002e2d1ed27743947242e2ec426 Mon Sep 17 00:00:00 2001 From: "kurtis.heimerl" Date: Sat, 22 Dec 2012 04:30:56 +0000 Subject: [PATCH] Correction of trivial warnings. git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4670 19bc5d8c-e614-43d4-8b26-e1612bc8e597 --- CLI/CLI.cpp | 19 ++++++++++--------- CommonLibs/ConfigurationTest.cpp | 2 +- CommonLibs/URLEncode.cpp | 2 +- GSM/GSML2LAPDm.h | 2 +- SIP/SIPEngine.cpp | 16 ++++++++-------- SIP/SIPMessage.cpp | 8 ++++---- SIP/SIPUtility.cpp | 2 +- Transceiver52M/DummyLoad.cpp | 4 ++-- TransceiverRAD1/DummyLoad.cpp | 8 ++++---- TransceiverRAD1/sigProcLib.h | 4 ++-- apps/OpenBTS.cpp | 4 ++-- 11 files changed, 36 insertions(+), 35 deletions(-) diff --git a/CLI/CLI.cpp b/CLI/CLI.cpp index dd559e01..e7da6da6 100644 --- a/CLI/CLI.cpp +++ b/CLI/CLI.cpp @@ -284,14 +284,14 @@ int tmsis(int argc, char** argv, ostream& os) int isIMSI(const char *imsi) { - int i = 0; - if (!imsi) return 0; - if (strlen(imsi) != 15) + + size_t imsiLen = strlen(imsi); + if (imsiLen != 15) return 0; - for (i = 0; i < strlen(imsi); i++) { + for (size_t i = 0; i < imsiLen; i++) { if (!isdigit(imsi[i])) return 0; } @@ -461,14 +461,15 @@ int cellID(int argc, char** argv, ostream& os) /** Print table of current transactions. */ -int calls(int argc, char** argv, ostream& os) +int calls(int argc, char** /*argv*/, ostream& os) { - bool showAll = false; - if (argc==2) showAll = true; - if (argc>2) return BAD_NUM_ARGS; - size_t count = gTransactionTable.dump(os); + if (argc > 2) + return BAD_NUM_ARGS; + //fix later -kurtis + //bool showAll = (argc == 2); //size_t count = gTransactionTable.dump(os,showAll); + size_t count = gTransactionTable.dump(os); os << endl << count << " transactions in table" << endl; return SUCCESS; } diff --git a/CommonLibs/ConfigurationTest.cpp b/CommonLibs/ConfigurationTest.cpp index a21ea86b..3a2045f6 100644 --- a/CommonLibs/ConfigurationTest.cpp +++ b/CommonLibs/ConfigurationTest.cpp @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) gConfig.setUpdateHook(purgeConfig); - char *keys[5] = {"key1", "key2", "key3", "key4", "key5"}; + const char *keys[5] = {"key1", "key2", "key3", "key4", "key5"}; for (int i=0; i<5; i++) { gConfig.set(keys[i],i); diff --git a/CommonLibs/URLEncode.cpp b/CommonLibs/URLEncode.cpp index 870db332..025ef606 100644 --- a/CommonLibs/URLEncode.cpp +++ b/CommonLibs/URLEncode.cpp @@ -35,7 +35,7 @@ string URLEncode(const string &c) { static const char *digits = "01234567890ABCDEF"; string retVal=""; - for (int i=0; i(strlen(xml))); osip_message_set_content_length(invite, strdup(tmp)); osip_message_set_body(invite,xml,strlen(xml)); } @@ -485,7 +485,7 @@ SIPState SIPEngine::SOSSendINVITE(short wRtp_port, unsigned wCodec, const GSM:: osip_message_free(invite); mState = Starting; return mState; -}; +} SIPState SIPEngine::MOCSendINVITE( const char * wCalledUsername, @@ -526,7 +526,7 @@ SIPState SIPEngine::MOCSendINVITE( const char * wCalledUsername, osip_message_free(invite); mState = Starting; return mState; -}; +} SIPState SIPEngine::MOCResendINVITE() @@ -893,7 +893,7 @@ SIPState SIPEngine::MODWaitForCANCELOK(Mutex *lock) static bool containsResponse(vector *validResponses, unsigned code) { - for (int i = 0; i < validResponses->size(); i++) { + for (size_t i = 0; i < validResponses->size(); i++) { if (validResponses->at(i) == code) return true; } diff --git a/SIP/SIPMessage.cpp b/SIP/SIPMessage.cpp index 88557a2d..3ccb5ad5 100644 --- a/SIP/SIPMessage.cpp +++ b/SIP/SIPMessage.cpp @@ -328,7 +328,7 @@ osip_message_t * SIP::sip_message( const char * dialed_number, const char * sip_ } // Content-Length - sprintf(temp_buf,"%u",strlen(message)); + sprintf(temp_buf,"%u", static_cast(strlen(message))); osip_message_set_content_length(request, strdup(temp_buf)); // Payload. @@ -645,7 +645,7 @@ osip_message_t * SIP::sip_ack(const char * req_uri, const char * dialed_number, } -osip_message_t * SIP::sip_bye(const char * req_uri, const char * dialed_number, const char * sip_username, short wlocal_port, const char * local_ip, const char * proxy_ip, short wproxy_port, const osip_from_t* from_header, const osip_to_t* to_header, const char * via_branch, const osip_call_id_t* call_id_header, int cseq) { +osip_message_t * SIP::sip_bye(const char * req_uri, const char * dialed_number, const char * sip_username, short wlocal_port, const char * local_ip, const char * /*proxy_ip*/, short wproxy_port, const osip_from_t* from_header, const osip_to_t* to_header, const char * via_branch, const osip_call_id_t* call_id_header, int cseq) { // FIXME -- We really need some NULL-value error checking in here. @@ -1005,7 +1005,7 @@ osip_message_t * SIP::sip_ringing( osip_message_t * invite, const char * sip_use } -osip_message_t * SIP::sip_okay( osip_message_t * inv, const char * sip_username, const char * local_ip, short wlocal_port) +osip_message_t * SIP::sip_okay( osip_message_t * inv, const char* /*sip_username*/, const char* /*local_ip*/, short wlocal_port) { // Check for consistency. @@ -1048,7 +1048,7 @@ osip_message_t * SIP::sip_okay( osip_message_t * inv, const char * sip_username, } -osip_message_t * SIP::sip_info(unsigned info, const char *dialed_number, short rtp_port, const char * sip_username, short wlocal_port, const char * local_ip, const char * proxy_ip, const char * from_tag, const char * via_branch, const osip_call_id_t *call_id_header, int cseq) { +osip_message_t * SIP::sip_info(unsigned info, const char *dialed_number, short /*rtp_port*/, const char * sip_username, short wlocal_port, const char * local_ip, const char * proxy_ip, const char * from_tag, const char * via_branch, const osip_call_id_t *call_id_header, int cseq) { char local_port[10]; sprintf(local_port, "%i", wlocal_port); diff --git a/SIP/SIPUtility.cpp b/SIP/SIPUtility.cpp index 4cb21d7c..0b31866d 100644 --- a/SIP/SIPUtility.cpp +++ b/SIP/SIPUtility.cpp @@ -99,7 +99,7 @@ void SIP::make_branch( char * branch ) uint64_t r1 = random(); uint64_t r2 = random(); uint64_t val = (r1<<32) + r2; - sprintf(branch,"z9hG4bKobts28%llx", val); + sprintf(branch,"z9hG4bKobts28%llx", static_cast(val)); } /* get the return address from the SIP VIA header diff --git a/Transceiver52M/DummyLoad.cpp b/Transceiver52M/DummyLoad.cpp index d11226e2..38718a07 100644 --- a/Transceiver52M/DummyLoad.cpp +++ b/Transceiver52M/DummyLoad.cpp @@ -97,11 +97,11 @@ int DummyLoad::readSamples(short *buf, int len, bool *overrun, underrunLock.unlock(); if (currstamp+len < timestamp) { usleep(100); - return NULL; + return 0; } else if (currstamp < timestamp) { usleep(100); - return NULL; + return 0; } else if (timestamp+len < currstamp) { memcpy(buf,dummyBurst+dummyBurstCursor*2,sizeof(short)*2*(dummyBurstSz-dummyBurstCursor)); diff --git a/TransceiverRAD1/DummyLoad.cpp b/TransceiverRAD1/DummyLoad.cpp index d11226e2..056fbf7f 100644 --- a/TransceiverRAD1/DummyLoad.cpp +++ b/TransceiverRAD1/DummyLoad.cpp @@ -86,10 +86,10 @@ bool DummyLoad::stop() // NOTE: Assumes sequential reads -int DummyLoad::readSamples(short *buf, int len, bool *overrun, +int DummyLoad::readSamples(short *buf, int len, bool* /*overrun*/, TIMESTAMP timestamp, bool *wUnderrun, - unsigned *RSSI) + unsigned* /*RSSI*/) { updateTime(); underrunLock.lock(); @@ -97,11 +97,11 @@ int DummyLoad::readSamples(short *buf, int len, bool *overrun, underrunLock.unlock(); if (currstamp+len < timestamp) { usleep(100); - return NULL; + return 0; } else if (currstamp < timestamp) { usleep(100); - return NULL; + return 0; } else if (timestamp+len < currstamp) { memcpy(buf,dummyBurst+dummyBurstCursor*2,sizeof(short)*2*(dummyBurstSz-dummyBurstCursor)); diff --git a/TransceiverRAD1/sigProcLib.h b/TransceiverRAD1/sigProcLib.h index e99904aa..7fe93de1 100644 --- a/TransceiverRAD1/sigProcLib.h +++ b/TransceiverRAD1/sigProcLib.h @@ -32,13 +32,13 @@ using namespace GSM; /** Indicated signalVector symmetry */ -typedef enum Symmetry { +enum Symmetry { NONE = 0, ABSSYM = 1 }; /** Convolution type indicator */ -typedef enum ConvType { +enum ConvType { FULL_SPAN = 0, OVERLAP_ONLY = 1, START_ONLY = 2, diff --git a/apps/OpenBTS.cpp b/apps/OpenBTS.cpp index 402b02e1..c380c584 100644 --- a/apps/OpenBTS.cpp +++ b/apps/OpenBTS.cpp @@ -116,8 +116,8 @@ void startTransceiver() // Start the transceiver binary, if the path is defined. // If the path is not defined, the transceiver must be started by some other process. - char TRXnumARFCN[4]; - sprintf(TRXnumARFCN,"%1d",gConfig.getNum("GSM.Radio.ARFCNs")); + char TRXnumARFCN[16]; + sprintf(TRXnumARFCN,"%1d", static_cast(gConfig.getNum("GSM.Radio.ARFCNs"))); LOG(NOTICE) << "starting transceiver " << transceiverPath << " " << TRXnumARFCN; gTransceiverPid = vfork(); LOG_ASSERT(gTransceiverPid>=0);