Hi,
 Some changes for squid3-largeobj branch, mostly related with Range
Headers and  ICAP client.
It is not fully tested, but I believe that it is near to provide full
large objects  support (but not large objects caching)
The first tests are OK for me (ICAP still is not tested).

It is difficult to explain all changes so I will try to list the changes
of class member variables.

- First of all I changed the
   size_t Range<c>::size()
   to
    C Range<c>::size()
This is because it is used in range headers in which the size can be
bigger than the maximum value of size_t.
It also make sense the size of a range of 32bit integers to be 32bit
integer and the range of 64bit  integers to be a 64bit integer

- BodyPipe::theBodySize,thePutSize,theGetSize must be 64bit
- Header Ranges changes:
      HttpHdrContRange::elength must be 64bit integer
      HttpHdrRangeSpec::offset,length must be 64bit
      HttpHdrRangeSpec::HttpRange must  be of type Range<int64_t>
      HttpHdrRange::clen must be 64 bit
      HttpHdrRangeIter::debt_size must be 64bit
  - I am adding the function StringToInt64(const char *str, int64_t
&result, const char **p, int base);


The ICAP client related changes are:

- ChunkedCodingParser::theChunkSize,
ChunkedCodingParser::theLeftBodySize must be 64bit
- SizedEstimate::theData, must be 64 bit
- VirginBodyAct::theStart must be 64 bit
- ICAPModXact::virginConsumed must be 64 bit


Regards,
        Christos
Index: include/Range.h
===================================================================
RCS file: /cvsroot/squid/squid3/include/Range.h,v
retrieving revision 1.7
diff -u -r1.7 Range.h
--- include/Range.h	23 Apr 2006 11:27:37 -0000	1.7
+++ include/Range.h	2 May 2007 18:02:36 -0000
@@ -50,7 +50,7 @@
     C start;
     C end;
     Range intersection (Range const &) const; 
-    size_t size() const;
+    C size() const;
 };
 
 template <class C>
@@ -75,7 +75,7 @@
 }
 
 template<class C>
-size_t
+C
 Range<C>::size() const
 {
     return end > start ? end - start : 0;
Index: src/BodyPipe.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/BodyPipe.cc,v
retrieving revision 1.2
diff -u -r1.2 BodyPipe.cc
--- src/BodyPipe.cc	6 Apr 2007 04:50:40 -0000	1.2
+++ src/BodyPipe.cc	2 May 2007 18:02:38 -0000
@@ -43,7 +43,7 @@
 	theBuf.clean();
 }
 
-void BodyPipe::setBodySize(size_t aBodySize)
+void BodyPipe::setBodySize(uint64_t aBodySize)
 {
 	assert(!bodySizeKnown());
 	assert(aBodySize >= 0);
@@ -58,13 +58,13 @@
 	debugs(91,7, HERE << "set body size" << status());
 }
 
-size_t BodyPipe::bodySize() const
+uint64_t BodyPipe::bodySize() const
 {
 	assert(bodySizeKnown());
-	return static_cast<size_t>(theBodySize);
+	return static_cast<uint64_t>(theBodySize);
 }
 
