mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:06:02 +02:00
adjusts braces to agreed conventions
This commit is contained in:
parent
f859d8ed9c
commit
7d479af9c7
6 changed files with 111 additions and 108 deletions
|
@ -11,22 +11,22 @@
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
struct Degrees
|
struct Degrees {
|
||||||
{
|
|
||||||
static float pi() { return 180.0f; }
|
static float pi() { return 180.0f; }
|
||||||
static float twicePi() { return 360.0f; }
|
static float twicePi() { return 360.0f; }
|
||||||
static float halfPi() { return 90.0f; }
|
static float halfPi() { return 90.0f; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Radians
|
struct Radians {
|
||||||
{
|
|
||||||
static float pi() { return 3.141592653589793f; }
|
static float pi() { return 3.141592653589793f; }
|
||||||
static float twicePi() { return 6.283185307179586f; }
|
static float twicePi() { return 6.283185307179586f; }
|
||||||
static float halfPi() { return 1.5707963267948966; }
|
static float halfPi() { return 1.5707963267948966; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Rotations
|
struct Rotations {
|
||||||
{
|
|
||||||
static float pi() { return 0.5f; }
|
static float pi() { return 0.5f; }
|
||||||
static float twicePi() { return 1.0f; }
|
static float twicePi() { return 1.0f; }
|
||||||
static float halfPi() { return 0.25f; }
|
static float halfPi() { return 0.25f; }
|
||||||
|
@ -36,8 +36,8 @@ struct Rotations
|
||||||
* Converts an angle from one unit to another.
|
* Converts an angle from one unit to another.
|
||||||
*/
|
*/
|
||||||
template< class UnitFrom, class UnitTo >
|
template< class UnitFrom, class UnitTo >
|
||||||
float angleConvert(float a)
|
float angleConvert(float a) {
|
||||||
{
|
|
||||||
return a * (UnitTo::halfPi() / UnitFrom::halfPi());
|
return a * (UnitTo::halfPi() / UnitFrom::halfPi());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ float angleConvert(float a)
|
||||||
* Clamps an angle to the range of [-180; 180) degrees.
|
* Clamps an angle to the range of [-180; 180) degrees.
|
||||||
*/
|
*/
|
||||||
template< class Unit >
|
template< class Unit >
|
||||||
float angleSignedNormal(float a)
|
float angleSignedNormal(float a) {
|
||||||
{
|
|
||||||
float result = remainder(a, Unit::twicePi());
|
float result = remainder(a, Unit::twicePi());
|
||||||
if (result == Unit::pi())
|
if (result == Unit::pi())
|
||||||
result = -Unit::pi();
|
result = -Unit::pi();
|
||||||
|
@ -58,8 +58,8 @@ float angleSignedNormal(float a)
|
||||||
* Clamps an angle to the range of [0; 360) degrees.
|
* Clamps an angle to the range of [0; 360) degrees.
|
||||||
*/
|
*/
|
||||||
template< class Unit >
|
template< class Unit >
|
||||||
float angleUnsignedNormal(float a)
|
float angleUnsignedNormal(float a) {
|
||||||
{
|
|
||||||
return angleSignedNormal<Unit>(a - Unit::pi()) + Unit::pi();
|
return angleSignedNormal<Unit>(a - Unit::pi()) + Unit::pi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,16 +72,16 @@ float angleUnsignedNormal(float a)
|
||||||
* Both poles can be reached from any azimuthal direction.
|
* Both poles can be reached from any azimuthal direction.
|
||||||
*/
|
*/
|
||||||
template< class Unit >
|
template< class Unit >
|
||||||
void angleHorizontalPolar(float& azimuth, float& altitude)
|
void angleHorizontalPolar(float& azimuth, float& altitude) {
|
||||||
{
|
|
||||||
altitude = angleSignedNormal<Unit>(altitude);
|
altitude = angleSignedNormal<Unit>(altitude);
|
||||||
if (altitude > Unit::halfPi())
|
if (altitude > Unit::halfPi()) {
|
||||||
{
|
|
||||||
altitude = Unit::pi() - altitude;
|
altitude = Unit::pi() - altitude;
|
||||||
azimuth += Unit::pi();
|
azimuth += Unit::pi();
|
||||||
}
|
|
||||||
else if (altitude < -Unit::halfPi())
|
} else if (altitude < -Unit::halfPi()) {
|
||||||
{
|
|
||||||
altitude = -Unit::pi() - altitude;
|
altitude = -Unit::pi() - altitude;
|
||||||
azimuth += Unit::pi();
|
azimuth += Unit::pi();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@ void floodFill(Cursor const& position,
|
||||||
|
|
||||||
|
|
||||||
template< class Strategy, typename Cursor >
|
template< class Strategy, typename Cursor >
|
||||||
struct floodFill_impl : Strategy
|
struct floodFill_impl : Strategy {
|
||||||
{
|
|
||||||
floodFill_impl(Strategy const& s) : Strategy(s) { }
|
floodFill_impl(Strategy const& s) : Strategy(s) { }
|
||||||
|
|
||||||
using Strategy::select;
|
using Strategy::select;
|
||||||
|
@ -33,14 +33,15 @@ struct floodFill_impl : Strategy
|
||||||
using Strategy::defer;
|
using Strategy::defer;
|
||||||
using Strategy::deferred;
|
using Strategy::deferred;
|
||||||
|
|
||||||
void go(Cursor position)
|
void go(Cursor position) {
|
||||||
{
|
|
||||||
Cursor higher, lower, h,l, i;
|
Cursor higher, lower, h,l, i;
|
||||||
bool higherFound, lowerFound, hf, lf;
|
bool higherFound, lowerFound, hf, lf;
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
if (! select(position))
|
if (! select(position)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
process(position);
|
process(position);
|
||||||
|
|
||||||
|
@ -51,33 +52,39 @@ struct floodFill_impl : Strategy
|
||||||
|
|
||||||
i = position, h = higher, l = lower;
|
i = position, h = higher, l = lower;
|
||||||
hf = higherFound, lf = lowerFound;
|
hf = higherFound, lf = lowerFound;
|
||||||
do { right(i), right(h), right(l); yTest(h,hf); yTest(l,lf); }
|
do {
|
||||||
while (selectAndProcess(i));
|
right(i), right(h), right(l); yTest(h,hf); yTest(l,lf);
|
||||||
|
|
||||||
|
} while (selectAndProcess(i));
|
||||||
|
|
||||||
i = position, h = higher, l = lower;
|
i = position, h = higher, l = lower;
|
||||||
hf = higherFound, lf = lowerFound;
|
hf = higherFound, lf = lowerFound;
|
||||||
do { left(i); left(h); left(l); yTest(h,hf); yTest(l,lf); }
|
do {
|
||||||
while (selectAndProcess(i));
|
left(i); left(h); left(l); yTest(h,hf); yTest(l,lf);
|
||||||
}
|
|
||||||
while (deferred(position));
|
} while (selectAndProcess(i));
|
||||||
|
|
||||||
|
} while (deferred(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool selectAndProcess(Cursor const& i)
|
bool selectAndProcess(Cursor const& i) {
|
||||||
{
|
|
||||||
if (select(i))
|
if (select(i)) {
|
||||||
{
|
|
||||||
process(i);
|
process(i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void yTest(Cursor const& i, bool& state)
|
void yTest(Cursor const& i, bool& state) {
|
||||||
{
|
|
||||||
if (! select(i))
|
if (! select(i)) {
|
||||||
|
|
||||||
state = false;
|
state = false;
|
||||||
else if (! state)
|
|
||||||
{
|
} else if (! state) {
|
||||||
|
|
||||||
state = true;
|
state = true;
|
||||||
defer(i);
|
defer(i);
|
||||||
}
|
}
|
||||||
|
@ -85,8 +92,8 @@ struct floodFill_impl : Strategy
|
||||||
};
|
};
|
||||||
|
|
||||||
template< class Strategy, typename Cursor >
|
template< class Strategy, typename Cursor >
|
||||||
void floodFill(Cursor const& p, Strategy const& s)
|
void floodFill(Cursor const& p, Strategy const& s) {
|
||||||
{
|
|
||||||
floodFill_impl<Strategy,Cursor>(s).go(p);
|
floodFill_impl<Strategy,Cursor>(s).go(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,30 +25,27 @@ void radix2InplaceSort( BidiIterator from, BidiIterator to,
|
||||||
|
|
||||||
|
|
||||||
template< class Scanner, typename Iterator >
|
template< class Scanner, typename Iterator >
|
||||||
struct radix2InplaceSort_impl : Scanner
|
struct radix2InplaceSort_impl : Scanner {
|
||||||
{
|
|
||||||
radix2InplaceSort_impl(Scanner const& s) : Scanner(s) { }
|
radix2InplaceSort_impl(Scanner const& s) : Scanner(s) { }
|
||||||
|
|
||||||
using Scanner::advance;
|
using Scanner::advance;
|
||||||
using Scanner::bit;
|
using Scanner::bit;
|
||||||
|
|
||||||
void go(Iterator& from, Iterator& to, typename Scanner::state_type s)
|
void go(Iterator& from, Iterator& to, typename Scanner::state_type s) {
|
||||||
{
|
|
||||||
Iterator l(from), r(to);
|
Iterator l(from), r(to);
|
||||||
unsigned cl, cr;
|
unsigned cl, cr;
|
||||||
|
|
||||||
using std::swap;
|
using std::swap;
|
||||||
|
|
||||||
for (;;)
|
while (true) {
|
||||||
{
|
|
||||||
// scan from left for set bit
|
// scan from left for set bit
|
||||||
for (cl = cr = 0u; l != r ; ++l, ++cl)
|
for (cl = cr = 0u; l != r ; ++l, ++cl)
|
||||||
if (bit(*l, s))
|
if (bit(*l, s)) {
|
||||||
{
|
|
||||||
// scan from the right for unset bit
|
// scan from the right for unset bit
|
||||||
for (++cr; --r != l ;++cr)
|
for (++cr; --r != l ;++cr)
|
||||||
if (! bit(*r, s))
|
if (! bit(*r, s)) {
|
||||||
{
|
|
||||||
// swap, continue scanning from left
|
// swap, continue scanning from left
|
||||||
swap(*l, *r);
|
swap(*l, *r);
|
||||||
break;
|
break;
|
||||||
|
@ -58,22 +55,23 @@ struct radix2InplaceSort_impl : Scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
// on to the next digit, if any
|
// on to the next digit, if any
|
||||||
if (! advance(s))
|
if (! advance(s)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// recurse into smaller branch and prepare iterative
|
// recurse into smaller branch and prepare iterative
|
||||||
// processing of the other
|
// processing of the other
|
||||||
if (cl < cr)
|
if (cl < cr) {
|
||||||
{
|
|
||||||
if (cl > 1u) go(from, l, s);
|
if (cl > 1u) go(from, l, s);
|
||||||
else if (cr <= 1u)
|
else if (cr <= 1u)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
l = from = r;
|
l = from = r;
|
||||||
r = to;
|
r = to;
|
||||||
}
|
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
if (cr > 1u) go(r, to, s);
|
if (cr > 1u) go(r, to, s);
|
||||||
else if (cl <= 1u)
|
else if (cl <= 1u)
|
||||||
return;
|
return;
|
||||||
|
@ -87,8 +85,8 @@ struct radix2InplaceSort_impl : Scanner
|
||||||
|
|
||||||
template< class Radix2Scanner, typename BidiIterator >
|
template< class Radix2Scanner, typename BidiIterator >
|
||||||
void radix2InplaceSort( BidiIterator from, BidiIterator to,
|
void radix2InplaceSort( BidiIterator from, BidiIterator to,
|
||||||
Radix2Scanner const& scanner)
|
Radix2Scanner const& scanner) {
|
||||||
{
|
|
||||||
radix2InplaceSort_impl<Radix2Scanner, BidiIterator>(scanner)
|
radix2InplaceSort_impl<Radix2Scanner, BidiIterator>(scanner)
|
||||||
.go(from, to, scanner.initial_state());
|
.go(from, to, scanner.initial_state());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
namespace type_traits // those are needed for the declaration, see below
|
namespace type_traits { // those are needed for the declaration, see below
|
||||||
{
|
|
||||||
// Note: There are better / more generally appicable implementations
|
// Note: There are better / more generally appicable implementations
|
||||||
// in C++11, make_signed is missing in TR1 too - so I just use C++98
|
// in C++11, make_signed is missing in TR1 too - so I just use C++98
|
||||||
// hacks that get the job done...
|
// hacks that get the job done...
|
||||||
|
@ -39,8 +39,8 @@ class Radix2IntegerScanner;
|
||||||
|
|
||||||
|
|
||||||
template< typename UInt >
|
template< typename UInt >
|
||||||
class Radix2IntegerScanner< UInt, false >
|
class Radix2IntegerScanner< UInt, false > {
|
||||||
{
|
|
||||||
UInt valMsb;
|
UInt valMsb;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -48,9 +48,8 @@ class Radix2IntegerScanner< UInt, false >
|
||||||
: valMsb(~UInt(0) &~ (~UInt(0) >> 1)) { }
|
: valMsb(~UInt(0) &~ (~UInt(0) >> 1)) { }
|
||||||
|
|
||||||
explicit Radix2IntegerScanner(int bits)
|
explicit Radix2IntegerScanner(int bits)
|
||||||
: valMsb(UInt(1u) << (bits - 1))
|
: valMsb(UInt(1u) << (bits - 1)) {
|
||||||
{ }
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef UInt state_type;
|
typedef UInt state_type;
|
||||||
|
|
||||||
|
@ -67,12 +66,12 @@ class Radix2IntegerScanner< Int, true >
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Radix2IntegerScanner()
|
Radix2IntegerScanner()
|
||||||
: valMsb(~state_type(0u) &~ (~state_type(0u) >> 1))
|
: valMsb(~state_type(0u) &~ (~state_type(0u) >> 1)) {
|
||||||
{ }
|
}
|
||||||
|
|
||||||
explicit Radix2IntegerScanner(int bits)
|
explicit Radix2IntegerScanner(int bits)
|
||||||
: valMsb(state_type(1u) << (bits - 1))
|
: valMsb(state_type(1u) << (bits - 1)) {
|
||||||
{ }
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef typename type_traits::make_unsigned<Int>::type state_type;
|
typedef typename type_traits::make_unsigned<Int>::type state_type;
|
||||||
|
|
|
@ -23,8 +23,8 @@ char const* const UrlReader::error_leftover_input = "UrlReader: Incomplete pro
|
||||||
#define hnd_curl static_cast<CURL*>(_ptrImpl)
|
#define hnd_curl static_cast<CURL*>(_ptrImpl)
|
||||||
|
|
||||||
UrlReader::UrlReader()
|
UrlReader::UrlReader()
|
||||||
: _ptrImpl(0l), _arrXtra(0l), _strError(0l)
|
: _ptrImpl(0l), _arrXtra(0l), _strError(0l) {
|
||||||
{
|
|
||||||
_arrXtra = new(std::nothrow) char[max_read_ahead];
|
_arrXtra = new(std::nothrow) char[max_read_ahead];
|
||||||
if (! _arrXtra) { _strError = error_init_failed; return; }
|
if (! _arrXtra) { _strError = error_init_failed; return; }
|
||||||
_ptrImpl = curl_easy_init();
|
_ptrImpl = curl_easy_init();
|
||||||
|
@ -34,15 +34,15 @@ UrlReader::UrlReader()
|
||||||
curl_easy_setopt(hnd_curl, CURLOPT_FILETIME, 1l);
|
curl_easy_setopt(hnd_curl, CURLOPT_FILETIME, 1l);
|
||||||
}
|
}
|
||||||
|
|
||||||
UrlReader::~UrlReader()
|
UrlReader::~UrlReader() {
|
||||||
{
|
|
||||||
delete _arrXtra;
|
delete _arrXtra;
|
||||||
if (! hnd_curl) return;
|
if (! hnd_curl) return;
|
||||||
curl_easy_cleanup(hnd_curl);
|
curl_easy_cleanup(hnd_curl);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrlReader::perform(char const* url, transfer_callback* cb)
|
bool UrlReader::perform(char const* url, transfer_callback* cb) {
|
||||||
{
|
|
||||||
curl_easy_setopt(hnd_curl, CURLOPT_URL, url);
|
curl_easy_setopt(hnd_curl, CURLOPT_URL, url);
|
||||||
curl_easy_setopt(hnd_curl, CURLOPT_WRITEFUNCTION, cb);
|
curl_easy_setopt(hnd_curl, CURLOPT_WRITEFUNCTION, cb);
|
||||||
curl_easy_setopt(hnd_curl, CURLOPT_WRITEDATA, this);
|
curl_easy_setopt(hnd_curl, CURLOPT_WRITEDATA, this);
|
||||||
|
@ -61,8 +61,8 @@ bool UrlReader::perform(char const* url, transfer_callback* cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
void UrlReader::getinfo(char const*& url,
|
void UrlReader::getinfo(char const*& url,
|
||||||
char const*& type, int64_t& length, int64_t& stardate)
|
char const*& type, int64_t& length, int64_t& stardate) {
|
||||||
{
|
|
||||||
curl_easy_getinfo(hnd_curl, CURLINFO_EFFECTIVE_URL, & url);
|
curl_easy_getinfo(hnd_curl, CURLINFO_EFFECTIVE_URL, & url);
|
||||||
curl_easy_getinfo(hnd_curl, CURLINFO_CONTENT_TYPE, & type);
|
curl_easy_getinfo(hnd_curl, CURLINFO_CONTENT_TYPE, & type);
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
* UrlReader class that encapsulates a context for sequential data retrieval
|
* UrlReader class that encapsulates a context for sequential data retrieval
|
||||||
* via URLs. Use one per thread.
|
* via URLs. Use one per thread.
|
||||||
*/
|
*/
|
||||||
class UrlReader
|
class UrlReader {
|
||||||
{
|
|
||||||
void* _ptrImpl;
|
void* _ptrImpl;
|
||||||
char* _arrXtra;
|
char* _arrXtra;
|
||||||
char const* _strError;
|
char const* _strError;
|
||||||
|
@ -149,8 +149,7 @@ class UrlReader
|
||||||
};
|
};
|
||||||
|
|
||||||
template< class ContentStream >
|
template< class ContentStream >
|
||||||
bool UrlReader::readUrl(char const* url, ContentStream& s)
|
bool UrlReader::readUrl(char const* url, ContentStream& s) {
|
||||||
{
|
|
||||||
if (! _ptrImpl) return false;
|
if (! _ptrImpl) return false;
|
||||||
_strError = success;
|
_strError = success;
|
||||||
_ptrStream = & s;
|
_ptrStream = & s;
|
||||||
|
@ -162,24 +161,24 @@ bool UrlReader::readUrl(char const* url, ContentStream& s)
|
||||||
|
|
||||||
inline char const* UrlReader::getError() const { return this->_strError; }
|
inline char const* UrlReader::getError() const { return this->_strError; }
|
||||||
|
|
||||||
inline void UrlReader::setError(char const* static_c_string)
|
inline void UrlReader::setError(char const* static_c_string) {
|
||||||
{
|
|
||||||
if (this->_strError == success)
|
if (this->_strError == success)
|
||||||
this->_strError = static_c_string;
|
this->_strError = static_c_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Stream >
|
template< class Stream >
|
||||||
size_t UrlReader::callback_template(
|
size_t UrlReader::callback_template(
|
||||||
char *input, size_t size, size_t nmemb, void* thiz)
|
char *input, size_t size, size_t nmemb, void* thiz) {
|
||||||
{
|
|
||||||
size *= nmemb;
|
size *= nmemb;
|
||||||
|
|
||||||
UrlReader* me = static_cast<UrlReader*>(thiz);
|
UrlReader* me = static_cast<UrlReader*>(thiz);
|
||||||
Stream* stream = static_cast<Stream*>(me->_ptrStream);
|
Stream* stream = static_cast<Stream*>(me->_ptrStream);
|
||||||
|
|
||||||
// first call?
|
// first call?
|
||||||
if (me->_valXtraSize == ~size_t(0))
|
if (me->_valXtraSize == ~size_t(0)) {
|
||||||
{
|
|
||||||
me->_valXtraSize = 0u;
|
me->_valXtraSize = 0u;
|
||||||
// extract meta information and call 'begin'
|
// extract meta information and call 'begin'
|
||||||
char const* url, * type;
|
char const* url, * type;
|
||||||
|
@ -190,14 +189,14 @@ size_t UrlReader::callback_template(
|
||||||
|
|
||||||
size_t input_offset = 0u;
|
size_t input_offset = 0u;
|
||||||
|
|
||||||
for (;;)
|
while (true) {
|
||||||
{
|
|
||||||
char* buffer = input + input_offset;
|
char* buffer = input + input_offset;
|
||||||
size_t bytes = size - input_offset;
|
size_t bytes = size - input_offset;
|
||||||
|
|
||||||
// data in extra buffer?
|
// data in extra buffer?
|
||||||
if (me->_valXtraSize > 0)
|
if (me->_valXtraSize > 0) {
|
||||||
{
|
|
||||||
// fill extra buffer with beginning of input
|
// fill extra buffer with beginning of input
|
||||||
size_t fill = max_read_ahead - me->_valXtraSize;
|
size_t fill = max_read_ahead - me->_valXtraSize;
|
||||||
if (bytes < fill) fill = bytes;
|
if (bytes < fill) fill = bytes;
|
||||||
|
@ -210,36 +209,36 @@ size_t UrlReader::callback_template(
|
||||||
|
|
||||||
// call 'transfer'
|
// call 'transfer'
|
||||||
size_t processed = stream->transfer(buffer, bytes);
|
size_t processed = stream->transfer(buffer, bytes);
|
||||||
if (processed == abort)
|
if (processed == abort) {
|
||||||
{
|
|
||||||
me->setError(error_aborted);
|
me->setError(error_aborted);
|
||||||
return 0u;
|
return 0u;
|
||||||
}
|
|
||||||
else if (! processed && ! input)
|
} else if (! processed && ! input) {
|
||||||
{
|
|
||||||
me->setError(error_leftover_input);
|
me->setError(error_leftover_input);
|
||||||
return 0u;
|
return 0u;
|
||||||
}
|
}
|
||||||
size_t unprocessed = bytes - processed;
|
size_t unprocessed = bytes - processed;
|
||||||
|
|
||||||
// can switch to input buffer, now?
|
// can switch to input buffer, now?
|
||||||
if (buffer == me->_arrXtra && unprocessed <= input_offset)
|
if (buffer == me->_arrXtra && unprocessed <= input_offset) {
|
||||||
{
|
|
||||||
me->_valXtraSize = 0u;
|
me->_valXtraSize = 0u;
|
||||||
input_offset -= unprocessed;
|
input_offset -= unprocessed;
|
||||||
}
|
|
||||||
else // no? unprocessed data -> extra buffer
|
} else { // no? unprocessed data -> extra buffer
|
||||||
{
|
|
||||||
if (unprocessed > max_read_ahead)
|
if (unprocessed > max_read_ahead) {
|
||||||
{
|
|
||||||
me->setError(error_buffer_overflow);
|
me->setError(error_buffer_overflow);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
me->_valXtraSize = unprocessed;
|
me->_valXtraSize = unprocessed;
|
||||||
memmove(me->_arrXtra, buffer + processed, unprocessed);
|
memmove(me->_arrXtra, buffer + processed, unprocessed);
|
||||||
|
|
||||||
if (input_offset == size || buffer != me->_arrXtra)
|
if (input_offset == size || buffer != me->_arrXtra) {
|
||||||
{
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue