}
/* set field value */
- value.limitInit(value_start, field_end - value_start);
+ value.assign(value_start, field_end - value_start);
if (id != Http::HdrType::BAD_HDR)
++ headerStatsTable[id].seenCount;
}
/* Make sure it's defined even if empty "" */
if (!val->termedBuf())
- val->limitInit("", 0);
+ val->assign("", 0);
return 1;
}
const char *str = header.getStr(Http::HdrType::CONTENT_TYPE);
if (str)
- content_type.limitInit(str, strcspn(str, ";\t "));
+ content_type.assign(str, strcspn(str, ";\t "));
else
content_type = String();
*/
char const * termedBuf() const { return buf_; }
- void limitInit(const char *str, int len); // TODO: rename to assign()
+ void assign(const char *str, int len);
void clean();
void reset(char const *str);
void append(char const *buf, int len);
// public interface, makes sure that we clean the old buffer first
void
-String::limitInit(const char *str, int len)
+String::assign(const char *str, int len)
{
clean(); // TODO: optimize to avoid cleaning the buffer we can use
allocAndFill(str, len);
Must(to > from);
String rv;
- rv.limitInit(rawBuf()+from,to-from);
+ rv.assign(rawBuf()+from, to-from);
return rv;
}
len = e - s;
}
- host.limitInit(s, len);
+ host.assign(s, len);
#if USE_OPENSSL
if (secure.sslDomain.isEmpty())
secure.sslDomain.assign(host.rawBuf(), host.size());
"long resource name (>1024), probably wrong");
}
- resource.limitInit(s, len + 1);
+ resource.assign(s, len + 1);
return true;
}
const char *pos = NULL;
while (strListGetItem(&ids, ',', &item, &ilen, &pos)) {
String id;
- id.limitInit(item, ilen);
+ id.assign(item, ilen);
ServicePointer service = FindService(id);
if (doingCurrent) {
if (!service || // cannot tell or matches current location
// domain is Special. Not a quoted-string, must not be de-quoted. But is wrapped in '"'
// BUG 3077: uri= can also be sent to us in a mangled (invalid!) form like domain
if (vlen > 1 && *p == '"' && *(p + vlen -1) == '"') {
- value.limitInit(p+1, vlen-2);
+ value.assign(p+1, vlen-2);
}
} else if (keyName == SBuf("qop",3)) {
// qop is more special.
// On request this must not be quoted-string de-quoted. But is several values wrapped in '"'
// On response this is a single un-quoted token.
if (vlen > 1 && *p == '"' && *(p + vlen -1) == '"') {
- value.limitInit(p+1, vlen-2);
+ value.assign(p+1, vlen-2);
} else {
- value.limitInit(p, vlen);
+ value.assign(p, vlen);
}
} else if (*p == '"') {
if (!httpHeaderParseQuotedString(p, vlen, &value)) {
continue;
}
} else {
- value.limitInit(p, vlen);
+ value.assign(p, vlen);
}
} else {
debugs(29, 9, "Failed to parse attribute '" << item << "' in '" << temp << "'");
}
String number;
- number.limitInit(number_begin, number_end - number_begin);
+ number.assign(number_begin, number_end - number_begin);
int d = xatoi(number.termedBuf());
int m;
ESISegment::dumpOne() const
{
String temp;
- temp.limitInit(buf, len);
+ temp.assign(buf, len);
debugs(86, 9, "ESISegment::dumpOne: \"" << temp << "\"");
}
ESIVarState::addVariable(char const *name, size_t len, Variable *aVariable)
{
String temp;
- temp.limitInit (name, len);
+ temp.assign(name, len);
removeVariable (temp);
variables.add(name, len, aVariable);
variablesForCleanup.push_back(aVariable);
// TODO: use SBuf.reserve() instead of a temporary buffer
char buf[maxSize];
getRaw(&buf, length);
- s.limitInit(buf, length);
+ s.assign(buf, length);
}
void
SBufToString(const SBuf &s)
{
String rv;
- rv.limitInit(s.rawContent(), s.length());
+ rv.assign(s.rawContent(), s.length());
return rv;
}