-bool BodyPipe::expectMoreAfter(size_t offset) const
+bool BodyPipe::expectMoreAfter(uint64_t offset) const
 {
 	assert(theGetSize <= offset);
 	return offset < thePutSize || // buffer has more now or
@@ -290,9 +290,9 @@
 
     buf.append(" [", 2);
 
-	buf.Printf("%d<=%d", (int)theGetSize, (int)thePutSize);
+	buf.Printf("%"PRId64"<=%"PRId64, (int64_t)theGetSize, (int64_t)thePutSize);
     if (theBodySize >= 0)
-        buf.Printf("<=%d", (int)theBodySize);
+        buf.Printf("<=%"PRId64, theBodySize);
 	else
 		buf.append("<=?", 3);
 
Index: src/BodyPipe.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/BodyPipe.h,v
retrieving revision 1.2
diff -u -r1.2 BodyPipe.h
--- src/BodyPipe.h	6 Apr 2007 04:50:40 -0000	1.2
+++ src/BodyPipe.h	2 May 2007 18:02:38 -0000
@@ -52,7 +52,7 @@
 	public:
 		BodyPipe &pipe;
 		MemBuf &buf;
-		const size_t offset; // of current content, relative to the body start
+		const uint64_t offset; // of current content, relative to the body start
 
 	protected:
 		const size_t checkedOutSize;
@@ -81,10 +81,10 @@
 		BodyPipe(Producer *aProducer);
 		~BodyPipe(); // asserts that producer and consumer are cleared
 
-		void setBodySize(size_t aSize); // set body size
+		void setBodySize(uint64_t aSize); // set body size
 		bool bodySizeKnown() const { return theBodySize >= 0; }
-		size_t bodySize() const;
-		size_t consumedSize() const { return theGetSize; }
+		uint64_t bodySize() const;
+		uint64_t consumedSize() const { return theGetSize; }
 		bool productionEnded() const { return !theProducer; }
 
 		// called by producers
@@ -99,7 +99,7 @@
 		void clearConsumer(); // aborts if still piping
 		size_t getMoreData(MemBuf &buf);
 		void consume(size_t size);
-		bool expectMoreAfter(size_t offset) const;
+		bool expectMoreAfter(uint64_t offset) const;
 		bool exhausted() const; // saw eof/abort and all data consumed
 
 		// start or continue consuming when there is no consumer
@@ -140,12 +140,12 @@
 		AsyncCallWrapper(91,5, BodyPipe, tellBodyProducerAborted);
 
 	private:
-		ssize_t theBodySize;   // expected total content length, if known
+		int64_t  theBodySize;   // expected total content length, if known
 		Producer *theProducer; // content producer, if any
 		Consumer *theConsumer; // content consumer, if any
 
-		size_t thePutSize; // ever-increasing total
-		size_t theGetSize; // ever-increasing total
+		uint64_t thePutSize; // ever-increasing total
+		uint64_t theGetSize; // ever-increasing total
 
 		MemBuf theBuf; // produced but not yet consumed content, if any
 
Index: src/HttpHdrContRange.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/HttpHdrContRange.cc,v
retrieving revision 1.3.26.2
diff -u -r1.3.26.2 HttpHdrContRange.cc
--- src/HttpHdrContRange.cc	1 May 2007 21:03:42 -0000	1.3.26.2
+++ src/HttpHdrContRange.cc	2 May 2007 18:02:38 -0000
@@ -81,16 +81,16 @@
     }
 
     /* parse offset */
-    if (!httpHeaderParseSize(field, &spec->offset))
+    if (!httpHeaderParseOffset(field, &spec->offset))
         return 0;
 
     p++;
 
     /* do we have last-pos ? */
     if (p - field < flen) {
-        ssize_t last_pos;
+        int64_t last_pos;
 
-        if (!httpHeaderParseSize(p, &last_pos))
+        if (!httpHeaderParseOffset(p, &last_pos))
             return 0;
 
         spec->length = size_diff(last_pos + 1, spec->offset);
@@ -100,7 +100,7 @@
     assert (spec->length >= 0);
 
     /* we managed to parse, check if the result makes sence */
-    if (known_spec((size_t)spec->length) && spec->length == 0) {
+    if (known_spec(spec->length) && spec->length == 0) {
         debugs(68, 2, "invalid range (" << spec->offset << " += " <<
                (long int) spec->length << ") in resp-range-spec near: '" << field << "'");
         return 0;
@@ -116,11 +116,11 @@
     assert (spec->length >= 0);
     assert (spec->length >= 0);
 
-    if (!known_spec((size_t)spec->offset) || !known_spec((size_t)spec->length))
+    if (!known_spec(spec->offset) || !known_spec(spec->length))
         packerPrintf(p, "*");
     else
-        packerPrintf(p, "bytes %ld-%ld",
-                     (long int) spec->offset, (long int) spec->offset + spec->length - 1);
+        packerPrintf(p, "bytes %"PRId64"-%"PRId64,
+                     spec->offset, spec->offset + spec->length - 1);
 }
 
 /*
@@ -176,7 +176,7 @@
 
     if (*p == '*')
         range->elength = range_spec_unknown;
-    else if (!httpHeaderParseSize(p, &range->elength))
+    else if (!httpHeaderParseOffset(p, &range->elength))
         return 0;
 
         debugs(68, 8, "parsed content-range field: " <<
@@ -212,14 +212,14 @@
     /* Ensure typecast is safe */
     assert (range->elength >= 0);
 
-    if (!known_spec((size_t)range->elength))
+    if (!known_spec(range->elength))
         packerPrintf(p, "/*");
     else
-        packerPrintf(p, "/%ld", (long int) range->elength);
+        packerPrintf(p, "/%"PRId64, range->elength);
 }
 
 void
-httpHdrContRangeSet(HttpHdrContRange * cr, HttpHdrRangeSpec spec, ssize_t ent_len)
+httpHdrContRangeSet(HttpHdrContRange * cr, HttpHdrRangeSpec spec, int64_t ent_len)
 {
     assert(cr && ent_len >= 0);
     cr->spec = spec;
Index: src/HttpHdrContRange.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/HttpHdrContRange.h,v
retrieving revision 1.4
diff -u -r1.4 HttpHdrContRange.h
--- src/HttpHdrContRange.h	23 Apr 2006 11:27:37 -0000	1.4
+++ src/HttpHdrContRange.h	2 May 2007 18:02:38 -0000
@@ -43,7 +43,7 @@
 
 public:
     HttpHdrRangeSpec spec;
-    ssize_t elength;		/* entity length, not content length */
+    int64_t elength;		/* entity length, not content length */
 };
 
 /* Http Content Range Header Field */
@@ -55,9 +55,9 @@
 SQUIDCEXTERN HttpHdrContRange *httpHdrContRangeDup(const HttpHdrContRange * crange);
 SQUIDCEXTERN void httpHdrContRangePackInto(const HttpHdrContRange * crange, Packer * p);
 /* inits with given spec */
-SQUIDCEXTERN void httpHdrContRangeSet(HttpHdrContRange *, HttpHdrRangeSpec, ssize_t);
+SQUIDCEXTERN void httpHdrContRangeSet(HttpHdrContRange *, HttpHdrRangeSpec, int64_t);
 ;
-SQUIDCEXTERN void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, ssize_t);
+SQUIDCEXTERN void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, int64_t);
 
 
 #endif /* SQUID_HTTPHDRCONTRANGE_H */
Index: src/HttpHdrRange.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/HttpHdrRange.cc,v
retrieving revision 1.13.10.2
diff -u -r1.13.10.2 HttpHdrRange.cc
--- src/HttpHdrRange.cc	1 May 2007 21:03:42 -0000	1.13.10.2
+++ src/HttpHdrRange.cc	2 May 2007 18:02:44 -0000
@@ -63,7 +63,7 @@
 
 /* globals */
 size_t HttpHdrRange::ParsedCount = 0;
-ssize_t const HttpHdrRangeSpec::UnknownPosition = -1;
+int64_t const HttpHdrRangeSpec::UnknownPosition = -1;
 
 /*
  * Range-Spec
@@ -93,7 +93,7 @@
 
     /* is it a suffix-byte-range-spec ? */
     if (*field == '-') {
-        if (!httpHeaderParseSize(field + 1, &length))
+        if (!httpHeaderParseOffset(field + 1, &length))
             return false;
     } else
         /* must have a '-' somewhere in _this_ field */
@@ -101,16 +101,16 @@
             debugs(64, 2, "ignoring invalid (missing '-') range-spec near: '" << field << "'");
             return false;
         } else {
-            if (!httpHeaderParseSize(field, &offset))
+            if (!httpHeaderParseOffset(field, &offset))
                 return false;
 
             p++;
 
             /* do we have last-pos ? */
             if (p - field < flen) {
-                ssize_t last_pos;
+                int64_t last_pos;
 
-                if (!httpHeaderParseSize(p, &last_pos))
+                if (!httpHeaderParseOffset(p, &last_pos))
                     return false;
 
                 HttpHdrRangeSpec::HttpRange aSpec (offset, last_pos + 1);
@@ -132,20 +132,20 @@
 HttpHdrRangeSpec::packInto(Packer * packer) const
 {
     if (!known_spec(offset))	/* suffix */
-        packerPrintf(packer, "-%ld", (long int) length);
+        packerPrintf(packer, "-%"PRId64,  length);
     else if (!known_spec(length))		/* trailer */
-        packerPrintf(packer, "%ld-", (long int) offset);
+        packerPrintf(packer, "%"PRId64"-", offset);
     else			/* range */
-        packerPrintf(packer, "%ld-%ld",
-                     (long int) offset, (long int) offset + length - 1);
+        packerPrintf(packer, "%"PRId64"-%"PRId64,
+                     offset, offset + length - 1);
 }
 
 void
 HttpHdrRangeSpec::outputInfo( char const *note) const
 {
     debugs(64, 5, "HttpHdrRangeSpec::canonize: " << note << ": [" <<
-           (long int) offset << ", " << (long int) offset + length <<
-           ") len: " << (long int) length);
+           offset << ", " << offset + length <<
+           ") len: " << length);
 }
 
 /* fills "absent" positions in range specification based on response body size
@@ -153,7 +153,7 @@
  * range is valid if its intersection with [0,length-1] is not empty
  */
 int
-HttpHdrRangeSpec::canonize(size_t clen)
+HttpHdrRangeSpec::canonize(int64_t clen)
 {
     outputInfo ("have");
     HttpRange object(0, clen);
@@ -190,8 +190,8 @@
     bool merged (false);
 #if MERGING_BREAKS_NOTHING
     /* Note: this code works, but some clients may not like its effects */
-    size_t rhs = offset + length;		/* no -1 ! */
-    const size_t donor_rhs = donor->offset + donor->length;	/* no -1 ! */
+    uint64_t rhs = offset + length;		/* no -1 ! */
+    const uint64_t donor_rhs = donor->offset + donor->length;	/* no -1 ! */
     assert(known_spec(offset));
     assert(known_spec(donor->offset));
     assert(length > 0);
@@ -402,7 +402,7 @@
 }
 
 int
-HttpHdrRange::canonize (size_t newClen)
+HttpHdrRange::canonize (int64_t newClen)
 {
     clen = newClen;
     debugs(64, 3, "HttpHdrRange::canonize: started with " << specs.count <<
@@ -420,7 +420,7 @@
 bool
 HttpHdrRange::isComplex() const
 {
-    size_t offset = 0;
+    uint64_t offset = 0;
     assert(this);
     /* check that all rangers are in "strong" order */
     const_iterator pos (begin());
@@ -429,7 +429,7 @@
         /* Ensure typecasts is safe */
         assert ((*pos)->offset >= 0);
 
-        if ((unsigned int)(*pos)->offset < offset)
+        if ((uint64_t)(*pos)->offset < offset)
             return 1;
 
         offset = (*pos)->offset + (*pos)->length;
@@ -450,7 +450,7 @@
     assert(this);
     /* check that all rangers are in "strong" order, */
     /* as far as we can tell without the content length */
-    size_t offset = 0;
+    uint64_t offset = 0;
 
     for (const_iterator pos (begin()); pos != end(); ++pos) {
         if (!known_spec((*pos)->offset))	/* ignore unknowns */
@@ -459,7 +459,7 @@
         /* Ensure typecasts is safe */
         assert ((*pos)->offset >= 0);
 
-        if ((size_t) (*pos)->offset < offset)
+        if ((uint64_t) (*pos)->offset < offset)
             return true;
 
         offset = (*pos)->offset;
@@ -476,10 +476,10 @@
  * or HttpHdrRangeSpec::UnknownPosition
  * this is used for size limiting
  */
-ssize_t
+int64_t
 HttpHdrRange::firstOffset() const
 {
-    ssize_t offset = HttpHdrRangeSpec::UnknownPosition;
+    int64_t offset = HttpHdrRangeSpec::UnknownPosition;
     assert(this);
     const_iterator pos = begin();
 
@@ -499,15 +499,15 @@
  * ranges are combined into one, for example FTP REST.
  * Use 0 for size if unknown
  */
-ssize_t
-HttpHdrRange::lowestOffset(ssize_t size) const
+int64_t
+HttpHdrRange::lowestOffset(int64_t size) const
 {
-    ssize_t offset = HttpHdrRangeSpec::UnknownPosition;
+    int64_t offset = HttpHdrRangeSpec::UnknownPosition;
     const_iterator pos = begin();
     assert(this);
 
     while (pos != end()) {
-        ssize_t current = (*pos)->offset;
+        int64_t current = (*pos)->offset;
 
         if (!known_spec(current)) {
             if ((*pos)->length > size || !known_spec((*pos)->length))
@@ -546,7 +546,7 @@
         /* tail request */
         return true;
 
-    if ((ssize_t)Config.rangeOffsetLimit >= firstOffset())
+    if ((int64_t)Config.rangeOffsetLimit >= firstOffset())
         /* below the limit */
         return false;
 
@@ -590,14 +590,14 @@
     }
 }
 
-ssize_t
+int64_t
 HttpHdrRangeIter::debt() const
 {
     debugs(64, 3, "HttpHdrRangeIter::debt: debt is " << debt_size);
     return debt_size;
 }
 
-void HttpHdrRangeIter::debt(ssize_t newDebt)
+void HttpHdrRangeIter::debt(int64_t newDebt)
 {
     debugs(64, 3, "HttpHdrRangeIter::debt: was " << debt_size << " now " << newDebt);
     debt_size = newDebt;
Index: src/HttpHeaderRange.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/HttpHeaderRange.h,v
retrieving revision 1.9
diff -u -r1.9 HttpHeaderRange.h
--- src/HttpHeaderRange.h	6 Jun 2006 19:50:39 -0000	1.9
+++ src/HttpHeaderRange.h	2 May 2007 18:02:44 -0000
@@ -48,19 +48,19 @@
 
 public:
     MEMPROXY_CLASS(HttpHdrRangeSpec);
-    typedef Range<ssize_t> HttpRange;
-    static ssize_t const UnknownPosition;
+    typedef Range<int64_t> HttpRange;
+    static int64_t const UnknownPosition;
 
     HttpHdrRangeSpec();
     static HttpHdrRangeSpec *Create(const char *field, int fieldLen);
 
     bool parseInit(const char *field, int flen);
-    int canonize(size_t clen);
+    int canonize(int64_t clen);
     void outputInfo( char const *note) const;
     void packInto(Packer * p) const;
     bool mergeWith(const HttpHdrRangeSpec * donor);
-    ssize_t offset;
-    ssize_t length;
+    int64_t offset;
+    int64_t length;
 };
 
 MEMPROXY_CLASS_INLINE(HttpHdrRangeSpec)
@@ -93,7 +93,7 @@
     const_iterator end() const;
 
     /* adjust specs after the length is known */
-    int canonize(size_t);
+    int canonize(int64_t);
     int canonize(HttpReply *rep);
     /* returns true if ranges are valid; inits HttpHdrRange */
     bool parseInit(const String * range_spec);
@@ -101,8 +101,8 @@
     /* other */
     bool isComplex() const;
     bool willBeComplex() const;
-    ssize_t firstOffset() const;
-    ssize_t lowestOffset(ssize_t) const;
+    int64_t firstOffset() const;
+    int64_t lowestOffset(int64_t) const;
     bool offsetLimitExceeded() const;
     bool contains(HttpHdrRangeSpec& r) const;
     Vector<HttpHdrRangeSpec *> specs;
@@ -110,7 +110,7 @@
 private:
     void getCanonizedSpecs (Vector<HttpHdrRangeSpec *> &copy);
     void merge (Vector<HttpHdrRangeSpec *> &basis);
-    ssize_t clen;
+    int64_t clen;
 };
 
 MEMPROXY_CLASS_INLINE(HttpHdrRange)
@@ -124,9 +124,9 @@
     HttpHdrRange::iterator pos;
     const HttpHdrRangeSpec *currentSpec() const;
     void updateSpec();
-    ssize_t debt() const;
-    void debt(ssize_t);
-    ssize_t debt_size;		/* bytes left to send from the current spec */
+    int64_t debt() const;
+    void debt(int64_t);
+    int64_t debt_size;		/* bytes left to send from the current spec */
     String boundary;		/* boundary for multipart responses */
     bool valid;
 };
Index: src/HttpHeaderTools.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/HttpHeaderTools.cc,v
retrieving revision 1.21.6.4
diff -u -r1.21.6.4 HttpHeaderTools.cc
--- src/HttpHeaderTools.cc	30 Apr 2007 17:08:09 -0000	1.21.6.4
+++ src/HttpHeaderTools.cc	2 May 2007 18:02:44 -0000
@@ -143,7 +143,7 @@
 
 /* wrapper arrounf PutContRange */
 void
-httpHeaderAddContRange(HttpHeader * hdr, HttpHdrRangeSpec spec, ssize_t ent_len)
+httpHeaderAddContRange(HttpHeader * hdr, HttpHdrRangeSpec spec, int64_t ent_len)
 {
     HttpHdrContRange *cr = httpHdrContRangeCreate();
     assert(hdr && ent_len >= 0);
Index: src/HttpMsg.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/HttpMsg.h,v
retrieving revision 1.14.6.2
diff -u -r1.14.6.2 HttpMsg.h
--- src/HttpMsg.h	19 Apr 2007 04:43:38 -0000	1.14.6.2
+++ src/HttpMsg.h	2 May 2007 18:02:44 -0000
@@ -86,7 +86,7 @@
 
     virtual int httpMsgParseError();
 
-    virtual bool expectingBody(method_t, ssize_t&) const = 0;
+    virtual bool expectingBody(method_t, int64_t&) const = 0;
 
     void firstLineBuf(MemBuf&);
 
Index: src/HttpReply.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/HttpReply.cc,v
retrieving revision 1.38.6.4
diff -u -r1.38.6.4 HttpReply.cc
--- src/HttpReply.cc	20 Apr 2007 22:53:46 -0000	1.38.6.4
+++ src/HttpReply.cc	2 May 2007 18:02:50 -0000
@@ -469,7 +469,7 @@
  * along with this response
  */
 bool
-HttpReply::expectingBody(method_t req_method, ssize_t& theSize) const
+HttpReply::expectingBody(method_t req_method, int64_t& theSize) const
 {
     bool expectBody = true;
 
Index: src/HttpReply.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/HttpReply.h,v
retrieving revision 1.18.10.2
diff -u -r1.18.10.2 HttpReply.h
--- src/HttpReply.h	19 Apr 2007 04:45:16 -0000	1.18.10.2
+++ src/HttpReply.h	2 May 2007 18:02:50 -0000
@@ -97,7 +97,7 @@
 public:
     virtual int httpMsgParseError();
 
-    virtual bool expectingBody(method_t, ssize_t&) const;
+    virtual bool expectingBody(method_t, int64_t&) const;
 
     void updateOnNotModified(HttpReply const *other);
 
Index: src/HttpRequest.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/HttpRequest.cc,v
retrieving revision 1.38.2.1
diff -u -r1.38.2.1 HttpRequest.cc
--- src/HttpRequest.cc	30 Apr 2007 17:08:09 -0000	1.38.2.1
+++ src/HttpRequest.cc	2 May 2007 18:02:50 -0000
@@ -373,7 +373,7 @@
  * along with this request
  */
 bool
-HttpRequest::expectingBody(method_t unused, ssize_t& theSize) const
+HttpRequest::expectingBody(method_t unused, int64_t& theSize) const
 {
     bool expectBody = false;
 
Index: src/HttpRequest.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/HttpRequest.h,v
retrieving revision 1.26
diff -u -r1.26 HttpRequest.h
--- src/HttpRequest.h	16 Apr 2007 18:04:49 -0000	1.26
+++ src/HttpRequest.h	2 May 2007 18:02:58 -0000
@@ -135,7 +135,7 @@
 
     int parseHeader(const char *parse_start, int len);
 
-    virtual bool expectingBody(method_t unused, ssize_t&) const;
+    virtual bool expectingBody(method_t unused, int64_t&) const;
 
     bool bodyNibbled() const; // the request has a [partially] consumed body
 
Index: src/Parsing.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/Parsing.cc,v
retrieving revision 1.3
diff -u -r1.3 Parsing.cc
--- src/Parsing.cc	8 Oct 2006 13:51:46 -0000	1.3
+++ src/Parsing.cc	2 May 2007 18:02:58 -0000
@@ -125,3 +125,23 @@
 
     return false;
 }
+
+bool
+StringToInt64(const char *s, int64_t &result, const char **p, int base)
+{
+    if (s) {
+        char *ptr = 0;
+        const int64_t h = (int64_t) strtoll(s, &ptr, base);
+
+        if (ptr != s && ptr) {
+            result = h;
+
+            if (p)
+                *p = ptr;
+
+            return true;
+        }
+    }
+
+    return false;
+}
Index: src/Parsing.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/Parsing.h,v
retrieving revision 1.3
diff -u -r1.3 Parsing.h
--- src/Parsing.h	8 Oct 2006 13:51:46 -0000	1.3
+++ src/Parsing.h	2 May 2007 18:02:58 -0000
@@ -47,5 +47,6 @@
 
 // on success, returns true and sets *p (if any) to the end of the integer
 extern bool StringToInt(const char *str, int &result, const char **p, int base);
+extern bool StringToInt64(const char *str, int64_t &result, const char **p, int base);
 
 #endif /* SQUID_PARSING_H */
Index: src/Server.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/Server.cc,v
retrieving revision 1.6.6.2
diff -u -r1.6.6.2 Server.cc
--- src/Server.cc	1 May 2007 21:03:42 -0000	1.6.6.2
+++ src/Server.cc	2 May 2007 18:02:58 -0000
@@ -313,7 +313,7 @@
     assert(!virginBodyDestination);
     assert(!reply->body_pipe);
     // start body pipe to feed ICAP transaction if needed
-    ssize_t size = 0;
+    int64_t size = 0;
     if (reply->expectingBody(cause->method, size) && size) {
         virginBodyDestination = new BodyPipe(this);
         reply->body_pipe = virginBodyDestination;
Index: src/client_side.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/client_side.cc,v
retrieving revision 1.121.2.8
diff -u -r1.121.2.8 client_side.cc
--- src/client_side.cc	1 May 2007 21:03:42 -0000	1.121.2.8
+++ src/client_side.cc	2 May 2007 18:03:16 -0000
@@ -755,7 +755,8 @@
 size_t
 ClientSocketContext::lengthToSend(Range<int64_t> const &available)
 {
-    size_t maximum = available.size();
+    /*the size of available range can always fit in a size_t type*/
+    size_t maximum = (size_t)available.size();
 
     if (!http->request->range)
         return maximum;
@@ -768,10 +769,10 @@
     assert (http->range_iter.debt() > 0);
 
     /* TODO this + the last line could be a range intersection calculation */
-    if ((ssize_t)available.start < http->range_iter.currentSpec()->offset)
+    if (available.start < http->range_iter.currentSpec()->offset)
         return 0;
 
-    return XMIN(http->range_iter.debt(), (ssize_t)maximum);
+    return XMIN(http->range_iter.debt(), (int64_t)maximum);
 }
 
 void
Index: src/ICAP/ChunkedCodingParser.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/ICAP/ChunkedCodingParser.cc,v
retrieving revision 1.4
diff -u -r1.4 ChunkedCodingParser.cc
--- src/ICAP/ChunkedCodingParser.cc	6 Apr 2007 12:54:14 -0000	1.4
+++ src/ICAP/ChunkedCodingParser.cc	2 May 2007 18:04:11 -0000
@@ -66,10 +66,10 @@
 
     if (findCrlf(crlfBeg, crlfEnd)) {
         debugs(93,7, "found chunk-size end: " << crlfBeg << "-" << crlfEnd);
-        int size = -1;
+        int64_t size = -1;
         const char *p = 0;
 
-        if (StringToInt(theIn->content(), size, &p, 16)) {
+        if (StringToInt64(theIn->content(), size, &p, 16)) {
             if (size < 0) {
                 throw TexcHere("negative chunk size");
                 return;
@@ -104,7 +104,7 @@
 {
     Must(theLeftBodySize > 0); // Should, really
 
-    const size_t availSize = XMIN(theLeftBodySize, (size_t)theIn->contentSize());
+    const size_t availSize = XMIN(theLeftBodySize, (uint64_t)theIn->contentSize());
     const size_t safeSize = XMIN(availSize, (size_t)theOut->potentialSpaceSize());
 
     doNeedMoreData = availSize < theLeftBodySize;
Index: src/ICAP/ChunkedCodingParser.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/ICAP/ChunkedCodingParser.h,v
retrieving revision 1.2
diff -u -r1.2 ChunkedCodingParser.h
--- src/ICAP/ChunkedCodingParser.h	22 Nov 2005 03:13:08 -0000	1.2
+++ src/ICAP/ChunkedCodingParser.h	2 May 2007 18:04:19 -0000
@@ -82,8 +82,8 @@
     MemBuf *theOut;
 
     Step theStep;
-    size_t theChunkSize;
-    size_t theLeftBodySize;
+    uint64_t theChunkSize;
+    uint64_t theLeftBodySize;
     bool doNeedMoreData;
 };
 
Index: src/ICAP/ICAPModXact.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/ICAP/ICAPModXact.cc,v
retrieving revision 1.19.6.2
diff -u -r1.19.6.2 ICAPModXact.cc
--- src/ICAP/ICAPModXact.cc	30 Apr 2007 17:08:18 -0000	1.19.6.2
+++ src/ICAP/ICAPModXact.cc	2 May 2007 18:04:22 -0000
@@ -328,20 +328,20 @@
 {
     Must(act.active());
     // asbolute start of unprocessed data
-    const size_t start = act.offset();
+    const uint64_t start = act.offset();
     // absolute end of buffered data
-    const size_t end = virginConsumed + virgin.body_pipe->buf().contentSize();
+    const uint64_t end = virginConsumed + virgin.body_pipe->buf().contentSize();
     Must(virginConsumed <= start && start <= end);
-    return end - start;
+    return static_cast<size_t>(end - start);
 }
 
 // pointer to buffered virgin body data available for the specified activity
 const char *ICAPModXact::virginContentData(const VirginBodyAct &act) const
 {
     Must(act.active());
-    const size_t start = act.offset();
+    const uint64_t start = act.offset();
     Must(virginConsumed <= start);
-    return virgin.body_pipe->buf().content() + (start-virginConsumed);
+    return virgin.body_pipe->buf().content() + static_cast<size_t>(start-virginConsumed);
 }
 
 void ICAPModXact::virginConsume()
@@ -351,8 +351,8 @@
 
     BodyPipe &bp = *virgin.body_pipe;
     const size_t have = static_cast<size_t>(bp.buf().contentSize());
-    const size_t end = virginConsumed + have;
-    size_t offset = end;
+    const uint64_t end = virginConsumed + have;
+    uint64_t offset = end;
 
     if (virginBodyWriting.active())
         offset = XMIN(virginBodyWriting.offset(), offset);
@@ -362,7 +362,7 @@
 
     Must(virginConsumed <= offset && offset <= end);
 
-    if (const size_t size = offset - virginConsumed) {
+    if (const size_t size = static_cast<size_t>(offset - virginConsumed)) {
         debugs(93, 8, HERE << "consuming " << size << " out of " << have <<
                " virgin body bytes");
         bp.consume(size);
@@ -1120,7 +1120,7 @@
         ad = 0;
     else
     if (virginBody.knownSize())
-        ad = XMIN(ad, virginBody.size()); // not more than we have
+        ad = XMIN(static_cast<uint64_t>(ad), virginBody.size()); // not more than we have
 
     debugs(93, 5, "ICAPModXact should offer " << ad << "-byte preview " <<
            "(service wanted " << wantedSize << ")");
@@ -1252,7 +1252,7 @@
     else
         method = METHOD_NONE;
 
-    ssize_t size;
+    int64_t size;
     // expectingBody returns true for zero-sized bodies, but we will not
     // get a pipe for that body, so we treat the message as bodyless
     if (method != METHOD_NONE && msg->expectingBody(method, size) && size) {
@@ -1292,9 +1292,9 @@
         : theData(dtUnexpected)
 {}
 
-void SizedEstimate::expect(ssize_t aSize)
+void SizedEstimate::expect(int64_t aSize)
 {
-    theData = (aSize >= 0) ? aSize : (ssize_t)dtUnknown;
+    theData = (aSize >= 0) ? aSize : (int64_t)dtUnknown;
 }
 
 bool SizedEstimate::expected() const
@@ -1308,10 +1308,10 @@
     return theData != dtUnknown;
 }
 
-size_t SizedEstimate::size() const
+uint64_t SizedEstimate::size() const
 {
     Must(knownSize());
-    return static_cast<size_t>(theData);
+    return static_cast<uint64_t>(theData);
 }
 
 
@@ -1334,13 +1334,13 @@
 {
     Must(active());
     Must(size >= 0);
-    theStart += static_cast<ssize_t>(size);
+    theStart += static_cast<int64_t>(size);
 }
 
-size_t VirginBodyAct::offset() const
+uint64_t VirginBodyAct::offset() const
 {
     Must(active());
-    return static_cast<size_t>(theStart);
+    return static_cast<uint64_t>(theStart);
 }
 
 
Index: src/ICAP/ICAPModXact.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/ICAP/ICAPModXact.h,v
retrieving revision 1.6
diff -u -r1.6 ICAPModXact.h
--- src/ICAP/ICAPModXact.h	6 Apr 2007 05:52:43 -0000	1.6
+++ src/ICAP/ICAPModXact.h	2 May 2007 18:04:22 -0000
@@ -58,17 +58,17 @@
 
 public:
     SizedEstimate(); // not expected by default
-    void expect(ssize_t aSize); // expect with any, even unknown size
+    void expect(int64_t aSize); // expect with any, even unknown size
     bool expected() const;
 
     /* other members can be accessed iff expected() */
 
     bool knownSize() const;
-    size_t size() const; // can be accessed iff knownSize()
+    uint64_t size() const; // can be accessed iff knownSize()
 
 private:
     enum { dtUnexpected = -2, dtUnknown = -1 };
-    ssize_t theData; // combines expectation and size info to save RAM
+    int64_t theData; // combines expectation and size info to save RAM
 };
 
 // Virgin body may be used for two activities: (a) writing preview or prime 
@@ -88,11 +88,11 @@
 
     // methods below require active()
 
-    size_t offset() const; // the absolute beginning of not-yet-acted-on data
+    uint64_t offset() const; // the absolute beginning of not-yet-acted-on data
     void progress(size_t size); // note processed body bytes
 
 private:
-    ssize_t theStart; // offset, unless negative.
+    int64_t theStart; // offset, unless negative.
 };
 
 
@@ -244,7 +244,7 @@
     SizedEstimate virginBody;
     VirginBodyAct virginBodyWriting; // virgin body writing state
     VirginBodyAct virginBodySending;  // virgin body sending state
-    size_t virginConsumed;        // virgin data consumed so far
+    uint64_t virginConsumed;        // virgin data consumed so far
     ICAPPreview preview; // use for creating (writing) the preview
 
     ChunkedCodingParser *bodyParser; // ICAP response body parser
Index: src/tests/stub_HttpReply.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/tests/stub_HttpReply.cc,v
retrieving revision 1.3.10.2
diff -u -r1.3.10.2 stub_HttpReply.cc
--- src/tests/stub_HttpReply.cc	19 Apr 2007 04:46:38 -0000	1.3.10.2
+++ src/tests/stub_HttpReply.cc	2 May 2007 18:04:22 -0000
@@ -90,7 +90,7 @@
 }
 
 bool
-HttpReply::expectingBody(method_t, ssize_t&) const
+HttpReply::expectingBody(method_t, int64_t&) const
 {
     fatal ("Not implemented");
     return false;
Index: src/tests/stub_HttpRequest.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/tests/stub_HttpRequest.cc,v
retrieving revision 1.3
diff -u -r1.3 stub_HttpRequest.cc
--- src/tests/stub_HttpRequest.cc	18 Apr 2006 13:50:53 -0000	1.3
+++ src/tests/stub_HttpRequest.cc	2 May 2007 18:04:22 -0000
@@ -75,7 +75,7 @@
 }
 
 bool
-HttpRequest::expectingBody(method_t unused, ssize_t&) const
+HttpRequest::expectingBody(method_t unused, int64_t&) const
 {
     fatal("Not implemented");
     return false;

Reply via email to