MCPcopy Create free account
hub / github.com/apache/httpd / mprint

Function mprint

modules/metadata/mod_mime_magic.c:1691–1739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1689}
1690
1691static void mprint(request_rec *r, union VALUETYPE *p, struct magic *m)
1692{
1693 char *pp;
1694 unsigned long v;
1695 char time_str[APR_CTIME_LEN];
1696
1697 switch (m->type) {
1698 case BYTE:
1699 v = p->b;
1700 break;
1701
1702 case SHORT:
1703 case BESHORT:
1704 case LESHORT:
1705 v = p->h;
1706 break;
1707
1708 case LONG:
1709 case BELONG:
1710 case LELONG:
1711 v = p->l;
1712 break;
1713
1714 case STRING:
1715 if (m->reln == '=') {
1716 (void) magic_rsl_printf(r, m->desc, m->value.s);
1717 }
1718 else {
1719 (void) magic_rsl_printf(r, m->desc, p->s);
1720 }
1721 return;
1722
1723 case DATE:
1724 case BEDATE:
1725 case LEDATE:
1726 apr_ctime(time_str, apr_time_from_sec(*(time_t *)&p->l));
1727 pp = time_str;
1728 (void) magic_rsl_printf(r, m->desc, pp);
1729 return;
1730 default:
1731 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01537)
1732 MODNAME ": invalid m->type (%d) in mprint().",
1733 m->type);
1734 return;
1735 }
1736
1737 v = signextend(r->server, m, v) & m->mask;
1738 (void) magic_rsl_printf(r, m->desc, (unsigned long) v);
1739}
1740
1741/*
1742 * Convert the byte order of the data we are looking at

Callers 1

matchFunction · 0.85

Calls 2

magic_rsl_printfFunction · 0.85
signextendFunction · 0.85

Tested by

no test coverage detected