1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00

bug fixing

This commit is contained in:
stefanocasazza 2015-07-24 14:58:09 +02:00
parent e85a3b7570
commit 6f780f99e1
3 changed files with 17 additions and 7 deletions

View File

@ -1331,8 +1331,8 @@ public:
const char* rbegin() const { return rep->rbegin(); }
const char* rend() const { return rep->rend(); }
__pure char at(uint32_t pos) const { return rep->at(pos); }
char operator[](uint32_t pos) const { return rep->operator[](pos); }
__pure char at(uint32_t pos) const { return rep->at(pos); }
char operator[](uint32_t pos) const { return rep->operator[](pos); }
char* _begin()
{
@ -1502,7 +1502,7 @@ public:
}
char* c_strdup() const { return strndup(rep->str, rep->_length); }
char* c_strndup(uint32_t pos = 0, uint32_t n = U_NOT_FOUND) const { return strndup(rep->str + pos, rep->fold(pos, n)); }
char* c_strndup(uint32_t pos = 0, uint32_t n = U_NOT_FOUND) const { return strndup(rep->str+pos, rep->fold(pos, n)); }
UString copy() const;
void copy(char* s, uint32_t n = U_NOT_FOUND, uint32_t pos = 0) const { rep->copy(s, n, pos); }
@ -1596,8 +1596,8 @@ public:
// Same string representation
bool same(UStringRep* _rep) const { return (rep == _rep); }
bool same(const UString& str) const { return same(str.rep); }
bool same(UStringRep* _rep) const { return (rep == _rep); }
bool same(const UString& str) const { return same(str.rep); }
// Equal

View File

@ -2076,7 +2076,11 @@ U_EXPORT istream& operator>>(istream& in, UString& str)
if (c != EOF)
{
if (str) str.rep->size_adjust(0U);
if (str)
{
if (str.uniq()) str.setEmpty();
else str._set(UStringRep::create(0U, U_CAPACITY, 0)); // NB: we need this because we use the same object for all input stream of vector (see vector.h:823)...
}
streamsize w = in.width();
@ -2125,7 +2129,11 @@ istream& UString::getline(istream& in, unsigned char delim)
if (in.good())
{
if (empty() == false) rep->size_adjust(0U);
if (size())
{
if (uniq()) setEmpty();
else _set(UStringRep::create(0U, U_CAPACITY, 0)); // NB: we need this because we use the same object for all input stream of vector (see vector.h:823)...
}
streambuf* sb = in.rdbuf();

View File

@ -3804,9 +3804,11 @@ file_in_cache:
U_RETURN(U_PLUGIN_HANDLER_FINISHED);
}
# ifndef U_COVERITY_FALSE_POSITIVE // UNREACHABLE
if (U_ClientImage_state != U_PLUGIN_HANDLER_ERROR) goto from_cache;
U_RETURN(U_PLUGIN_HANDLER_FINISHED);
# endif
}
if (u__isdigit(mime_index))