From bd89957287441872706432d1e283091b4e5cdbc8 Mon Sep 17 00:00:00 2001 From: bustico Date: Thu, 20 Jun 2013 08:38:59 +0000 Subject: fix compilation warning --- tools/ivyperf.c | 6 ------ tools/ivyprobe.c | 31 +++++++++++++++++++++++++++++-- tools/ivytestready.c | 15 ++++++++++++++- tools/ivythroughput.cpp | 40 +++++++++++++++++++++++++++++++++++----- 4 files changed, 78 insertions(+), 14 deletions(-) (limited to 'tools') diff --git a/tools/ivyperf.c b/tools/ivyperf.c index 8683692..a7845f0 100644 --- a/tools/ivyperf.c +++ b/tools/ivyperf.c @@ -74,17 +74,11 @@ void Pong (IvyClientPtr app, void *user_data, int argc, char *argv[]) { double current; double ts; - double tr; - double roundtrip1; - double roundtrip2; double roundtrip3; nbMsgReceive++; current = currentTime() - origin ; ts = atof( *argv++ ); - tr = atof( *argv++ ); - roundtrip1 = tr-ts; - roundtrip2 = current - tr; roundtrip3 = current - ts; if ( roundtrip3 > maxRoundTrip ) maxRoundTrip = roundtrip3; if ( roundtrip3 < minRoundTrip ) minRoundTrip = roundtrip3; diff --git a/tools/ivyprobe.c b/tools/ivyprobe.c index 5111358..6e5f3e1 100644 --- a/tools/ivyprobe.c +++ b/tools/ivyprobe.c @@ -88,7 +88,6 @@ void DirectCallback(IvyClientPtr app, void *user_data, int id, char *msg ) void PongCallback (IvyClientPtr app, int roundTripOrTimout) { - int i; if (roundTripOrTimout >= 0) { printf ("%s respond to ping in %.3f ms\n", IvyGetApplicationName(app), roundTripOrTimout/1000.0); @@ -172,7 +171,14 @@ void HandleStdin (Channel channel, IVY_HANDLE fd, void *data) printf("Error compiling '%s', %s, not bound\n", arg, errbuf); } else { IvyBindingFree( binding ); - IvyBindMsg (Callback, NULL, arg); +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-security" +#endif + IvyBindMsg (Callback, NULL, arg); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } } @@ -236,7 +242,14 @@ void HandleStdin (Channel channel, IVY_HANDLE fd, void *data) } } else { cmd = strtok (buf, "\n"); +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-security" +#endif err = IvySendMsg (cmd); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif printf("-> Sent to %d peer%s\n", err, err == 1 ? "" : "s"); } } @@ -341,7 +354,14 @@ void BindMsgOfFile( const char * regex_file ) if ( size > 1 ) { line[size-1] = '\0'; /* supress \n */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-security" +#endif IvyBindMsg (Callback, NULL, line); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } } } @@ -434,7 +454,14 @@ int main(int argc, char *argv[]) for (; optind < argc; optind++) { printf("Binding to '%s'\n", argv[optind] ); +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-security" +#endif IvyBindMsg (Callback, NULL, argv[optind]); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } diff --git a/tools/ivytestready.c b/tools/ivytestready.c index 4f839ef..35e0eae 100755 --- a/tools/ivytestready.c +++ b/tools/ivytestready.c @@ -85,6 +85,10 @@ void binCB( IvyClientPtr app, void *user_data, int id, const char* regexp, IvyB } } + + + + int main(int argc, char *argv[]) { @@ -98,8 +102,17 @@ int main(int argc, char *argv[]) } IvyInit (me, ready_message, NULL,NULL,NULL,NULL); - IvySetBindCallback( binCB, 0 ), + IvySetBindCallback( binCB, 0 ); + +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-security" +#endif IvyBindMsg (Ready, NULL, ready_bind); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + IvyBindMsg (Question, NULL, "^are you there %s",me); IvyBindMsg (Reply, NULL, "^(yes i am %s)",other); diff --git a/tools/ivythroughput.cpp b/tools/ivythroughput.cpp index 7d6136f..e1734d5 100644 --- a/tools/ivythroughput.cpp +++ b/tools/ivythroughput.cpp @@ -261,7 +261,7 @@ void emetteur (const char* bus, KindOfTest kod, int testDuration, // double origin = currentTime(); - IvySetBindCallback (binCB, (void *) (regexpSize+2)); + IvySetBindCallback (binCB, (void *) (regexpSize+2l)); IvyBindMsg (recepteurReadyCB, (void *) &messages, "^IvyThroughputReceive_(\\d+)\\s+Ready"); @@ -281,6 +281,10 @@ void emetteur (const char* bus, KindOfTest kod, int testDuration, # | | | __/ | (__ | __/ | | \ |_ | __/ | |_| | | | # |_| \___| \___| \___| |_| \__| \___| \__,_| |_| */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-security" +#endif void recepteur_tp (const char* bus, KindOfTest kod, unsigned int inst, const ListOfString& regexps, unsigned int exitAfter) { @@ -301,7 +305,7 @@ void recepteur_tp (const char* bus, KindOfTest kod, unsigned int inst, debugInt++; string reg = *iter; if (regexpAreUniq) { ((reg += "(") += stream.str()) += ")?";} - IvyBindMsg (recepteurCB, (void *) inst, reg.c_str()); + IvyBindMsg (recepteurCB, (void *) long(inst), reg.c_str()); } IvyBindMsg (startOfSeqCB, NULL, "^start(OfSequence)"); IvyBindMsg (endOfSeqCB, NULL, "^end(OfSequence)"); @@ -309,13 +313,16 @@ void recepteur_tp (const char* bus, KindOfTest kod, unsigned int inst, if (kod == memoryLeak2) { TimerRepeatAfter (1, exitAfter*1000, exitCB, NULL); } else if (kod == disconnect) { - TimerRepeatAfter (1, exitAfter*1000/3, doNothingAndSuicideCB, (void *) exitAfter); + TimerRepeatAfter (1, exitAfter*1000/3, doNothingAndSuicideCB, (void *) long(exitAfter)); } //usleep (inst * 50 * 1000); IvyStart (bus); IvyMainLoop (); } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif void recepteur_ml (const char* bus, KindOfTest kod, unsigned int inst, const ListOfString& regexps) @@ -339,7 +346,15 @@ void recepteur_ml (const char* bus, KindOfTest kod, unsigned int inst, debugInt++; string reg = *iter; if (regexpAreUniq) { (reg += " ") += stream.str();} - bindIdList.push_back (IvyBindMsg (recepteurCB, (void *) inst, reg.c_str())); +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-security" +#endif + bindIdList.push_back (IvyBindMsg (recepteurCB, (void *) long(inst), reg.c_str())); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + } IvyBindMsg (startOfSeqCB, NULL, "^start(OfSequence)"); IvyBindMsg (endOfSeqCB, NULL, "^end(OfSequence)"); @@ -540,7 +555,14 @@ void sendAllMessageCB (TimerId id, void *user_data, unsigned long delta) IvySendMsg ("startOfSequence"); ListOfString::iterator iter; for (iter=messages->begin(); iter != messages->end(); iter++) { +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-security" +#endif envoyes += IvySendMsg ((*iter).c_str()); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } IvySendMsg ("endOfSequence"); @@ -619,7 +641,15 @@ void desabonneEtReabonneCB (TimerId id, void *user_data, unsigned long delta) ListOfString::const_iterator iter2; for (iter2=mds->regexps->begin(); iter2 != mds->regexps->end(); iter2++) { string reg = *iter2; - mds->bindIdList->push_back (IvyBindMsg (recepteurCB, (void *) mds->inst, reg.c_str())); +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-security" +#endif + mds->bindIdList->push_back (IvyBindMsg (recepteurCB, (void *) long(mds->inst), + reg.c_str())); +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } // CHANGE REGEXP -- cgit v1.1