Commit 108add27 authored by Jussi Lindgren's avatar Jussi Lindgren

Everything: errno was not reseted properly before function calls

n.b. errno state is never cleared by the system functions themselves.
If the state is not manually cleared its value may be unrelated
to the current scope and be a result of some previous call elsewhere.
parent c622c329
......@@ -220,6 +220,7 @@ namespace oscpkt {
int sent = 0;
do {
int res;
errno = 0;
if (isBound()) {
res = sendto(handle, (const char*)ptr, (int)sz, 0, &addr.addr(), (int)addr.actualLen());
} else {
......
......@@ -114,6 +114,7 @@ bool CModTemporalFilterBoxAlgorithm::updateSettings()
if(m_sFilterOrder!=l_oFilterOrder)
{
errno = 0;
int64 l_i64Integer64Parameter = strtol(l_oFilterOrder, &l_pEndPtr, 10);
if(l_i64Integer64Parameter <= 0 || (errno !=0 && l_i64Integer64Parameter == 0) || *l_pEndPtr != '\0' || errno == ERANGE)
{
......@@ -132,6 +133,8 @@ bool CModTemporalFilterBoxAlgorithm::updateSettings()
if(m_sLowBand!=l_oLowPassBandEdge)
{
TParameterHandler<float64> ip_f64HighCutFrequency(m_pComputeModTemporalFilterCoefficients->getInputParameter(OVP_Algorithm_ComputeTemporalFilterCoefficients_InputParameterId_HighCutFrequency));
errno = 0;
float64 l_f64Float64Parameter = strtod(l_oLowPassBandEdge, &l_pEndPtr);
if(l_f64Float64Parameter < 0 || (errno !=0 && l_f64Float64Parameter == 0) || *l_pEndPtr != '\0' || errno == ERANGE)
{
......@@ -156,6 +159,7 @@ bool CModTemporalFilterBoxAlgorithm::updateSettings()
if(m_sHighBand!=l_oHighPassBandEdge)
{
TParameterHandler<float64> ip_f64LowCutFrequency(m_pComputeModTemporalFilterCoefficients->getInputParameter(OVP_Algorithm_ComputeTemporalFilterCoefficients_InputParameterId_LowCutFrequency));
errno = 0;
float64 l_f64Float64Parameter = strtod(l_oHighPassBandEdge, &l_pEndPtr);
if(l_f64Float64Parameter < 0 || (errno !=0 && l_f64Float64Parameter == 0) || *l_pEndPtr != '\0' || errno == ERANGE)
{
......@@ -179,6 +183,7 @@ bool CModTemporalFilterBoxAlgorithm::updateSettings()
if(m_sPassBandRiple!=l_oPassBandRipple)
{
errno = 0;
float64 l_f64Float64Parameter = strtod(l_oPassBandRipple, &l_pEndPtr);;
if((errno !=0 && l_f64Float64Parameter == 0) || *l_pEndPtr != '\0' || errno == ERANGE)
{
......
......@@ -66,7 +66,7 @@ boolean CTemporalFilterBoxAlgorithm::initialize(void)
TParameterHandler<uint64> ip_ui64KindFilter(m_pComputeTemporalFilterCoefficients->getInputParameter(OVP_Algorithm_ComputeTemporalFilterCoefficients_InputParameterId_FilterType));
ip_ui64KindFilter=l_ui64UInteger64Parameter;
errno = 0;
l_i64Integer64Parameter = strtol(l_oFilterOrder, &l_pEndPtr, 10);
if(l_i64Integer64Parameter <= 0 || (errno !=0 && l_i64Integer64Parameter == 0) || *l_pEndPtr != '\0' || errno == ERANGE)
{
......@@ -76,7 +76,7 @@ boolean CTemporalFilterBoxAlgorithm::initialize(void)
TParameterHandler<uint64> ip_ui64FilterOrder(m_pComputeTemporalFilterCoefficients->getInputParameter(OVP_Algorithm_ComputeTemporalFilterCoefficients_InputParameterId_FilterOrder));
ip_ui64FilterOrder=l_i64Integer64Parameter;
errno = 0;
l_f64Float64Parameter = strtod(l_oLowPassBandEdge, &l_pEndPtr);
if(l_f64Float64Parameter < 0 || (errno !=0 && l_f64Float64Parameter == 0) || *l_pEndPtr != '\0' || errno == ERANGE)
{
......@@ -86,7 +86,7 @@ boolean CTemporalFilterBoxAlgorithm::initialize(void)
TParameterHandler<float64> ip_f64LowCutFrequency(m_pComputeTemporalFilterCoefficients->getInputParameter(OVP_Algorithm_ComputeTemporalFilterCoefficients_InputParameterId_LowCutFrequency));
ip_f64LowCutFrequency=l_f64Float64Parameter;
errno = 0;
l_f64Float64Parameter = strtod(l_oHighPassBandEdge, &l_pEndPtr);
if(l_f64Float64Parameter < 0 || (errno !=0 && l_f64Float64Parameter == 0) || *l_pEndPtr != '\0' || errno == ERANGE)
{
......@@ -102,8 +102,7 @@ boolean CTemporalFilterBoxAlgorithm::initialize(void)
TParameterHandler<float64> ip_f64HighCutFrequency(m_pComputeTemporalFilterCoefficients->getInputParameter(OVP_Algorithm_ComputeTemporalFilterCoefficients_InputParameterId_HighCutFrequency));
ip_f64HighCutFrequency=l_f64Float64Parameter;
errno = 0;
l_f64Float64Parameter = strtod(l_oPassBandRipple, &l_pEndPtr);;
if((errno !=0 && l_f64Float64Parameter == 0) || *l_pEndPtr != '\0' || errno == ERANGE)
{
......
......@@ -518,6 +518,7 @@ boolean COgreObject::loadWorldMatrix()
//stop at first whitespace char or when vector end is found
if(std::isspace(*l_oIt, l_oLocale) == true || *l_oIt == ']')
{
errno = 0;
float64 l_f64Value = atof(l_sCurString.c_str());
#if defined TARGET_OS_Windows
if(errno == ERANGE)
......@@ -558,6 +559,7 @@ boolean COgreObject::loadWorldMatrix()
//stop at first whitespace char or when vector end is found
if(std::isspace(*l_oIt, l_oLocale) == true || *l_oIt == ']')
{
errno = 0;
float64 l_f64Value = atof(l_sCurString.c_str());
#if defined TARGET_OS_Windows
if(errno == ERANGE)
......@@ -598,6 +600,7 @@ boolean COgreObject::loadWorldMatrix()
//stop at first whitespace char or when vector end is found
if(std::isspace(*l_oIt, l_oLocale) == true || *l_oIt == ']')
{
errno = 0;
float64 l_f64Value = atof(l_sCurString.c_str());
#if defined TARGET_OS_Windows
if(errno == ERANGE)
......
......@@ -81,6 +81,7 @@ namespace Socket
l_oServerAddress.sin_family=AF_INET;
l_oServerAddress.sin_port=htons((unsigned short)ui32ServerPort);
l_oServerAddress.sin_addr=*((struct in_addr*)l_pServerHostEntry->h_addr);
errno = 0;
if(::connect(m_i32Socket, (struct sockaddr*)&l_oServerAddress, sizeof(struct sockaddr_in))<0)
{
boolean l_bInProgress=false;
......
#include "ovpCAlgorithmOVMatrixFileReader.h"
#include <system/ovCMemory.h>
#include <sstream>
#include <locale>
#if defined TARGET_OS_Windows
#include <cerrno>
#endif
#include <cstring>
#include <cstdlib>
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace OpenViBE::Plugins;
......
#include "ovpCAlgorithmOVMatrixFileWriter.h"
#include <system/ovCMemory.h>
#include <sstream>
#if defined TARGET_OS_Windows
#include <cerrno>
#endif
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace OpenViBE::Plugins;
......
......@@ -15,7 +15,6 @@
#include <stack>
#include <cstdio>
#include <cerrno>
namespace OpenViBEPlugins
{
......
......@@ -6,7 +6,7 @@
#include <cmath>
#include <cstdlib>
#include <cfloat>
#include <cerrno>
// for save/load
#include <fstream>
......@@ -507,6 +507,7 @@ boolean OpenViBEToolkit::Tools::Matrix::fromString(OpenViBE::IMatrix& rMatrix, c
}
//retrieve value
errno = 0;
const float64 l_f64Value = atof(l_sCurString.c_str());
#if defined TARGET_OS_Windows
if(errno == ERANGE)
......
Markdown is supported
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