Changeset 1093
- Timestamp:
- 05/16/09 08:59:54 (3 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
libtorrent/src/torrent/object_stream.cc (modified) (4 diffs)
-
rtorrent/src/rpc/xmlrpc.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtorrent/src/torrent/object_stream.cc
r1088 r1093 108 108 break; 109 109 110 Object::string_type last;110 // Object::string_type last; 111 111 112 112 while (input->good()) { … … 121 121 break; 122 122 123 if (last >= str)124 break;123 // if (last >= str) 124 // break; 125 125 126 126 object_read_bencode(input, &object->as_map()[str], depth); 127 127 128 str.swap(last);128 // str.swap(last); 129 129 } 130 130 … … 203 203 output->buffer = output->writeFunc(output->data, output->buffer); 204 204 output->pos = output->buffer.first; 205 206 // if (output->buffer.first == output->buffer.second) 207 // return; 205 208 } 206 209 … … 298 301 object_write_bencode_c_object(&output, object); 299 302 303 // if (output->buffer.first == output->buffer.second) 304 // throw 305 300 306 // Don't flush the buffer. 301 307 if (output.pos == output.buffer.first) -
trunk/rtorrent/src/rpc/xmlrpc.cc
r1092 r1093 372 372 373 373 case torrent::Object::TYPE_STRING: 374 return xmlrpc_string_new(env, object.as_string().c_str()); 374 { 375 #ifdef XMLRPC_HAVE_I8 376 // The versions that support I8 do implicit utf-8 validation. 377 xmlrpc_value* result = xmlrpc_string_new(env, object.as_string().c_str()); 378 #else 379 // In older versions, xmlrpc-c doesn't validate the utf-8 encoding itself. 380 xmlrpc_validate_utf8(env, object.as_string().c_str(), object.as_string().length()); 381 382 xmlrpc_value* result = env->fault_occurred ? NULL : xmlrpc_string_new(env, object.as_string().c_str()); 383 #endif 384 385 if (env->fault_occurred) { 386 xmlrpc_env_clean(env); 387 xmlrpc_env_init(env); 388 389 const std::string& str = object.as_string(); 390 char buffer[str.size() + 1]; 391 char* dst = buffer; 392 for (std::string::const_iterator itr = str.begin(); itr != str.end(); ++itr) 393 *dst++ = ((*itr < 0x20 && *itr != '\r' && *itr != '\n' && *itr != '\t') || (*itr & 0x80)) ? '?' : *itr; 394 *dst = 0; 395 396 result = xmlrpc_string_new(env, buffer); 397 } 398 399 return result; 400 } 375 401 376 402 case torrent::Object::TYPE_LIST:
