Commit f71da8ae authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #7242: fix warnings in daemon

Check return codes of calls to system
parent 4ef4e203
...@@ -178,7 +178,7 @@ DBUS_CPP_REQUIRED_VERSION=0.6.0-pre1 ...@@ -178,7 +178,7 @@ DBUS_CPP_REQUIRED_VERSION=0.6.0-pre1
PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,, PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,,
AC_MSG_ERROR([You need the DBus-c++ libraries (version $DBUS_CPP_REQUIRED_VERSION or better)])) AC_MSG_ERROR([You need the DBus-c++ libraries (version $DBUS_CPP_REQUIRED_VERSION or better)]))
CXXFLAGS="${CXXFLAGS} -g -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor" CXXFLAGS="${CXXFLAGS} -g -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor -Werror"
AC_CHECK_LIB([expat], XML_ParserCreate_MM, AC_CHECK_LIB([expat], XML_ParserCreate_MM,
[AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)], [AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)],
......
...@@ -169,8 +169,6 @@ void DelayDetection::process(SFLDataFormat *inputData, int nbSamples) ...@@ -169,8 +169,6 @@ void DelayDetection::process(SFLDataFormat *inputData, int nbSamples)
return; return;
crossCorrelate(spkrReferenceDown_, captureDataDown_, correlationResult_, micDownSize_, spkrDownSize_); crossCorrelate(spkrReferenceDown_, captureDataDown_, correlationResult_, micDownSize_, spkrDownSize_);
int maxIndex = getMaxIndex(correlationResult_, spkrDownSize_);
} }
void DelayDetection::crossCorrelate(float *ref, float *seg, float *res, int refSize, int segSize) void DelayDetection::crossCorrelate(float *ref, float *seg, float *res, int refSize, int segSize)
......
...@@ -113,7 +113,7 @@ class DelayDetection { ...@@ -113,7 +113,7 @@ class DelayDetection {
void bandpassFilter(float *input, int nbSamples); void bandpassFilter(float *input, int nbSamples);
int getMaxIndex(float *data, int size); static int getMaxIndex(float *data, int size);
State internalState_; State internalState_;
......
...@@ -1601,7 +1601,7 @@ void ManagerImpl::peerHungupCall(const std::string& call_id) ...@@ -1601,7 +1601,7 @@ void ManagerImpl::peerHungupCall(const std::string& call_id)
removeStream(call_id); removeStream(call_id);
if (getCallList().empty()) { if (getCallList().empty()) {
DEBUG("Manager: Stop audio stream, ther is only %d call(s) remaining", getCallList().size()); DEBUG("Manager: Stop audio stream, there are no calls remaining");
audioLayerMutexLock(); audioLayerMutexLock();
audiodriver_->stopStream(); audiodriver_->stopStream();
...@@ -2784,7 +2784,7 @@ ManagerImpl::getAccount(const std::string& accountID) const ...@@ -2784,7 +2784,7 @@ ManagerImpl::getAccount(const std::string& accountID) const
std::string ManagerImpl::getAccountIdFromNameAndServer(const std::string& userName, const std::string& server) const std::string ManagerImpl::getAccountIdFromNameAndServer(const std::string& userName, const std::string& server) const
{ {
INFO("Manager : username = %s , server = %s", userName.c_str(), server.c_str()); INFO("Manager : username = %s, server = %s", userName.c_str(), server.c_str());
// Try to find the account id from username and server name by full match // Try to find the account id from username and server name by full match
for (AccountMap::const_iterator iter = accountMap_.begin(); iter != accountMap_.end(); ++iter) { for (AccountMap::const_iterator iter = accountMap_.begin(); iter != accountMap_.end(); ++iter) {
......
...@@ -40,10 +40,24 @@ ...@@ -40,10 +40,24 @@
using std::cout; using std::cout;
using std::endl; using std::endl;
namespace {
void restore()
{
if (system("mv " HISTORY_SAMPLE ".bak " HISTORY_SAMPLE) < 0)
ERROR("Restoration of %s failed" HISTORY_SAMPLE);
}
void backup()
{
if (system("cp " HISTORY_SAMPLE " " HISTORY_SAMPLE ".bak") < 0)
ERROR("Backup of %s failed", HISTORY_SAMPLE);
}
}
void HistoryTest::setUp() void HistoryTest::setUp()
{ {
system("cp " HISTORY_SAMPLE " " HISTORY_SAMPLE ".bak"); backup();
// Instanciate the cleaner singleton // Instantiate the cleaner singleton
history = new HistoryManager(); history = new HistoryManager();
} }
...@@ -226,5 +240,5 @@ void HistoryTest::tearDown() ...@@ -226,5 +240,5 @@ void HistoryTest::tearDown()
// Delete the history object // Delete the history object
delete history; delete history;
history = 0; history = 0;
system("mv " HISTORY_SAMPLE ".bak " HISTORY_SAMPLE); restore();
} }
...@@ -39,6 +39,19 @@ ...@@ -39,6 +39,19 @@
#include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TextTestRunner.h> #include <cppunit/ui/text/TextTestRunner.h>
namespace {
void restore()
{
if (system("mv " CONFIG_SAMPLE ".bak " CONFIG_SAMPLE) < 0)
ERROR("Restoration of %s failed", CONFIG_SAMPLE);
}
void backup()
{
if (system("cp " CONFIG_SAMPLE " " CONFIG_SAMPLE ".bak") < 0)
ERROR("Backup of %s failed", CONFIG_SAMPLE);
}
}
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
printf("\nSFLphone Daemon Test Suite, by Savoir-Faire Linux 2004-2010\n\n"); printf("\nSFLphone Daemon Test Suite, by Savoir-Faire Linux 2004-2010\n\n");
...@@ -90,7 +103,7 @@ int main(int argc, char* argv[]) ...@@ -90,7 +103,7 @@ int main(int argc, char* argv[])
} }
printf("\n\n=== SFLphone initialization ===\n\n"); printf("\n\n=== SFLphone initialization ===\n\n");
system("cp " CONFIG_SAMPLE " " CONFIG_SAMPLE ".bak"); backup();
Manager::instance().init(CONFIG_SAMPLE); Manager::instance().init(CONFIG_SAMPLE);
// Get the top level suite from the registry // Get the top level suite from the registry
...@@ -99,7 +112,7 @@ int main(int argc, char* argv[]) ...@@ -99,7 +112,7 @@ int main(int argc, char* argv[])
if (suite->getChildTestCount() == 0) { if (suite->getChildTestCount() == 0) {
ERROR("Invalid test suite name: %s", testSuiteName.c_str()); ERROR("Invalid test suite name: %s", testSuiteName.c_str());
system("mv " CONFIG_SAMPLE ".bak " CONFIG_SAMPLE); restore();
return 1; return 1;
} }
...@@ -122,7 +135,7 @@ int main(int argc, char* argv[]) ...@@ -122,7 +135,7 @@ int main(int argc, char* argv[])
Manager::instance().terminate(); Manager::instance().terminate();
system("mv " CONFIG_SAMPLE ".bak " CONFIG_SAMPLE); restore();
return wasSuccessful ? 0 : 1; return wasSuccessful ? 0 : 1;
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment