mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
Base64Decoder drops 0x0d characters on windows
SF #605 Base64Decoder drops 0x0d characters on windows
This commit is contained in:
@@ -211,6 +211,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(POCO_ARCH)
|
||||||
|
#error "Unknown or Unsupported Hardware Architecture."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define POCO_COMPILER_MSVC
|
#define POCO_COMPILER_MSVC
|
||||||
#elif defined(__clang__)
|
#elif defined(__clang__)
|
||||||
@@ -239,11 +244,8 @@
|
|||||||
#define POCO_COMPILER_IBM_XLC // IBM XL C++
|
#define POCO_COMPILER_IBM_XLC // IBM XL C++
|
||||||
#elif defined (__IBMCPP__) && defined(__COMPILER_VER__)
|
#elif defined (__IBMCPP__) && defined(__COMPILER_VER__)
|
||||||
#define POCO_COMPILER_IBM_XLC_ZOS // IBM z/OS C++
|
#define POCO_COMPILER_IBM_XLC_ZOS // IBM z/OS C++
|
||||||
#endif
|
#else
|
||||||
|
#error "Unknown or Unsupported Compiler."
|
||||||
|
|
||||||
#if !defined(POCO_ARCH)
|
|
||||||
#error "Unknown Hardware Architecture."
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,9 @@ Base32DecoderBuf* Base32DecoderIOS::rdbuf()
|
|||||||
|
|
||||||
Base32Decoder::Base32Decoder(std::istream& istr): Base32DecoderIOS(istr), std::istream(&_buf)
|
Base32Decoder::Base32Decoder(std::istream& istr): Base32DecoderIOS(istr), std::istream(&_buf)
|
||||||
{
|
{
|
||||||
|
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||||
|
unsetf(std::ios_base::skipws);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,9 @@ Base64DecoderBuf* Base64DecoderIOS::rdbuf()
|
|||||||
|
|
||||||
Base64Decoder::Base64Decoder(std::istream& istr): Base64DecoderIOS(istr), std::istream(&_buf)
|
Base64Decoder::Base64Decoder(std::istream& istr): Base64DecoderIOS(istr), std::istream(&_buf)
|
||||||
{
|
{
|
||||||
|
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||||
|
unsetf(std::ios_base::skipws);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
#include "Poco/Base32Decoder.h"
|
#include "Poco/Base32Decoder.h"
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <iterator>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
using Poco::Base32Encoder;
|
using Poco::Base32Encoder;
|
||||||
@@ -182,6 +184,19 @@ void Base32Test::testEncodeDecode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Base32Test::testDecodeCR()
|
||||||
|
{
|
||||||
|
std::istringstream input("BU======");
|
||||||
|
Poco::Base32Decoder decoder(input);
|
||||||
|
std::vector<Poco::UInt8> result;
|
||||||
|
typedef std::istream_iterator<Poco::UInt8> istream_iterator_type;
|
||||||
|
istream_iterator_type eos;
|
||||||
|
std::copy(istream_iterator_type(decoder), eos, std::back_inserter(result));
|
||||||
|
assert(1 == result.size());
|
||||||
|
assert(0x0d == result[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Base32Test::setUp()
|
void Base32Test::setUp()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -199,6 +214,7 @@ CppUnit::Test* Base32Test::suite()
|
|||||||
CppUnit_addTest(pSuite, Base32Test, testEncoder);
|
CppUnit_addTest(pSuite, Base32Test, testEncoder);
|
||||||
CppUnit_addTest(pSuite, Base32Test, testDecoder);
|
CppUnit_addTest(pSuite, Base32Test, testDecoder);
|
||||||
CppUnit_addTest(pSuite, Base32Test, testEncodeDecode);
|
CppUnit_addTest(pSuite, Base32Test, testEncodeDecode);
|
||||||
|
CppUnit_addTest(pSuite, Base32Test, testDecodeCR);
|
||||||
|
|
||||||
return pSuite;
|
return pSuite;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public:
|
|||||||
void testEncoder();
|
void testEncoder();
|
||||||
void testDecoder();
|
void testDecoder();
|
||||||
void testEncodeDecode();
|
void testEncodeDecode();
|
||||||
|
void testDecodeCR();
|
||||||
|
|
||||||
void setUp();
|
void setUp();
|
||||||
void tearDown();
|
void tearDown();
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
#include "Poco/Base64Decoder.h"
|
#include "Poco/Base64Decoder.h"
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <iterator>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
using Poco::Base64Encoder;
|
using Poco::Base64Encoder;
|
||||||
@@ -177,6 +179,19 @@ void Base64Test::testEncodeDecode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Base64Test::testDecodeCR()
|
||||||
|
{
|
||||||
|
std::istringstream input("DQ==");
|
||||||
|
Poco::Base64Decoder decoder(input);
|
||||||
|
std::vector<Poco::UInt8> result;
|
||||||
|
typedef std::istream_iterator<Poco::UInt8> istream_iterator_type;
|
||||||
|
istream_iterator_type eos;
|
||||||
|
std::copy(istream_iterator_type(decoder), eos, std::back_inserter(result));
|
||||||
|
assert(1 == result.size());
|
||||||
|
assert(0x0d == result[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Base64Test::setUp()
|
void Base64Test::setUp()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -194,6 +209,7 @@ CppUnit::Test* Base64Test::suite()
|
|||||||
CppUnit_addTest(pSuite, Base64Test, testEncoder);
|
CppUnit_addTest(pSuite, Base64Test, testEncoder);
|
||||||
CppUnit_addTest(pSuite, Base64Test, testDecoder);
|
CppUnit_addTest(pSuite, Base64Test, testDecoder);
|
||||||
CppUnit_addTest(pSuite, Base64Test, testEncodeDecode);
|
CppUnit_addTest(pSuite, Base64Test, testEncodeDecode);
|
||||||
|
CppUnit_addTest(pSuite, Base64Test, testDecodeCR);
|
||||||
|
|
||||||
return pSuite;
|
return pSuite;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public:
|
|||||||
void testEncoder();
|
void testEncoder();
|
||||||
void testDecoder();
|
void testDecoder();
|
||||||
void testEncodeDecode();
|
void testEncodeDecode();
|
||||||
|
void testDecodeCR();
|
||||||
|
|
||||||
void setUp();
|
void setUp();
|
||||||
void tearDown();
|
void tearDown();
|
||||||
|
|||||||
Reference in New Issue
Block a user