mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-17 18:12:04 +01:00
*** empty log message ***
This commit is contained in:
parent
e0fd14906d
commit
fbf317098b
2 changed files with 15 additions and 2 deletions
|
@ -82,9 +82,14 @@ std::codecvt_base::result base64codecvt::do_in(std::mbstate_t& state,
|
||||||
|
|
||||||
while((from_next != from_end) && (to != to_limit))
|
while((from_next != from_end) && (to != to_limit))
|
||||||
{
|
{
|
||||||
size_t i = base64_charset.find(*from_next++);
|
char b = *from_next++;
|
||||||
|
size_t i = base64_charset.find(b);
|
||||||
if(i == std::string::npos)
|
if(i == std::string::npos)
|
||||||
|
{
|
||||||
|
if(b == '=')
|
||||||
|
nextState();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
char c = static_cast<char>(i);
|
char c = static_cast<char>(i);
|
||||||
|
|
||||||
char p = getPreviousChar();
|
char p = getPreviousChar();
|
||||||
|
@ -151,6 +156,14 @@ int base64codecvt::do_max_length() const throw()
|
||||||
return 2;
|
return 2;
|
||||||
} // do_max_length
|
} // do_max_length
|
||||||
|
|
||||||
|
void base64codecvt::grabState(std::mbstate_t& state) const
|
||||||
|
{
|
||||||
|
state_ = reinterpret_cast<int*>(&state);
|
||||||
|
int s = getState();
|
||||||
|
if((s < 0) || (s > 4))
|
||||||
|
*state_ = 0;
|
||||||
|
} // grabState
|
||||||
|
|
||||||
int base64codecvt::getState() const
|
int base64codecvt::getState() const
|
||||||
{
|
{
|
||||||
return (*state_) & 0xff;
|
return (*state_) & 0xff;
|
||||||
|
|
|
@ -59,7 +59,7 @@ private:
|
||||||
mutable int* state_;
|
mutable int* state_;
|
||||||
mutable const char** from_next_;
|
mutable const char** from_next_;
|
||||||
mutable const char** from_end_;
|
mutable const char** from_end_;
|
||||||
void grabState(std::mbstate_t& state) const { state_ = reinterpret_cast<int*>(&state); }
|
void grabState(std::mbstate_t& state) const;
|
||||||
void grabFromNext(const char*& from_next) const { from_next_ = &from_next; }
|
void grabFromNext(const char*& from_next) const { from_next_ = &from_next; }
|
||||||
void grabFromEnd(const char*& from_end) const { from_end_ = &from_end; }
|
void grabFromEnd(const char*& from_end) const { from_end_ = &from_end; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue