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

Function mconvert

modules/metadata/mod_mime_magic.c:1744–1781  ·  view source on GitHub ↗

* Convert the byte order of the data we are looking at */

Source from the content-addressed store, hash-verified

1742 * Convert the byte order of the data we are looking at
1743 */
1744static int mconvert(request_rec *r, union VALUETYPE *p, struct magic *m)
1745{
1746 char *rt;
1747
1748 switch (m->type) {
1749 case BYTE:
1750 case SHORT:
1751 case LONG:
1752 case DATE:
1753 return 1;
1754 case STRING:
1755 /* Null terminate and eat the return */
1756 p->s[sizeof(p->s) - 1] = '\0';
1757 if ((rt = strchr(p->s, '\n')) != NULL)
1758 *rt = '\0';
1759 return 1;
1760 case BESHORT:
1761 p->h = (short) ((p->hs[0] << 8) | (p->hs[1]));
1762 return 1;
1763 case BELONG:
1764 case BEDATE:
1765 p->l = (long)
1766 ((p->hl[0] << 24) | (p->hl[1] << 16) | (p->hl[2] << 8) | (p->hl[3]));
1767 return 1;
1768 case LESHORT:
1769 p->h = (short) ((p->hs[1] << 8) | (p->hs[0]));
1770 return 1;
1771 case LELONG:
1772 case LEDATE:
1773 p->l = (long)
1774 ((p->hl[3] << 24) | (p->hl[2] << 16) | (p->hl[1] << 8) | (p->hl[0]));
1775 return 1;
1776 default:
1777 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01538)
1778 MODNAME ": invalid type %d in mconvert().", m->type);
1779 return 0;
1780 }
1781}
1782
1783
1784static int mget(request_rec *r, union VALUETYPE *p, unsigned char *s,

Callers 1

mgetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected