Converted some printf to macro-based.
* XXX These should use HttpHdr interfaces instead of Printfs
*/
const Adaptation::ServiceConfig &s = service().cfg();
- buf.Printf("%s %.*s ICAP/1.0\r\n", s.methodStr(), s.uri.size(), s.uri.rawBuf());
- buf.Printf("Host: %.*s:%d\r\n", s.host.size(), s.host.rawBuf(), s.port);
+ buf.Printf("%s " SQUIDSTRINGPH " ICAP/1.0\r\n", s.methodStr(), SQUIDSTRINGPRINT(s.uri));
+ buf.Printf("Host: " SQUIDSTRINGPPH ":%d\r\n", SQUIDSTRINGPRINT(s.host), s.port);
buf.Printf("Date: %s\r\n", mkrfc1123(squid_curtime));
if (!TheICAPConfig.reuse_connections)
~String();
typedef size_t size_type; //storage size intentionally unspecified
+ const static size_type npos = std::string::npos;
String &operator =(char const *);
String &operator =(String const &);
_SQUID_INLINE_ const char * pos(char const *) const;
_SQUID_INLINE_ const char * pos(char const ch) const;
///offset from string start of the first occurrence of ch
- /// returns std::string::npos if ch is not found
+ /// returns String::npos if ch is not found
_SQUID_INLINE_ size_type find(char const ch) const;
_SQUID_INLINE_ const char * rpos(char const ch) const;
_SQUID_INLINE_ size_type rfind(char const ch) const;
const char *c;
c=pos(ch);
if (c==NULL)
- return std::string::npos;
+ return npos;
return c-rawBuf();
}
const char *c;
c=rpos(ch);
if (c==NULL)
- return std::string::npos;
+ return npos;
return c-rawBuf();
}
{
typedef Groups::iterator GI;
for (GI i = AllGroups().begin(); i != AllGroups().end(); ++i)
- storeAppendPrintf(entry, "%s %.*s\n", name, (*i)->id.psize(), (*i)->id.rawBuf());
+ storeAppendPrintf(entry, "%s " SQUIDSTRINGPH "\n", name, SQUIDSTRINGPRINT((*i)->id));
}
void
typedef AccessRules::iterator CI;
for (CI i = AllRules().begin(); i != AllRules().end(); ++i) {
- snprintf(nom, 64, "%s %.*s", name, (*i)->groupId.psize(), (*i)->groupId.rawBuf());
+ snprintf(nom, 64, "%s " SQUIDSTRINGPH, name, SQUIDSTRINGPRINT((*i)->groupId));
dump_acl_access(entry, nom, (*i)->acl);
}
}
if (str_type_eq.undefined()) //hack. String doesn't support global-static
str_type_eq="type=";
- if ((t = request->urlpath.rfind(';')) != std::string::npos) {
+ if ((t = request->urlpath.rfind(';')) != String::npos) {
if (request->urlpath.substr(t+1,t+1+str_type_eq.size())==str_type_eq) {
typecode = (char)xtoupper(request->urlpath[t+str_type_eq.size()+1]);
request->urlpath.cut(t);
/** FIXME: this appears to be parsing the URL. *very* badly. */
/* a proper encapsulated URI/URL type needs to clear this up. */
- if ((p=urlpath.find(':')) != std::string::npos) {
+ if ((p=urlpath.find(':')) != String::npos) {
result=xstrndup(urlpath.rawBuf(),p-1);
} else {
result = xstrndup(urlpath.rawBuf(),urlpath.size());
{
LOCAL_ARRAY(char, local_urlres, 4096);
char *host = getHost (uri);
- snprintf(local_urlres, 4096, "http://%s/uri-res/N2L?urn:%.*s", host, uri.psize(), uri.rawBuf());
+ snprintf(local_urlres, 4096, "http://%s/uri-res/N2L?urn:" SQUIDSTRINGPH,
+ host, SQUIDSTRINGPRINT(uri));
safe_free (host);
safe_free (urlres);
urlres = xstrdup (local_urlres);
buf = (char *)xmalloc(l);
- snprintf(buf, l, "%.*s\r\n", p->request->urlpath.psize()-1, p->request->urlpath.rawBuf() + 1);
+ String str_print=p->request->urlpath.substr(1,p->request->urlpath.size());
+ snprintf(buf, l, SQUIDSTRINGPH"\r\n", SQUIDSTRINGPRINT(str_print));
comm_write(fd, buf, strlen(buf), whoisWriteComplete, p, NULL);
comm_read(fd, p->buf, BUFSIZ, whoisReadReply, p);