Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 109395 Details for
Bug 162711
[QA] dev-libs/libxslt-1.1.20 has poor programming practices (break strict-aliasing rules)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to clear 'type-punned pointer' warnings
gentoo_libxslt.pat (text/plain), 3.18 KB, created by
William Brack
on 2007-02-07 01:51:52 UTC
(
hide
)
Description:
patch to clear 'type-punned pointer' warnings
Filename:
MIME Type:
Creator:
William Brack
Created:
2007-02-07 01:51:52 UTC
Size:
3.18 KB
patch
obsolete
>Index: libxslt/pattern.c >=================================================================== >--- libxslt/pattern.c (revision 1418) >+++ libxslt/pattern.c (working copy) >@@ -142,7 +142,7 @@ > cur = (xsltCompMatchPtr) xmlMalloc(sizeof(xsltCompMatch)); > if (cur == NULL) { > xsltTransformError(NULL, NULL, NULL, >- "xsltNewCompMatch : malloc failed\n"); >+ "xsltNewCompMatch : out of memory error\n"); > return(NULL); > } > memset(cur, 0, sizeof(xsltCompMatch)); >@@ -2066,7 +2066,12 @@ > int > xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, > const xmlChar *mode, const xmlChar *modeURI) { >- xsltCompMatchPtr pat, list, *top = NULL, next; >+ xsltCompMatchPtr pat, list, next; >+ /* >+ * 'top' will point to style->xxxMatch ptr - declaring as 'void' >+ * avoids gcc 'type-punned pointer' warning. >+ */ >+ void **top = NULL; > const xmlChar *name = NULL; > float priority; /* the priority */ > >@@ -2076,6 +2081,8 @@ > priority = cur->priority; > pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem, > style, NULL, 1); >+ if (pat == NULL) >+ return(-1); > while (pat) { > next = pat->next; > pat->next = NULL; >@@ -2097,24 +2104,24 @@ > if (pat->steps[0].value != NULL) > name = pat->steps[0].value; > else >- top = (xsltCompMatchPtr *) &(style->attrMatch); >+ top = &(style->attrMatch); > break; > case XSLT_OP_CHILD: > case XSLT_OP_PARENT: > case XSLT_OP_ANCESTOR: >- top = (xsltCompMatchPtr *) &(style->elemMatch); >+ top = &(style->elemMatch); > break; > case XSLT_OP_ROOT: >- top = (xsltCompMatchPtr *) &(style->rootMatch); >+ top = &(style->rootMatch); > break; > case XSLT_OP_KEY: >- top = (xsltCompMatchPtr *) &(style->keyMatch); >+ top = &(style->keyMatch); > break; > case XSLT_OP_ID: > /* TODO optimize ID !!! */ > case XSLT_OP_NS: > case XSLT_OP_ALL: >- top = (xsltCompMatchPtr *) &(style->elemMatch); >+ top = &(style->elemMatch); > break; > case XSLT_OP_END: > case XSLT_OP_PREDICATE: >@@ -2130,20 +2137,20 @@ > if (pat->steps[0].value != NULL) > name = pat->steps[0].value; > else >- top = (xsltCompMatchPtr *) &(style->piMatch); >+ top = &(style->piMatch); > break; > case XSLT_OP_COMMENT: >- top = (xsltCompMatchPtr *) &(style->commentMatch); >+ top = &(style->commentMatch); > break; > case XSLT_OP_TEXT: >- top = (xsltCompMatchPtr *) &(style->textMatch); >+ top = &(style->textMatch); > break; > case XSLT_OP_ELEM: > case XSLT_OP_NODE: > if (pat->steps[0].value != NULL) > name = pat->steps[0].value; > else >- top = (xsltCompMatchPtr *) &(style->elemMatch); >+ top = &(style->elemMatch); > break; > } > if (name != NULL) { >Index: python/types.c >=================================================================== >--- python/types.c (revision 1419) >+++ python/types.c (working copy) >@@ -431,7 +431,9 @@ > > } else if PyBool_Check (obj) { > >- if (obj == Py_True) { >+ /* Stupid hack to avoid gcc 'type-punned pointer' warning' >+ if (obj == Py_True) { */ >+ if (PyInt_AS_LONG(obj)) { > ret = xmlXPathNewBoolean(1); > } > else {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 162711
: 109395