Changeset 1451
- Timestamp:
- May 19, 2009 8:37:02 AM (12 years ago)
- Location:
- trunk/src/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/RpEncode.cc
r1415 r1451 103 103 } 104 104 105 bool 106 Rappture::encoding::isGzipped(const char* buf, int size) 107 { 108 if (buf == NULL) { 109 return false; /* Really should let this segfault. */ 110 } 111 return ((buf[0] == 0x1f) && (buf[1] == 0x8b)); 112 } 113 105 114 /**********************************************************************/ 106 115 // FUNCTION: Rappture::encoding::headerFlags() … … 261 270 size -= 14; 262 271 headerFlags |= (RPENC_B64 | RPENC_Z); 272 } else if ((size > 13) && (strncmp(bytes, "@@RP-ENC:raw\n", 14) == 0)){ 273 bytes += 13; 274 size -= 13; 263 275 } 264 276 if (headerFlags != 0) { … … 281 293 } 282 294 } 283 if ((flags & (RPENC_B64 | RPENC_Z)) == 0) {284 return true; /* No decode or decompress flags present. */285 }286 295 if (outData.append(bytes, size) != (int)size) { 287 296 status.addError("can't append %d bytes to buffer", size); 288 297 return false; 289 298 } 290 if (!outData.decode(status, flags)) { 291 return false; 299 if (flags & (RPENC_B64 | RPENC_Z)) { 300 if (!outData.decode(status, flags)) { 301 return false; 302 } 292 303 } 293 304 buf.move(outData); -
trunk/src/core/RpEncode.h
r1384 r1451 34 34 bool isBinary(const char* buf, int size); 35 35 bool isBase64(const char* buf, int size); 36 bool isGzipped(const char* buf, int size); 36 37 unsigned int headerFlags(const char* buf, int size); 37 38 bool encode(Rappture::Outcome &err, Rappture::Buffer& buf, unsigned int flags);
Note: See TracChangeset
for help on using the changeset viewer.