MCPcopy Create free account
hub / github.com/dillo-browser/dillo / parseUrl

Method parseUrl

src/cssparser.cc:1588–1629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1586}
1587
1588char * CssParser::parseUrl()
1589{
1590 Dstr *urlStr = NULL;
1591
1592 if (ttype != CSS_TK_SYMBOL ||
1593 dStrAsciiCasecmp(tval, "url") != 0)
1594 return NULL;
1595
1596 nextToken();
1597
1598 if (ttype != CSS_TK_CHAR || tval[0] != '(')
1599 return NULL;
1600
1601 nextToken();
1602
1603 if (ttype == CSS_TK_STRING) {
1604 urlStr = dStr_new(tval);
1605 nextToken();
1606 } else {
1607 urlStr = dStr_new("");
1608 while (ttype != CSS_TK_END &&
1609 (ttype != CSS_TK_CHAR || tval[0] != ')')) {
1610 dStr_append(urlStr, tval);
1611 nextToken();
1612 }
1613 }
1614
1615 if (ttype != CSS_TK_CHAR || tval[0] != ')') {
1616 dStr_free(urlStr, 1);
1617 urlStr = NULL;
1618 }
1619
1620 if (urlStr) {
1621 DilloUrl *dilloUrl = a_Url_new(urlStr->str, a_Url_str(this->baseUrl));
1622 char *url = dStrdup(a_Url_str(dilloUrl));
1623 a_Url_free(dilloUrl);
1624 dStr_free(urlStr, 1);
1625 return url;
1626 } else {
1627 return NULL;
1628 }
1629}
1630
1631void CssParser::parseImport(DilloHtml *html)
1632{

Callers

nothing calls this directly

Calls 8

dStrAsciiCasecmpFunction · 0.85
dStr_newFunction · 0.85
dStr_appendFunction · 0.85
dStr_freeFunction · 0.85
a_Url_newFunction · 0.85
a_Url_strFunction · 0.85
dStrdupFunction · 0.85
a_Url_freeFunction · 0.85

Tested by

no test coverage detected