--------------------- PatchSet 4439 Date: 2007/05/02 12:53:05 Author: amosjeffries Branch: ayjwork Tag: (none) Log: part 3 - String replacement Members: src/ACLExtUser.cc:1.7.14.1->1.7.14.2 src/ACLHTTPHeaderData.cc:1.2.14.2->1.2.14.3 src/ACLUrlPath.cc:1.2->1.2.22.1 src/HttpHeader.h:1.18.4.1->1.18.4.2 src/HttpHeaderRange.h:1.9.8.1->1.9.8.2 src/Makefile.am:1.116.2.2->1.116.2.3 src/protos.h:1.80.2.2->1.80.2.3 src/tools.cc:1.43.2.2->1.43.2.3 src/fs/coss/CossSwapDir.h:1.6->1.6.8.1 src/tests/CapturingStoreEntry.h:1.1->1.1.16.1 src/tests/testCacheManager.cc:1.1->1.1.16.1 src/tests/testEvent.cc:1.3->1.3.14.1 Index: squid3/src/ACLExtUser.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLExtUser.cc,v retrieving revision 1.7.14.1 retrieving revision 1.7.14.2 diff -u -r1.7.14.1 -r1.7.14.2 --- squid3/src/ACLExtUser.cc 1 May 2007 12:50:22 -0000 1.7.14.1 +++ squid3/src/ACLExtUser.cc 2 May 2007 12:53:05 -0000 1.7.14.2 @@ -1,5 +1,5 @@ /* - * $Id: ACLExtUser.cc,v 1.7.14.1 2007/05/01 12:50:22 amosjeffries Exp $ + * $Id: ACLExtUser.cc,v 1.7.14.2 2007/05/02 12:53:05 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -79,7 +79,7 @@ ACLExtUser::match(ACLChecklist *checklist) { if (checklist->request->extacl_user.size()) { - return data->match(checklist->request->extacl_user.buf()); + return data->match(checklist->request->extacl_user.c_str()); } else { return -1; } Index: squid3/src/ACLHTTPHeaderData.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLHTTPHeaderData.cc,v retrieving revision 1.2.14.2 retrieving revision 1.2.14.3 diff -u -r1.2.14.2 -r1.2.14.3 --- squid3/src/ACLHTTPHeaderData.cc 2 May 2007 00:09:50 -0000 1.2.14.2 +++ squid3/src/ACLHTTPHeaderData.cc 2 May 2007 12:53:05 -0000 1.2.14.3 @@ -1,5 +1,5 @@ /* - * $Id: ACLHTTPHeaderData.cc,v 1.2.14.2 2007/05/02 00:09:50 amosjeffries Exp $ + * $Id: ACLHTTPHeaderData.cc,v 1.2.14.3 2007/05/02 12:53:05 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -65,7 +65,7 @@ debugs(28, 3, "aclHeaderData::match: checking '" << hdrName << "'"); - String value = hdrId != HDR_BAD_HDR ? hdr->getStrOrList(hdrId) : hdr->getByName(hdrName.c_str()); + string value = hdrId != HDR_BAD_HDR ? hdr->getStrOrList(hdrId) : hdr->getByName(hdrName.c_str()); return regex_rule->match(value.c_str()); } @@ -74,7 +74,7 @@ ACLHTTPHeaderData::dump() { wordlist *W = NULL; - wordlistAdd(&W, hdrName.buf()); + wordlistAdd(&W, hdrName.c_str()); wordlist * regex_dump = regex_rule->dump(); wordlistAddWl(&W, regex_dump); wordlistDestroy(®ex_dump); Index: squid3/src/ACLUrlPath.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLUrlPath.cc,v retrieving revision 1.2 retrieving revision 1.2.22.1 diff -u -r1.2 -r1.2.22.1 --- squid3/src/ACLUrlPath.cc 11 Jul 2003 02:13:04 -0000 1.2 +++ squid3/src/ACLUrlPath.cc 2 May 2007 12:53:05 -0000 1.2.22.1 @@ -1,5 +1,5 @@ /* - * $Id: ACLUrlPath.cc,v 1.2 2003/07/11 02:13:04 squidadm Exp $ + * $Id: ACLUrlPath.cc,v 1.2.22.1 2007/05/02 12:53:05 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -47,7 +47,7 @@ int ACLUrlPathStrategy::match (ACLData * &data, ACLChecklist *checklist) { - char *esc_buf = xstrdup(checklist->request->urlpath.buf()); + char *esc_buf = xstrdup(checklist->request->urlpath.c_str()); rfc1738_unescape(esc_buf); int result = data->match(esc_buf); safe_free(esc_buf); Index: squid3/src/HttpHeader.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHeader.h,v retrieving revision 1.18.4.1 retrieving revision 1.18.4.2 diff -u -r1.18.4.1 -r1.18.4.2 --- squid3/src/HttpHeader.h 1 May 2007 16:09:26 -0000 1.18.4.1 +++ squid3/src/HttpHeader.h 2 May 2007 12:53:05 -0000 1.18.4.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.h,v 1.18.4.1 2007/05/01 16:09:26 amosjeffries Exp $ + * $Id: HttpHeader.h,v 1.18.4.2 2007/05/02 12:53:05 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -171,6 +171,8 @@ typedef struct _ETag ETag; +#include "typedefs.h" + class HttpHeaderEntry { Index: squid3/src/HttpHeaderRange.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHeaderRange.h,v retrieving revision 1.9.8.1 retrieving revision 1.9.8.2 diff -u -r1.9.8.1 -r1.9.8.2 --- squid3/src/HttpHeaderRange.h 1 May 2007 16:09:26 -0000 1.9.8.1 +++ squid3/src/HttpHeaderRange.h 2 May 2007 12:53:05 -0000 1.9.8.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderRange.h,v 1.9.8.1 2007/05/01 16:09:26 amosjeffries Exp $ + * $Id: HttpHeaderRange.h,v 1.9.8.2 2007/05/02 12:53:05 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -34,6 +34,8 @@ #ifndef SQUID_HTTPHEADERRANGE_H #define SQUID_HTTPHEADERRANGE_H +#include "typedefs.h" + #include "MemPool.h" #include "Range.h" #include "Array.h" Index: squid3/src/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Makefile.am,v retrieving revision 1.116.2.2 retrieving revision 1.116.2.3 diff -u -r1.116.2.2 -r1.116.2.3 --- squid3/src/Makefile.am 1 May 2007 16:09:26 -0000 1.116.2.2 +++ squid3/src/Makefile.am 2 May 2007 12:53:05 -0000 1.116.2.3 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.116.2.2 2007/05/01 16:09:26 amosjeffries Exp $ +# $Id: Makefile.am,v 1.116.2.3 2007/05/02 12:53:05 amosjeffries Exp $ # # Uncomment and customize the following to suit your needs: # @@ -594,6 +594,7 @@ StoreSwapLogData.h \ Server.cc \ Server.h \ + string_ext.cc \ structs.h \ SwapDir.cc \ SwapDir.h \ @@ -850,6 +851,7 @@ store_swapin.cc \ store_swapmeta.cc \ store_swapout.cc \ + string_ext.cc \ structs.h \ SwapDir.cc \ tools.cc \ @@ -1103,15 +1105,18 @@ tests_testAuth_SOURCES= tests/testAuth.cc tests/testMain.cc tests/testAuth.h $(TESTSOURCES) \ authenticate.cc \ ConfigParser.cc \ - tests/stub_acl.cc tests/stub_cache_cf.cc \ + tests/stub_acl.cc \ + tests/stub_cache_cf.cc \ tests/stub_helper.cc cbdata.cc \ - tests/stub_store.cc HttpHeaderTools.cc HttpHeader.cc acl.cc event.cc mem.cc \ + tests/stub_store.cc \ + HttpHeaderTools.cc HttpHeader.cc acl.cc event.cc mem.cc \ MemBuf.cc HttpHdrContRange.cc Packer.cc ACLChecklist.cc HttpHdrCc.cc HttpHdrSc.cc \ HttpHdrScTarget.cc url.cc ACLProxyAuth.cc ACLRegexData.cc ACLUserData.cc \ StatHist.cc HttpHdrRange.cc ETag.cc tests/stub_errorpage.cc \ tests/stub_HttpRequest.cc tests/stub_DelayId.cc \ tests/stub_MemObject.cc mem_node.cc \ stmem.cc \ + string_ext.cc \ tests/stub_comm.cc \ tests/stub_http.cc \ HttpMsg.cc \ @@ -1182,6 +1187,7 @@ Parsing.cc \ StatHist.cc \ stmem.cc \ + string_ext.cc \ tests/stub_cache_cf.cc \ tests/stub_comm.cc \ tests/stub_DelayId.cc \ @@ -1338,6 +1344,7 @@ StoreMetaURL.cc \ StoreMetaVary.cc \ StoreSwapLogData.cc \ + string_ext.cc \ tools.cc \ tunnel.cc \ SwapDir.cc \ @@ -1501,6 +1508,7 @@ StoreMetaURL.cc \ StoreMetaVary.cc \ StoreSwapLogData.cc \ + string_ext.cc \ tools.cc \ tunnel.cc \ SwapDir.cc \ @@ -1651,6 +1659,7 @@ StoreMetaURL.cc \ StoreMetaVary.cc \ StoreSwapLogData.cc \ + string_ext.cc \ tools.cc \ tunnel.cc \ SwapDir.cc \ @@ -1830,6 +1839,7 @@ StoreMetaURL.cc \ StoreMetaVary.cc \ StoreSwapLogData.cc \ + string_ext.cc \ SwapDir.cc \ time.cc \ tools.cc \ @@ -1982,6 +1992,7 @@ StoreMetaURL.cc \ StoreMetaVary.cc \ StoreSwapLogData.cc \ + string_ext.cc \ tools.cc \ tunnel.cc \ SwapDir.cc \ @@ -2037,6 +2048,7 @@ SwapDir.cc \ authenticate.cc \ tests/stub_acl.cc tests/stub_cache_cf.cc \ + string_ext.cc \ tests/stub_helper.cc cbdata.cc \ tests/stub_comm.cc \ tests/stub_client_side_request.cc \ @@ -2297,6 +2309,7 @@ StoreMetaURL.cc \ StoreMetaVary.cc \ StoreSwapLogData.cc \ + string_ext.cc \ tools.cc \ tunnel.cc \ SwapDir.cc \ Index: squid3/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/protos.h,v retrieving revision 1.80.2.2 retrieving revision 1.80.2.3 diff -u -r1.80.2.2 -r1.80.2.3 --- squid3/src/protos.h 1 May 2007 16:09:28 -0000 1.80.2.2 +++ squid3/src/protos.h 2 May 2007 12:53:05 -0000 1.80.2.3 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.80.2.2 2007/05/01 16:09:28 amosjeffries Exp $ + * $Id: protos.h,v 1.80.2.3 2007/05/02 12:53:05 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -234,7 +234,7 @@ /* Http Header Tools */ SQUIDCEXTERN HttpHeaderFieldInfo *httpHeaderBuildFieldsInfo(const HttpHeaderFieldAttrs * attrs, int count); SQUIDCEXTERN void httpHeaderDestroyFieldsInfo(HttpHeaderFieldInfo * info, int count); -SQUIDCEXTERN http_hdr_type httpHeaderIdByName(const char *name, int name_len, const HttpHeaderFieldInfo * attrs, int end); +SQUIDCEXTERN http_hdr_type httpHeaderIdByName(const char *name, unsigned int name_len, const HttpHeaderFieldInfo * attrs, int end); SQUIDCEXTERN http_hdr_type httpHeaderIdByNameDef(const char *name, int name_len); SQUIDCEXTERN const char *httpHeaderNameById(int id); SQUIDCEXTERN int httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive); Index: squid3/src/tools.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tools.cc,v retrieving revision 1.43.2.2 retrieving revision 1.43.2.3 diff -u -r1.43.2.2 -r1.43.2.3 --- squid3/src/tools.cc 2 May 2007 00:09:51 -0000 1.43.2.2 +++ squid3/src/tools.cc 2 May 2007 12:53:05 -0000 1.43.2.3 @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.43.2.2 2007/05/02 00:09:51 amosjeffries Exp $ + * $Id: tools.cc,v 1.43.2.3 2007/05/02 12:53:05 amosjeffries Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -1273,136 +1273,6 @@ return 0; /* NOT REACHED */ } -/* - * Similar to strtok, but has some rudimentary knowledge - * of quoting - */ -char * -strwordtok(char *buf, char **t) -{ - unsigned char *word = NULL; - unsigned char *p = (unsigned char *) buf; - unsigned char *d; - unsigned char ch; - int quoted = 0; - - if (!p) - p = (unsigned char *) *t; - - if (!p) - goto error; - - while (*p && xisspace(*p)) - p++; - - if (!*p) - goto error; - - word = d = p; - - while ((ch = *p)) { - switch (ch) { - - case '\\': - p++; - - switch (*p) { - - case 'n': - ch = '\n'; - - break; - - case 'r': - ch = '\r'; - - break; - - default: - ch = *p; - - break; - - } - - *d++ = ch; - - if (ch) - p++; - - break; - - case '"': - quoted = !quoted; - - p++; - - break; - - default: - if (!quoted && xisspace(*p)) { - p++; - goto done; - } - - *d++ = *p++; - break; - } - } - -done: - *d++ = '\0'; - -error: - *t = (char *) p; - return (char *) word; -} - -/* - * Inverse of strwordtok. Quotes a word if needed - */ -void -strwordquote(MemBuf * mb, const char *str) -{ - int quoted = 0; - - if (strchr(str, ' ')) { - quoted = 1; - mb->append("\"", 1); - } - - while (*str) { - int l = strcspn(str, "\"\\\n\r"); - mb->append(str, l); - str += l; - - switch(*str) { - - case '\n': - mb->append("\\n", 2); - str++; - break; - - case '\r': - mb->append("\\r", 2); - str++; - break; - - case '\0': - break; - - default: - mb->append("\\", 1); - mb->append(str, 1); - str++; - break; - } - } - - if (quoted) - mb->append("\"", 1); -} - void keepCapabilities(void) { Index: squid3/src/fs/coss/CossSwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/coss/CossSwapDir.h,v retrieving revision 1.6 retrieving revision 1.6.8.1 diff -u -r1.6 -r1.6.8.1 --- squid3/src/fs/coss/CossSwapDir.h 23 May 2006 00:45:42 -0000 1.6 +++ squid3/src/fs/coss/CossSwapDir.h 2 May 2007 12:53:05 -0000 1.6.8.1 @@ -36,7 +36,7 @@ virtual void create(); virtual void dump(StoreEntry &)const; ~CossSwapDir(); - virtual StoreSearch *search(String const url, HttpRequest *); + virtual StoreSearch *search(string const url, HttpRequest *); virtual void unlink (StoreEntry &); virtual void statfs (StoreEntry &)const; virtual int canStore(StoreEntry const &)const; Index: squid3/src/tests/CapturingStoreEntry.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tests/CapturingStoreEntry.h,v retrieving revision 1.1 retrieving revision 1.1.16.1 diff -u -r1.1 -r1.1.16.1 --- squid3/src/tests/CapturingStoreEntry.h 7 Aug 2006 02:51:15 -0000 1.1 +++ squid3/src/tests/CapturingStoreEntry.h 2 May 2007 12:53:06 -0000 1.1.16.1 @@ -14,7 +14,7 @@ CapturingStoreEntry() : _buffer_calls(0), _flush_calls(0) {} - String _appended_text; + string _appended_text; int _buffer_calls; int _flush_calls; Index: squid3/src/tests/testCacheManager.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tests/testCacheManager.cc,v retrieving revision 1.1 retrieving revision 1.1.16.1 diff -u -r1.1 -r1.1.16.1 --- squid3/src/tests/testCacheManager.cc 29 May 2006 00:50:19 -0000 1.1 +++ squid3/src/tests/testCacheManager.cc 2 May 2007 12:53:06 -0000 1.1.16.1 @@ -47,8 +47,8 @@ CacheManager manager; manager.registerAction("sample", "my sample", &dummy_action, false, false); CacheManagerAction *anAction = manager.findAction("sample"); - CPPUNIT_ASSERT_EQUAL(String("sample"), String(anAction->action)); - CPPUNIT_ASSERT_EQUAL(String("my sample"), String(anAction->desc)); + CPPUNIT_ASSERT_EQUAL( (string)"sample", (string)anAction->action ); + CPPUNIT_ASSERT_EQUAL( (string)"my sample", (string)anAction->desc ); CPPUNIT_ASSERT_EQUAL(&dummy_action, anAction->handler); CPPUNIT_ASSERT_EQUAL(0, (int)anAction->flags.pw_req); CPPUNIT_ASSERT_EQUAL(0, (int)anAction->flags.atomic); Index: squid3/src/tests/testEvent.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tests/testEvent.cc,v retrieving revision 1.3 retrieving revision 1.3.14.1 diff -u -r1.3 -r1.3.14.1 --- squid3/src/tests/testEvent.cc 21 Aug 2006 01:51:51 -0000 1.3 +++ squid3/src/tests/testEvent.cc 2 May 2007 12:53:06 -0000 1.3.14.1 @@ -104,13 +104,12 @@ scheduler.schedule("test event", CalledEvent::Handler, &event, 0, 0, false); scheduler.schedule("test event2", CalledEvent::Handler, &event2, 0, 0, false); scheduler.dump(anEntry); - CPPUNIT_ASSERT_EQUAL(String( - "Last event to run: last event\n" + string expect = "Last event to run: last event\n" "\n" "Operation\tNext Execution\tWeight\tCallback Valid?\n" "test event\t0.000000 seconds\t0\tN/A\n" - "test event2\t0.000000 seconds\t0\tN/A\n" - ), anEntry->_appended_text); + "test event2\t0.000000 seconds\t0\tN/A\n"; + CPPUNIT_ASSERT_EQUAL( expect, anEntry->_appended_text); delete anEntry; }