本文整理汇总了C++中dom_string_unref函数的典型用法代码示例。如果您正苦于以下问题:C++ dom_string_unref函数的具体用法?C++ dom_string_unref怎么用?C++ dom_string_unref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dom_string_unref函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: svgtiny_parse_paint_attributes
void svgtiny_parse_paint_attributes(dom_element *node,
struct svgtiny_parse_state *state)
{
dom_string *attr;
dom_exception exc;
exc = dom_element_get_attribute(node, state->interned_fill, &attr);
if (exc == DOM_NO_ERR && attr != NULL) {
svgtiny_parse_color(attr, &state->fill, state);
dom_string_unref(attr);
}
exc = dom_element_get_attribute(node, state->interned_stroke, &attr);
if (exc == DOM_NO_ERR && attr != NULL) {
svgtiny_parse_color(attr, &state->stroke, state);
dom_string_unref(attr);
}
exc = dom_element_get_attribute(node, state->interned_stroke_width, &attr);
if (exc == DOM_NO_ERR && attr != NULL) {
state->stroke_width = svgtiny_parse_length(attr,
state->viewport_width, *state);
dom_string_unref(attr);
}
exc = dom_element_get_attribute(node, state->interned_style, &attr);
if (exc == DOM_NO_ERR && attr != NULL) {
char *style = strndup(dom_string_data(attr),
dom_string_byte_length(attr));
const char *s;
char *value;
if ((s = strstr(style, "fill:"))) {
s += 5;
while (*s == ' ')
s++;
value = strndup(s, strcspn(s, "; "));
_svgtiny_parse_color(value, &state->fill, state);
free(value);
}
if ((s = strstr(style, "stroke:"))) {
s += 7;
while (*s == ' ')
s++;
value = strndup(s, strcspn(s, "; "));
_svgtiny_parse_color(value, &state->stroke, state);
free(value);
}
if ((s = strstr(style, "stroke-width:"))) {
s += 13;
while (*s == ' ')
s++;
value = strndup(s, strcspn(s, "; "));
state->stroke_width = _svgtiny_parse_length(value,
state->viewport_width, *state);
free(value);
}
free(style);
dom_string_unref(attr);
}
}
开发者ID:dunkelstern,项目名称:libsvgtiny,代码行数:60,代码来源:svgtiny.c
示例2: _dom_document_finalise
/* Finalise the document */
bool _dom_document_finalise(dom_document *doc)
{
/* Finalise base class, delete the tree in force */
_dom_node_finalise(&doc->base);
/* Now, the first_child and last_child should be null */
doc->base.first_child = NULL;
doc->base.last_child = NULL;
/* Ensure list of nodes pending deletion is empty. If not,
* then we can't yet destroy the document (its destruction will
* have to wait until the pending nodes are destroyed) */
if (doc->pending_nodes.next != &doc->pending_nodes)
return false;
/* Ok, the document tree is empty, as is the list of nodes pending
* deletion. Therefore, it is safe to destroy the document. */
/* This is paranoia -- if there are any remaining nodelists,
* then the document's reference count will be
* non-zero as these data structures reference the document because
* they are held by the client. */
doc->nodelists = NULL;
if (doc->id_name != NULL)
dom_string_unref(doc->id_name);
dom_string_unref(doc->class_string);
_dom_document_event_internal_finalise(doc, &doc->dei);
return true;
}
开发者ID:pcwalton,项目名称:NetSurf,代码行数:34,代码来源:document.c
示例3: create_comment
/*--------------------- The callbacks definitions --------------------*/
static hubbub_error create_comment(void *parser, const hubbub_string *data,
void **result)
{
dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser;
dom_exception err;
dom_string *str;
struct dom_comment *comment;
*result = NULL;
err = dom_string_create(data->ptr, data->len, &str);
if (err != DOM_NO_ERR) {
dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx,
"Can't create comment node text");
return HUBBUB_UNKNOWN;
}
err = dom_document_create_comment(dom_parser->doc, str, &comment);
if (err != DOM_NO_ERR) {
dom_string_unref(str);
dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx,
"Can't create comment node with text '%.*s'",
data->len, data->ptr);
return HUBBUB_UNKNOWN;
}
*result = comment;
dom_string_unref(str);
return HUBBUB_OK;
}
开发者ID:ChokshiUtsav,项目名称:kolibriosSVN,代码行数:33,代码来源:parser.c
示例4: node_is_visited
/**
* Callback to determine if a node is a linking element whose target has been
* visited.
*
* \param pw HTML document
* \param node DOM node
* \param match Pointer to location to receive result
* \return CSS_OK.
*
* \post \a match will contain true if the node matches and false otherwise.
*/
css_error node_is_visited(void *pw, void *node, bool *match)
{
nscss_select_ctx *ctx = pw;
nsurl *url;
nserror error;
const struct url_data *data;
dom_exception exc;
dom_node *n = node;
dom_string *s = NULL;
*match = false;
exc = dom_node_get_node_name(n, &s);
if ((exc != DOM_NO_ERR) || (s == NULL)) {
return CSS_NOMEM;
}
if (!dom_string_caseless_lwc_isequal(s, corestring_lwc_a)) {
/* Can't be visited; not ancher element */
dom_string_unref(s);
return CSS_OK;
}
/* Finished with node name string */
dom_string_unref(s);
s = NULL;
exc = dom_element_get_attribute(n, corestring_dom_href, &s);
if ((exc != DOM_NO_ERR) || (s == NULL)) {
/* Can't be visited; not got a URL */
return CSS_OK;
}
/* Make href absolute */
/* TODO: this duplicates what we do for box->href
* should we put the absolute URL on the dom node? */
error = nsurl_join(ctx->base_url, dom_string_data(s), &url);
/* Finished with href string */
dom_string_unref(s);
if (error != NSERROR_OK) {
/* Couldn't make nsurl object */
return CSS_NOMEM;
}
data = urldb_get_url_data(url);
/* Visited if in the db and has
* non-zero visit count */
if (data != NULL && data->visits > 0)
*match = true;
nsurl_unref(url);
return CSS_OK;
}
开发者ID:kyllikki,项目名称:netsurf,代码行数:69,代码来源:select.c
示例5: add_attributes
static hubbub_error add_attributes(void *parser, void *node,
const hubbub_attribute *attributes, uint32_t n_attributes)
{
dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser;
dom_exception err;
uint32_t i;
for (i = 0; i < n_attributes; i++) {
dom_string *name, *value;
err = dom_string_create_interned(attributes[i].name.ptr,
attributes[i].name.len, &name);
if (err != DOM_NO_ERR) {
dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx,
"Can't create attribute name");
goto fail;
}
err = dom_string_create(attributes[i].value.ptr,
attributes[i].value.len, &value);
if (err != DOM_NO_ERR) {
dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx,
"Can't create attribute value");
dom_string_unref(name);
goto fail;
}
if (attributes[i].ns == HUBBUB_NS_NULL) {
err = dom_element_set_attribute(
(struct dom_element *) node, name,
value);
dom_string_unref(name);
dom_string_unref(value);
if (err != DOM_NO_ERR) {
dom_parser->msg(DOM_MSG_CRITICAL,
dom_parser->mctx,
"Can't add attribute");
}
} else {
err = dom_element_set_attribute_ns(
(struct dom_element *) node,
dom_namespaces[attributes[i].ns], name,
value);
dom_string_unref(name);
dom_string_unref(value);
if (err != DOM_NO_ERR) {
dom_parser->msg(DOM_MSG_CRITICAL,
dom_parser->mctx,
"Can't add attribute ns");
}
}
}
return HUBBUB_OK;
fail:
return HUBBUB_UNKNOWN;
}
开发者ID:ChokshiUtsav,项目名称:kolibriosSVN,代码行数:58,代码来源:parser.c
示例6: node_has_attribute_substring
/**
* Callback to determine if a node has an attribute with the given name whose
* value contains the substring given.
*
* \param pw HTML document
* \param node DOM node
* \param qname Name to match
* \param value Value to match
* \param match Pointer to location to receive result
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion.
*
* \post \a match will contain true if the node matches and false otherwise.
*/
css_error node_has_attribute_substring(void *pw, void *node,
const css_qname *qname, lwc_string *value,
bool *match)
{
dom_node *n = node;
dom_string *name;
dom_string *atr_val;
dom_exception err;
size_t vlen = lwc_string_length(value);
if (vlen == 0) {
*match = false;
return CSS_OK;
}
err = dom_string_create_interned(
(const uint8_t *) lwc_string_data(qname->name),
lwc_string_length(qname->name), &name);
if (err != DOM_NO_ERR)
return CSS_NOMEM;
err = dom_element_get_attribute(n, name, &atr_val);
if ((err != DOM_NO_ERR) || (atr_val == NULL)) {
dom_string_unref(name);
*match = false;
return CSS_OK;
}
dom_string_unref(name);
/* check for exact match */
*match = dom_string_caseless_lwc_isequal(atr_val, value);
/* check for prefix match */
if (*match == false) {
const char *vdata = lwc_string_data(value);
const char *start = (const char *) dom_string_data(atr_val);
size_t len = dom_string_byte_length(atr_val);
const char *last_start = start + len - vlen;
if (len >= vlen) {
while (start <= last_start) {
if (strncasecmp(start, vdata,
vlen) == 0) {
*match = true;
break;
}
start++;
}
}
}
dom_string_unref(atr_val);
return CSS_OK;
}
开发者ID:kyllikki,项目名称:netsurf,代码行数:72,代码来源:select.c
示例7: node_has_attribute_includes
/**
* Callback to determine if a node has an attribute with the given name whose
* value includes that given.
*
* \param pw HTML document
* \param node DOM node
* \param qname Name to match
* \param value Value to match
* \param match Pointer to location to receive result
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion.
*
* \post \a match will contain true if the node matches and false otherwise.
*/
css_error node_has_attribute_includes(void *pw, void *node,
const css_qname *qname, lwc_string *value,
bool *match)
{
dom_node *n = node;
dom_string *name;
dom_string *atr_val;
dom_exception err;
size_t vlen = lwc_string_length(value);
const char *p;
const char *start;
const char *end;
*match = false;
if (vlen == 0) {
return CSS_OK;
}
err = dom_string_create_interned(
(const uint8_t *) lwc_string_data(qname->name),
lwc_string_length(qname->name), &name);
if (err != DOM_NO_ERR)
return CSS_NOMEM;
err = dom_element_get_attribute(n, name, &atr_val);
if ((err != DOM_NO_ERR) || (atr_val == NULL)) {
dom_string_unref(name);
*match = false;
return CSS_OK;
}
dom_string_unref(name);
/* check for match */
start = (const char *) dom_string_data(atr_val);
end = start + dom_string_byte_length(atr_val);
for (p = start; p <= end; p++) {
if (*p == ' ' || *p == '\0') {
if ((size_t) (p - start) == vlen &&
strncasecmp(start,
lwc_string_data(value),
vlen) == 0) {
*match = true;
break;
}
start = p + 1;
}
}
dom_string_unref(atr_val);
return CSS_OK;
}
开发者ID:kyllikki,项目名称:netsurf,代码行数:70,代码来源:select.c
示例8: dom_html_collection_named_item
/**
* Get the node in the collection according name
*
* \param col The collection
* \param name The name of target node
* \param node The returned node object
* \return DOM_NO_ERR on success.
*/
dom_exception dom_html_collection_named_item(dom_html_collection *col,
dom_string *name, struct dom_node **node)
{
struct dom_node_internal *n = col->root;
dom_exception err;
while (n != NULL) {
if (n->type == DOM_ELEMENT_NODE &&
col->ic(n, col->ctx) == true) {
dom_string *id = NULL;
err = _dom_element_get_id((struct dom_element *) n,
&id);
if (err != DOM_NO_ERR) {
return err;
}
if (id != NULL && dom_string_isequal(name, id)) {
*node = (struct dom_node *) n;
dom_node_ref(n);
dom_string_unref(id);
return DOM_NO_ERR;
}
if (id != NULL)
dom_string_unref(id);
}
/* Depth first iterating */
if (n->first_child != NULL) {
n = n->first_child;
} else if (n->next != NULL) {
n = n->next;
} else {
/* No children and siblings */
struct dom_node_internal *parent = n->parent;
while (parent != col->root &&
n == parent->last_child) {
n = parent;
parent = parent->parent;
}
if (parent == col->root)
n = NULL;
else
n = n->next;
}
}
/* Not found the target node */
*node = NULL;
return DOM_NO_ERR;
}
开发者ID:Achal-Aggarwal,项目名称:libdom,代码行数:64,代码来源:html_collection.c
示例9: html_stylesheet_from_domnode
static nserror
html_stylesheet_from_domnode(html_content *c,
dom_node *node,
hlcache_handle **sheet)
{
hlcache_child_context child;
dom_string *style;
nsurl *url;
dom_exception exc;
nserror error;
uint32_t key;
char urlbuf[64];
child.charset = c->encoding;
child.quirks = c->base.quirks;
exc = dom_node_get_text_content(node, &style);
if ((exc != DOM_NO_ERR) || (style == NULL)) {
LOG("No text content");
return NSERROR_OK;
}
error = html_css_fetcher_add_item(style, c->base_url, &key);
if (error != NSERROR_OK) {
dom_string_unref(style);
return error;
}
dom_string_unref(style);
snprintf(urlbuf, sizeof(urlbuf), "x-ns-css:%u", key);
error = nsurl_create(urlbuf, &url);
if (error != NSERROR_OK) {
return error;
}
error = hlcache_handle_retrieve(url, 0,
content_get_url(&c->base), NULL,
html_convert_css_callback, c, &child, CONTENT_CSS,
sheet);
if (error != NSERROR_OK) {
nsurl_unref(url);
return error;
}
nsurl_unref(url);
c->base.active++;
LOG("%d fetches active", c->base.active);
return NSERROR_OK;
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:53,代码来源:html_css.c
示例10: named_generic_sibling_node
/**
* Callback to find a named generic sibling node.
*
* \param pw HTML document
* \param node DOM node
* \param qname Node name to search for
* \param sibling Pointer to location to receive ancestor
* \return CSS_OK.
*
* \post \a sibling will contain the result, or NULL if there is no match
*/
css_error named_generic_sibling_node(void *pw, void *node,
const css_qname *qname, void **sibling)
{
dom_node *n = node;
dom_node *prev;
dom_exception err;
*sibling = NULL;
err = dom_node_get_previous_sibling(n, &n);
if (err != DOM_NO_ERR)
return CSS_OK;
while (n != NULL) {
dom_node_type type;
dom_string *name;
err = dom_node_get_node_type(n, &type);
if (err != DOM_NO_ERR) {
dom_node_unref(n);
return CSS_OK;
}
if (type == DOM_ELEMENT_NODE) {
err = dom_node_get_node_name(n, &name);
if (err != DOM_NO_ERR) {
dom_node_unref(n);
return CSS_OK;
}
if (dom_string_caseless_lwc_isequal(name,
qname->name)) {
dom_string_unref(name);
dom_node_unref(n);
*sibling = n;
break;
}
dom_string_unref(name);
}
err = dom_node_get_previous_sibling(n, &prev);
if (err != DOM_NO_ERR) {
dom_node_unref(n);
return CSS_OK;
}
dom_node_unref(n);
n = prev;
}
return CSS_OK;
}
开发者ID:kyllikki,项目名称:netsurf,代码行数:63,代码来源:select.c
示例11: node_has_attribute_dashmatch
/**
* Callback to determine if a node has an attribute with the given name whose
* value dashmatches that given.
*
* \param pw HTML document
* \param node DOM node
* \param qname Name to match
* \param value Value to match
* \param match Pointer to location to receive result
* \return CSS_OK on success,
* CSS_NOMEM on memory exhaustion.
*
* \post \a match will contain true if the node matches and false otherwise.
*/
css_error node_has_attribute_dashmatch(void *pw, void *node,
const css_qname *qname, lwc_string *value,
bool *match)
{
dom_node *n = node;
dom_string *name;
dom_string *atr_val;
dom_exception err;
size_t vlen = lwc_string_length(value);
if (vlen == 0) {
*match = false;
return CSS_OK;
}
err = dom_string_create_interned(
(const uint8_t *) lwc_string_data(qname->name),
lwc_string_length(qname->name), &name);
if (err != DOM_NO_ERR)
return CSS_NOMEM;
err = dom_element_get_attribute(n, name, &atr_val);
if ((err != DOM_NO_ERR) || (atr_val == NULL)) {
dom_string_unref(name);
*match = false;
return CSS_OK;
}
dom_string_unref(name);
/* check for exact match */
*match = dom_string_caseless_lwc_isequal(atr_val, value);
/* check for dashmatch */
if (*match == false) {
const char *vdata = lwc_string_data(value);
const char *data = (const char *) dom_string_data(atr_val);
size_t len = dom_string_byte_length(atr_val);
if (len > vlen && data[vlen] == '-' &&
strncasecmp(data, vdata, vlen) == 0) {
*match = true;
}
}
dom_string_unref(atr_val);
return CSS_OK;
}
开发者ID:kyllikki,项目名称:netsurf,代码行数:64,代码来源:select.c
示例12: html_create_style_element
static struct html_stylesheet *
html_create_style_element(html_content *c, dom_node *style)
{
dom_string *val;
dom_exception exc;
struct html_stylesheet *stylesheets;
/* type='text/css', or not present (invalid but common) */
exc = dom_element_get_attribute(style, corestring_dom_type, &val);
if (exc == DOM_NO_ERR && val != NULL) {
if (!dom_string_caseless_lwc_isequal(val,
corestring_lwc_text_css)) {
dom_string_unref(val);
return NULL;
}
dom_string_unref(val);
}
/* media contains 'screen' or 'all' or not present */
exc = dom_element_get_attribute(style, corestring_dom_media, &val);
if (exc == DOM_NO_ERR && val != NULL) {
if (strcasestr(dom_string_data(val), "screen") == NULL &&
strcasestr(dom_string_data(val),
"all") == NULL) {
dom_string_unref(val);
return NULL;
}
dom_string_unref(val);
}
/* Extend array */
stylesheets = realloc(c->stylesheets,
sizeof(struct html_stylesheet) *
(c->stylesheet_count + 1));
if (stylesheets == NULL) {
content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return false;
}
c->stylesheets = stylesheets;
c->stylesheets[c->stylesheet_count].node = dom_node_ref(style);
c->stylesheets[c->stylesheet_count].sheet = NULL;
c->stylesheets[c->stylesheet_count].modified = false;
c->stylesheet_count++;
return c->stylesheets + (c->stylesheet_count - 1);
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:49,代码来源:html_css.c
示例13: node_is_link
/**
* Callback to determine if a node is a linking element.
*
* \param pw HTML document
* \param n DOM node
* \param match Pointer to location to receive result
* \return CSS_OK.
*
* \post \a match will contain true if the node matches and false otherwise.
*/
css_error node_is_link(void *pw, void *n, bool *match)
{
dom_node *node = n;
dom_exception exc;
dom_string *node_name = NULL;
exc = dom_node_get_node_name(node, &node_name);
if ((exc != DOM_NO_ERR) || (node_name == NULL)) {
return CSS_NOMEM;
}
if (dom_string_caseless_lwc_isequal(node_name, corestring_lwc_a)) {
bool has_href;
exc = dom_element_has_attribute(node, corestring_dom_href,
&has_href);
if ((exc == DOM_NO_ERR) && (has_href)) {
*match = true;
} else {
*match = false;
}
} else {
*match = false;
}
dom_string_unref(node_name);
return CSS_OK;
}
开发者ID:kyllikki,项目名称:netsurf,代码行数:37,代码来源:select.c
示例14: node_count_siblings_check
static int
node_count_siblings_check(dom_node *node,
bool check_name,
dom_string *name)
{
dom_node_type type;
int ret = 0;
dom_exception exc;
if (node == NULL)
return 0;
exc = dom_node_get_node_type(node, &type);
if ((exc != DOM_NO_ERR) || (type != DOM_ELEMENT_NODE)) {
return 0;
}
if (check_name) {
dom_string *node_name = NULL;
exc = dom_node_get_node_name(node, &node_name);
if ((exc == DOM_NO_ERR) && (node_name != NULL)) {
if (dom_string_caseless_isequal(name,
node_name)) {
ret = 1;
}
dom_string_unref(node_name);
}
} else {
ret = 1;
}
return ret;
}
开发者ID:kyllikki,项目名称:netsurf,代码行数:35,代码来源:select.c
示例15: __dom_dispatch_node_change_document_event
/**
* Dispatch a DOMNodeInsertedIntoDocument/DOMNodeRemovedFromDocument event
*
* \param doc The document object
* \param et The EventTarget object
* \param type "DOMNodeInserted" or "DOMNodeRemoved"
* \param success Whether this event's default action get called
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
dom_exception __dom_dispatch_node_change_document_event(dom_document *doc,
dom_event_target *et, dom_mutation_type change, bool *success)
{
struct dom_mutation_event *evt;
dom_string *type = NULL;
dom_exception err;
err = _dom_mutation_event_create(doc, &evt);
if (err != DOM_NO_ERR)
return err;
if (change == DOM_MUTATION_ADDITION) {
type = dom_string_ref(doc->_memo_domnodeinsertedintodocument);
} else if (change == DOM_MUTATION_REMOVAL) {
type = dom_string_ref(doc->_memo_domnoderemovedfromdocument);
} else {
assert("Should never be here" == NULL);
}
/* Initialise the event with corresponding parameters */
err = dom_mutation_event_init(evt, type, true, false, NULL,
NULL, NULL, NULL, change);
dom_string_unref(type);
if (err != DOM_NO_ERR)
goto cleanup;
err = dom_event_target_dispatch_event(et, evt, success);
if (err != DOM_NO_ERR)
goto cleanup;
cleanup:
_dom_mutation_event_destroy(evt);
return err;
}
开发者ID:Achal-Aggarwal,项目名称:libdom,代码行数:44,代码来源:dispatch.c
示例16: _dom_document_initialise
/* Initialise the document */
dom_exception _dom_document_initialise(dom_document *doc,
dom_events_default_action_fetcher daf)
{
dom_exception err;
dom_string *name;
err = dom_string_create((const uint8_t *) "#document",
SLEN("#document"), &name);
if (err != DOM_NO_ERR)
return err;
doc->nodelists = NULL;
err = _dom_node_initialise(&doc->base, doc, DOM_DOCUMENT_NODE,
name, NULL, NULL, NULL);
dom_string_unref(name);
if (err != DOM_NO_ERR)
return err;
list_init(&doc->pending_nodes);
doc->id_name = NULL;
doc->quirks = DOM_DOCUMENT_QUIRKS_MODE_NONE;
err = dom_string_create_interned((const uint8_t *) "class",
SLEN("class"), &doc->class_string);
if (err != DOM_NO_ERR)
return err;
/* We should not pass a NULL when all things hook up */
return _dom_document_event_internal_initialise(doc, &doc->dei, daf);
}
开发者ID:pcwalton,项目名称:NetSurf,代码行数:33,代码来源:document.c
示例17: dukky_html_anchor_element_target_getter
static duk_ret_t dukky_html_anchor_element_target_getter(duk_context *ctx)
{
/* Get private data for method */
html_anchor_element_private_t *priv = NULL;
duk_push_this(ctx);
duk_get_prop_string(ctx, -1, dukky_magic_string_private);
priv = duk_get_pointer(ctx, -1);
duk_pop_2(ctx);
if (priv == NULL) {
return 0; /* can do? No can do. */
}
#line 34 "HTMLAnchorElement.bnd"
dom_exception exc;
dom_string *str;
exc = dom_html_anchor_element_get_target((struct dom_html_anchor_element *)((node_private_t*)priv)->node, &str);
if (exc != DOM_NO_ERR) {
return 0;
}
if (str != NULL) {
duk_push_lstring(ctx,
dom_string_data(str),
dom_string_length(str));
dom_string_unref(str);
} else {
duk_push_lstring(ctx, NULL, 0);
}
return 1;
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:32,代码来源:html_anchor_element.c
示例18: dukky_html_anchor_element_shape_setter
static duk_ret_t dukky_html_anchor_element_shape_setter(duk_context *ctx)
{
/* Get private data for method */
html_anchor_element_private_t *priv = NULL;
duk_push_this(ctx);
duk_get_prop_string(ctx, -1, dukky_magic_string_private);
priv = duk_get_pointer(ctx, -1);
duk_pop_2(ctx);
if (priv == NULL) {
return 0; /* can do? No can do. */
}
#line 32 "HTMLAnchorElement.bnd"
dom_exception exc;
dom_string *str;
duk_size_t slen;
const char *s;
s = duk_safe_to_lstring(ctx, 0, &slen);
exc = dom_string_create((const uint8_t *)s, slen, &str);
if (exc != DOM_NO_ERR) {
return 0;
}
exc = dom_html_anchor_element_set_shape((struct dom_html_anchor_element *)((node_private_t*)priv)->node, str);
dom_string_unref(str);
if (exc != DOM_NO_ERR) {
return 0;
}
return 0;
}
开发者ID:EyMenZ,项目名称:NetSurf-OS3,代码行数:32,代码来源:html_anchor_element.c
示例19: svgtiny_cleanup_state_local
/**
* Cleanup the local externally-stored parts of a parse state.
* Call this in functions that made a new state on the stack.
* Doesn't cleanup global state, such as the interned string list.
*/
static void svgtiny_cleanup_state_local(struct svgtiny_parse_state *state)
{
if (state->gradient_x1 != NULL) {
dom_string_unref(state->gradient_x1);
state->gradient_x1 = NULL;
}
if (state->gradient_y1 != NULL) {
dom_string_unref(state->gradient_y1);
state->gradient_y1 = NULL;
}
if (state->gradient_x2 != NULL) {
dom_string_unref(state->gradient_x2);
state->gradient_x2 = NULL;
}
if (state->gradient_y2 != NULL) {
dom_string_unref(state->gradient_y2);
state->gradient_y2 = NULL;
}
}
开发者ID:dunkelstern,项目名称:libsvgtiny,代码行数:24,代码来源:svgtiny.c
示例20: save_complete_handle_attr
static bool save_complete_handle_attr(save_complete_ctx *ctx,
dom_string *node_name, dom_attr *attr)
{
dom_string *name;
const char *name_data;
size_t name_len;
dom_string *value;
dom_exception error;
error = dom_attr_get_name(attr, &name);
if (error != DOM_NO_ERR)
return false;
if (name == NULL)
return true;
error = dom_attr_get_value(attr, &value);
if (error != DOM_NO_ERR) {
dom_string_unref(name);
return false;
}
name_data = dom_string_data(name);
name_len = dom_string_byte_length(name);
fputc(' ', ctx->fp);
fwrite(name_data, sizeof(*name_data), name_len, ctx->fp);
if (value != NULL) {
fputc('=', ctx->fp);
if (save_complete_handle_attr_value(ctx, node_name,
name, value) == false) {
dom_string_unref(value);
dom_string_unref(name);
return false;
}
}
dom_string_unref(name);
return true;
}
开发者ID:ChokshiUtsav,项目名称:kolibriosSVN,代码行数:42,代码来源:save_complete.c
注:本文中的dom_string_unref函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论