MCPcopy Create free account
hub / github.com/git/git / decode_q_segment

Function decode_q_segment

mailinfo.c:387–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387static int decode_q_segment(struct strbuf *out, const struct strbuf *q_seg,
388 int rfc2047)
389{
390 const char *in = q_seg->buf;
391 int c;
392 strbuf_grow(out, q_seg->len);
393
394 while ((c = *in++) != 0) {
395 if (c == '=') {
396 int ch, d = *in;
397 if (d == '\n' || !d)
398 break; /* drop trailing newline */
399 ch = hex2chr(in);
400 if (ch >= 0) {
401 strbuf_addch(out, ch);
402 in += 2;
403 continue;
404 }
405 /* garbage -- fall through */
406 }
407 if (rfc2047 && c == '_') /* rfc2047 4.2 (2) */
408 c = 0x20;
409 strbuf_addch(out, c);
410 }
411 return 0;
412}
413
414static int decode_b_segment(struct strbuf *out, const struct strbuf *b_seg)
415{

Callers 2

decode_headerFunction · 0.70
decode_transfer_encodingFunction · 0.70

Calls 3

strbuf_growFunction · 0.85
hex2chrFunction · 0.85
strbuf_addchFunction · 0.85

Tested by

no test coverage detected