MCPcopy Create free account
hub / github.com/acl-dev/acl / decode_finish

Method decode_finish

lib_acl_cpp/src/mime/rfc2047.cpp:388–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386}
387
388bool rfc2047::decode_finish(const char* toCharset,
389 string* out, bool addInvalid /* = true */)
390{
391 std::list<rfc2047_entry*>::const_iterator cit = m_List.begin();
392 string buf1;
393 string buf2;
394 mime_base64 base64;
395 mime_quoted_printable qp;
396
397 // ѡ��һ��Ĭ�ϵĽ�������Ȼ�������Ҫ�仯
398 mime_code* pDecoder = &base64;
399 const char *fromCharset = NULL;
400 charset_conv conv;
401 conv.set_add_invalid(addInvalid);
402
403 for (; cit != m_List.end(); ++cit) {
404 if ((*cit)->coding == 'Q') {
405 if (pDecoder != &qp || !EQ((*cit)->pCharset->c_str(), fromCharset)) {
406 if (fromCharset == NULL) {
407 fromCharset = (*cit)->pCharset->c_str();
408 }
409 if (*fromCharset == 0) {
410 fromCharset = NULL;
411 }
412 if (fromCharset == NULL || toCharset == NULL) {
413 decoder_finish(pDecoder, NULL, out,
414 &buf1, &buf2);
415 } else {
416 conv.update_begin(fromCharset, toCharset);
417 decoder_finish(pDecoder, &conv, out,
418 &buf1, &buf2);
419 }
420 pDecoder->reset();
421 }
422 pDecoder = &qp; // qp ����
423 fromCharset = (*cit)->pCharset->c_str();
424 if (*fromCharset == 0) {
425 fromCharset = NULL;
426 }
427 decoder_update(*cit, fromCharset, toCharset,
428 pDecoder, &conv, out, &buf1, &buf2);
429 } else if ((*cit)->coding == 'B') {
430 if (pDecoder != &base64 || !EQ((*cit)->pCharset->c_str(), fromCharset)) {
431 if (fromCharset == NULL) {
432 fromCharset = (*cit)->pCharset->c_str();
433 }
434 if (*fromCharset == 0) {
435 fromCharset = NULL;
436 }
437 if (fromCharset == NULL && toCharset == NULL) {
438 decoder_finish(pDecoder, NULL, out,
439 &buf1, &buf2);
440 } else {
441 conv.update_begin(fromCharset, toCharset);
442 decoder_finish(pDecoder, &conv, out,
443 &buf1, &buf2);
444 }
445 pDecoder->reset();

Callers 15

rfc2047_testFunction · 0.45
rfc2047_test2Function · 0.45
rfc2047_test_fileFunction · 0.45
mainFunction · 0.45
decodingFunction · 0.45
mainFunction · 0.45
mime_testFunction · 0.45
test1Function · 0.45
mainFunction · 0.45
mime_test1Function · 0.45
decodeMethod · 0.45
mime_attachMethod · 0.45

Calls 10

decoder_finishFunction · 0.85
decoder_updateFunction · 0.85
beginMethod · 0.80
set_add_invalidMethod · 0.80
endMethod · 0.45
c_strMethod · 0.45
update_beginMethod · 0.45
resetMethod · 0.45
appendMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected