From: Alex Rousskov Date: Sun, 29 Aug 2010 21:50:09 +0000 (-0600) Subject: Made eCAP compile again after CbcPointer<> changes. X-Git-Tag: take1~319 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=419adc9d1ddc75272df418ba69e437f459634b02;p=thirdparty%2Fsquid.git Made eCAP compile again after CbcPointer<> changes. Old eCAP code tried to call stillProducing(this) and stillConsuming(this) methods from a const status() method. Doing so produces compiler errors because stillProducing() and stillConsuming() do not accept pointers to constant jobs. CBDATA_CLASSes and, hence, CbcPointer<>, do not support const-correctness well: In order to create/destroy a cbdata-based smart pointer, one has to lock/unlock cbdata, which requires modifying the object. Thus, the smart pointer cannot point to a truly constant object. The core of the problem is that CBDATA_CLASSes keep cbdata and object data together. When all raw/dumb CBDATA_CLASS pointers are gone, we can separate the two "datas" and solve the const-correctness problem for good. The "separate-datas" design would even be consistent with the original cbdata design which we often violate, IMO. There are other workarounds. We could declare toCbdata() constant, for example. However, that would essentially disable checks where a cbdata-protected object is being destroyed despite the caller's intent to keep the object constant. This change is not as general but is also much less intrusive. --- diff --git a/src/adaptation/ecap/XactionRep.cc b/src/adaptation/ecap/XactionRep.cc index 462dc160ed..8a02517336 100644 --- a/src/adaptation/ecap/XactionRep.cc +++ b/src/adaptation/ecap/XactionRep.cc @@ -430,9 +430,8 @@ Adaptation::Ecap::XactionRep::status() const const BodyPipePointer &vp = theVirginRep.raw().body_pipe; if (!canAccessVb) buf.append("x", 1); - if (vp != NULL && vp->stillConsuming(this)) { + if (vp != NULL) { // XXX: but may not be stillConsuming() buf.append("Vb", 2); - buf.append(vp->status(), strlen(vp->status())); // XXX } else buf.append("V.", 2); } @@ -441,9 +440,8 @@ Adaptation::Ecap::XactionRep::status() const MessageRep *rep = dynamic_cast(theAnswerRep.get()); Must(rep); const BodyPipePointer &ap = rep->raw().body_pipe; - if (ap != NULL && ap->stillProducing(this)) { + if (ap != NULL) { // XXX: but may not be stillProducing() buf.append(" Ab", 3); - buf.append(ap->status(), strlen(ap->status())); // XXX } else buf.append(" A.", 3); }