From: Automatic source maintenance Date: Wed, 5 Oct 2011 00:19:46 +0000 (-0600) Subject: SourceFormat Enforcement X-Git-Tag: BumpSslServerFirst.take01~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77da18179e70543769efd8c910ebd11ed794a19f;p=thirdparty%2Fsquid.git SourceFormat Enforcement --- diff --git a/src/HttpHdrCc.cc b/src/HttpHdrCc.cc index 1df1278dae..43dc2510ce 100644 --- a/src/HttpHdrCc.cc +++ b/src/HttpHdrCc.cc @@ -49,20 +49,20 @@ typedef struct { /* order must match that of enum http_hdr_cc_type. The constraint is verified at initialization time */ static HttpHeaderCcFields CcAttrs[CC_ENUM_END] = { - {"public", CC_PUBLIC}, - {"private", CC_PRIVATE}, - {"no-cache", CC_NO_CACHE}, - {"no-store", CC_NO_STORE}, - {"no-transform", CC_NO_TRANSFORM}, - {"must-revalidate", CC_MUST_REVALIDATE}, - {"proxy-revalidate", CC_PROXY_REVALIDATE}, - {"max-age", CC_MAX_AGE}, - {"s-maxage", CC_S_MAXAGE}, - {"max-stale", CC_MAX_STALE}, - {"min-fresh", CC_MIN_FRESH}, - {"only-if-cached", CC_ONLY_IF_CACHED}, - {"stale-if-error", CC_STALE_IF_ERROR}, - {"Other,", CC_OTHER} /* ',' will protect from matches */ + {"public", CC_PUBLIC}, + {"private", CC_PRIVATE}, + {"no-cache", CC_NO_CACHE}, + {"no-store", CC_NO_STORE}, + {"no-transform", CC_NO_TRANSFORM}, + {"must-revalidate", CC_MUST_REVALIDATE}, + {"proxy-revalidate", CC_PROXY_REVALIDATE}, + {"max-age", CC_MAX_AGE}, + {"s-maxage", CC_S_MAXAGE}, + {"max-stale", CC_MAX_STALE}, + {"min-fresh", CC_MIN_FRESH}, + {"only-if-cached", CC_ONLY_IF_CACHED}, + {"stale-if-error", CC_STALE_IF_ERROR}, + {"Other,", CC_OTHER} /* ',' will protect from matches */ }; /// Map an header name to its type, to expedite parsing @@ -83,7 +83,7 @@ void httpHdrCcInitModule(void) { /* build lookup and accounting structures */ - for (int32_t i = 0;i < CC_ENUM_END; ++i) { + for (int32_t i = 0; i < CC_ENUM_END; ++i) { const HttpHeaderCcFields &f=CcAttrs[i]; assert(i == f.id); /* verify assumption: the id is the key into the array */ const StringArea k(f.name,strlen(f.name)); @@ -188,14 +188,30 @@ HttpHdrCc::parse(const String & str) } break; - case CC_PUBLIC: Public(true); break; - case CC_PRIVATE: Private(true); break; - case CC_NO_CACHE: noCache(true); break; - case CC_NO_STORE: noStore(true); break; - case CC_NO_TRANSFORM: noTransform(true); break; - case CC_MUST_REVALIDATE: mustRevalidate(true); break; - case CC_PROXY_REVALIDATE: proxyRevalidate(true); break; - case CC_ONLY_IF_CACHED: onlyIfCached(true); break; + case CC_PUBLIC: + Public(true); + break; + case CC_PRIVATE: + Private(true); + break; + case CC_NO_CACHE: + noCache(true); + break; + case CC_NO_STORE: + noStore(true); + break; + case CC_NO_TRANSFORM: + noTransform(true); + break; + case CC_MUST_REVALIDATE: + mustRevalidate(true); + break; + case CC_PROXY_REVALIDATE: + proxyRevalidate(true); + break; + case CC_ONLY_IF_CACHED: + onlyIfCached(true); + break; case CC_OTHER: if (other.size()) diff --git a/src/HttpHdrCc.cci b/src/HttpHdrCc.cci index 17e69648f7..c02e7025dd 100644 --- a/src/HttpHdrCc.cci +++ b/src/HttpHdrCc.cci @@ -53,7 +53,7 @@ HttpHdrCc::setValue(int32_t &value, int32_t new_value, http_hdr_cc_type hdr, boo if (setting) { if (new_value < 0) { debugs(65,3,HERE << "rejecting negative-value Cache-Control directive " << hdr - << " value " << new_value ); + << " value " << new_value ); return; } } else { diff --git a/src/HttpHdrCc.h b/src/HttpHdrCc.h index b31b2be313..e0603727ba 100644 --- a/src/HttpHdrCc.h +++ b/src/HttpHdrCc.h @@ -44,14 +44,14 @@ class HttpHdrCc { public: - static const int32_t MAX_AGE_UNKNOWN=-1; //max-age is unset - static const int32_t S_MAXAGE_UNKNOWN=-1; //s-maxage is unset - static const int32_t MAX_STALE_UNKNOWN=-1; //max-stale is unset - ///used to mark a valueless Cache-Control: max-stale directive, which instructs - /// us to treat responses of any age as fresh - static const int32_t MAX_STALE_ANY=0x7fffffff; - static const int32_t STALE_IF_ERROR_UNKNOWN=-1; //stale_if_error is unset - static const int32_t MIN_FRESH_UNKNOWN=-1; //min_fresh is unset + static const int32_t MAX_AGE_UNKNOWN=-1; //max-age is unset + static const int32_t S_MAXAGE_UNKNOWN=-1; //s-maxage is unset + static const int32_t MAX_STALE_UNKNOWN=-1; //max-stale is unset + ///used to mark a valueless Cache-Control: max-stale directive, which instructs + /// us to treat responses of any age as fresh + static const int32_t MAX_STALE_ANY=0x7fffffff; + static const int32_t STALE_IF_ERROR_UNKNOWN=-1; //stale_if_error is unset + static const int32_t MIN_FRESH_UNKNOWN=-1; //min_fresh is unset HttpHdrCc() : mask(0), max_age(MAX_AGE_UNKNOWN), s_maxage(S_MAXAGE_UNKNOWN), diff --git a/src/base/StringArea.h b/src/base/StringArea.h index 9463e14955..7391515df3 100644 --- a/src/base/StringArea.h +++ b/src/base/StringArea.h @@ -45,16 +45,18 @@ * Not meant for stand-alone storage. Validity of the * pointed-to string is responsibility of the caller. */ -class StringArea { - public: +class StringArea +{ +public: /// build a StringArea by explicitly assigning pointed-to area and and length StringArea(const char * ptr, size_t len): theStart(ptr), theLen(len) {} bool operator==(const StringArea &s) const { return theLen==s.theLen && memcmp(theStart,s.theStart,theLen)==0; } bool operator!=(const StringArea &s) const { return !operator==(s); } bool operator< ( const StringArea &s) const { - return (theLen < s.theLen || (theLen == s.theLen && memcmp(theStart,s.theStart,theLen) < 0)) ; } + return (theLen < s.theLen || (theLen == s.theLen && memcmp(theStart,s.theStart,theLen) < 0)) ; + } - private: +private: /// pointed to the externally-managed memory area const char *theStart; /// length of the string diff --git a/src/http.cc b/src/http.cc index d55a969b58..7cf6938f2d 100644 --- a/src/http.cc +++ b/src/http.cc @@ -929,7 +929,7 @@ no_cache: if (rep->cache_control->proxyRevalidate() || rep->cache_control->mustRevalidate() || rep->cache_control->hasSMaxAge() - ) + ) EBIT_SET(entry->flags, ENTRY_REVALIDATE); } diff --git a/src/refresh.cc b/src/refresh.cc index 154b66b928..9049aa1335 100644 --- a/src/refresh.cc +++ b/src/refresh.cc @@ -271,7 +271,7 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta) if (cc && cc->hasMinFresh()) { const int32_t minFresh=cc->minFresh(); debugs(22, 3, "\tage + min-fresh:\t" << age << " + " << - minFresh << " = " << age + minFresh); + minFresh << " = " << age + minFresh); debugs(22, 3, "\tcheck_time + min-fresh:\t" << check_time << " + " << minFresh << " = " << mkrfc1123(check_time + minFresh)); @@ -288,7 +288,7 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta) // stale-if-error requires any failure be passed thru when its period is over. if (request && entry->mem_obj && entry->mem_obj->getReply() && entry->mem_obj->getReply()->cache_control && - entry->mem_obj->getReply()->cache_control->hasStaleIfError() && + entry->mem_obj->getReply()->cache_control->hasStaleIfError() && entry->mem_obj->getReply()->cache_control->staleIfError() < staleness) { debugs(22, 3, "refreshCheck: stale-if-error period expired.");