Changeset 34 in cheroxy for trunk/src/CRXProxy.cpp
- Timestamp:
- 11/20/12 16:31:22 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/CRXProxy.cpp
r28 r34 141 141 const int aBufferSize) const 142 142 { 143 void * aPtr = static_cast<void *> (aBuffer); 143 void * aPtr = static_cast<void *> (aBuffer); 144 145 int aCopyLength = 0; 146 int aRemainLength = aBufferSize; 147 const int aHeaderLength = mHttpRequest.GetHeader ().length (); 144 148 145 149 /*----------------------------------------------------------------*/ … … 147 151 return NULL; 148 152 149 if (aBufferSize > 0) 150 memcpy (aPtr, mHttpRequest.GetHeader ().c_str (), aBufferSize); 153 aCopyLength = aRemainLength < aHeaderLength ? aBufferSize : aHeaderLength; 154 if (aCopyLength > 0) 155 memcpy (aPtr, mHttpRequest.GetHeader ().c_str (), aCopyLength); 151 156 /*----------------------------------------------------------------*/ 152 157 … … 175 180 const int aBufferSize) const 176 181 { 177 void * aPtr = static_cast<void *> (aBuffer); 178 179 int aRemainLength = aBufferSize; 182 void * aPtr = static_cast<void *> (aBuffer); 183 184 int aCopyLength = 0; 185 int aRemainLength = aBufferSize; 186 const int aHeaderLength = mHttpResponse.GetHeader ().length (); 187 const int aContentLength = mHttpResponse.GetContentLength (); 180 188 181 189 /*----------------------------------------------------------------*/ … … 183 191 return NULL; 184 192 185 if (aRemainLength > 0) 186 memcpy (aPtr, mHttpResponse.GetHeader ().c_str (), aRemainLength); 187 188 aRemainLength -= mHttpResponse.GetHeader ().length (); 189 190 if (aRemainLength > 0) 191 memcpy (aPtr, mHttpResponse.GetContentBody (), aRemainLength); 193 aCopyLength = aRemainLength < aHeaderLength ? aBufferSize : aHeaderLength; 194 if (aCopyLength > 0) 195 memcpy (aPtr, mHttpResponse.GetHeader ().c_str (), aCopyLength); 196 197 aRemainLength -= aCopyLength; 198 199 aCopyLength = aRemainLength < aContentLength ? aRemainLength : aContentLength; 200 if (aCopyLength > 0) 201 memcpy (aPtr, mHttpResponse.GetContentBody (), aCopyLength); 192 202 /*----------------------------------------------------------------*/ 193 203
Note:
See TracChangeset
for help on using the changeset viewer.