diff options
| author | Valery Febvre <vfebvre at easter-eggs.com> | 2004-04-15 16:31:19 +0000 |
|---|---|---|
| committer | Valery Febvre <vfebvre at easter-eggs.com> | 2004-04-15 16:31:19 +0000 |
| commit | 05cb3fe07ced9b5fdd339604b3624ab5d2f4cf81 (patch) | |
| tree | 2738b37998543898f306e7a4f16fd203fe328b74 | |
| parent | a7987f374fc195d0355f45054872a5589d9483ad (diff) | |
| download | lasso-05cb3fe07ced9b5fdd339604b3624ab5d2f4cf81.tar.gz lasso-05cb3fe07ced9b5fdd339604b3624ab5d2f4cf81.tar.xz lasso-05cb3fe07ced9b5fdd339604b3624ab5d2f4cf81.zip | |
*** empty log message ***
| -rw-r--r-- | lasso/xml/tools.c | 16 | ||||
| -rw-r--r-- | lasso/xml/xml.c | 30 |
2 files changed, 34 insertions, 12 deletions
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c index aedbf92a..b933fa5f 100644 --- a/lasso/xml/tools.c +++ b/lasso/xml/tools.c @@ -27,18 +27,20 @@ xmlChar * lasso_build_unique_id(guint8 size) { - // The probability of 2 randomly chosen identifiers being identical MUST be - // less than 2^-128 and SHOULD be less than 2^-160. - // so we must have 128 <= exp <= 160 - // we could build a 128-bit binary number but hexa system is shorter - // 32 <= hexa number size <= 48 + /* + The probability of 2 randomly chosen identifiers being identical MUST be + less than 2^-128 and SHOULD be less than 2^-160. + so we must have 128 <= exp <= 160 + we could build a 128-bit binary number but hexa system is shorter + 32 <= hexa number size <= 48 + */ int i, val; xmlChar *id, *enc_id; if (size == 0) size = 32; id = g_malloc(size+1); - // build hex number (<= 2^exp-1) + /* build hex number (<= 2^exp-1) */ for (i=0; i<size; i++) { val = g_random_int_range(0, 16); if (val < 10) @@ -48,7 +50,7 @@ lasso_build_unique_id(guint8 size) } id[size] = '\0'; - // base64 encoding of build string + /* base64 encoding of build string */ enc_id = xmlSecBase64Encode(id, size, 0); g_free(id); diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c index 5a4a1728..db8e063c 100644 --- a/lasso/xml/xml.c +++ b/lasso/xml/xml.c @@ -377,18 +377,38 @@ static LassoNode * lasso_node_impl_get_child(LassoNode *node, const xmlChar *name) { - xmlNodePtr cur; + /* xmlNodePtr cur; */ - cur = node->private->node->children; + /* cur = node->private->node->children; */ + /* while (cur != NULL) { */ + /* if(cur->type == XML_ELEMENT_NODE) { */ + /* if (xmlStrEqual(cur->name, name)) { */ + /* return (lasso_node_new(cur)); */ + /* } */ + /* } */ + /* cur = cur->next; */ + /* } */ + /* return (NULL); */ + + xmlNodePtr cur; + LassoNode *ret; + + cur = node->private->node; while (cur != NULL) { - if(cur->type == XML_ELEMENT_NODE) { - if (xmlStrEqual(cur->name, name)) { - return (lasso_node_new(cur)); + if ((cur->type == XML_ELEMENT_NODE) && xmlStrEqual(cur->name, name)) { + return (lasso_node_new(cur)); + } + if (cur->children != NULL) { + ret = lasso_node_get_child(lasso_node_new(cur->children), name); + if (ret != NULL) { + return (ret); } } cur = cur->next; } return (NULL); + + /* return (lasso_node_new(child)); */ } static GPtrArray * |
