Fix #928: Workaround to fix -Wswitch warning

This commit is contained in:
Kim Grasman 2015-10-13 21:53:38 +02:00 committed by Guenter Obiltschnig
parent e3f98b554a
commit db635739c4

View File

@ -20,6 +20,7 @@
#define Foundation_MemoryStream_INCLUDED
#include "Poco/Bugcheck.h"
#include "Poco/Foundation.h"
#include "Poco/StreamUtil.h"
#include <streambuf>
@ -84,20 +85,24 @@ public:
if (this->gptr() == 0)
return fail;
switch (way)
if (way == std::ios_base::beg)
{
case std::ios_base::beg:
newoff = 0;
break;
case std::ios_base::cur:
}
else if (way == std::ios_base::cur)
{
// cur is not valid if both in and out are specified (Condition 3)
if ((which & std::ios_base::out) != 0)
return fail;
newoff = this->gptr() - this->eback();
break;
case std::ios_base::end:
}
else if (way == std::ios_base::end)
{
newoff = this->egptr() - this->eback();
break;
}
else
{
poco_bugcheck();
}
if ((newoff + off) < 0 || (this->egptr() - this->eback()) < (newoff + off))
@ -110,20 +115,24 @@ public:
if (this->pptr() == 0)
return fail;
switch (way)
if (way == std::ios_base::beg)
{
case std::ios_base::beg:
newoff = 0;
break;
case std::ios_base::cur:
}
else if (way == std::ios_base::cur)
{
// cur is not valid if both in and out are specified (Condition 3)
if ((which & std::ios_base::in) != 0)
return fail;
newoff = this->pptr() - this->pbase();
break;
case std::ios_base::end:
}
else if (way == std::ios_base::end)
{
newoff = this->epptr() - this->pbase();
break;
}
else
{
poco_bugcheck();
}
if (newoff + off < 0 || (this->epptr() - this->pbase()) < newoff + off)