aboutsummaryrefslogtreecommitdiff
path: root/xml.c
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2009-04-20 17:06:38 -0400
committercomex <comexk@gmail.com>2009-04-20 17:06:38 -0400
commitb440e369ed1a68337101f3258c44ee91765284e9 (patch)
tree63e53ca8f02d3a0cf4e82cba7bb3239921401ace /xml.c
parentcd6b21e3db3b05417b4e7ba662941c433d363bd0 (diff)
brlan.h and shit
Diffstat (limited to 'xml.c')
-rw-r--r--xml.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/xml.c b/xml.c
index 2eb1bca..cd04b34 100644
--- a/xml.c
+++ b/xml.c
@@ -4,65 +4,65 @@
#include "types.h"
#include "xml.h"
-char * /* O - Buffer */
-get_value(mxml_node_t *node, /* I - Node to get */
- void *buffer, /* I - Buffer */
- int buflen) /* I - Size of buffer */
+char * /* O - Buffer */
+get_value(mxml_node_t *node, /* I - Node to get */
+ void *buffer, /* I - Buffer */
+ int buflen) /* I - Size of buffer */
{
- char *ptr, /* Pointer into buffer */
- *end; /* End of buffer */
- int len; /* Length of node */
- mxml_node_t *current; /* Current node */
-
-
- ptr = (char*)buffer;
- end = (char*)buffer + buflen - 1;
- char tempbuf[256];
- current = node->child;
- for (current = node->child; current && ptr < end; current = current->next)
- {
- if (current->type == MXML_TEXT)
- {
- if (current->value.text.whitespace)
- *ptr++ = ' ';
-
- len = (int)strlen(current->value.text.string);
- if (len > (int)(end - ptr))
- len = (int)(end - ptr);
-
- memcpy(ptr, current->value.text.string, len);
- ptr += len;
- }
- else if (current->type == MXML_OPAQUE)
- {
- len = (int)strlen(current->value.opaque);
- if (len > (int)(end - ptr))
- len = (int)(end - ptr);
-
- memcpy(ptr, current->value.opaque, len);
- ptr += len;
- }
- else if (current->type == MXML_INTEGER)
- {
- sprintf(tempbuf, "%d", current->value.integer);
- len = (int)strlen(tempbuf);
- if (len > (int)(end - ptr))
- len = (int)(end - ptr);
-
- memcpy(ptr, tempbuf, len);
- ptr += len;
- }
- else if (current->type == MXML_REAL)
- {
- sprintf(tempbuf, "%f", current->value.real);
- len = (int)strlen(tempbuf);
- if (len > (int)(end - ptr))
- len = (int)(end - ptr);
-
- memcpy(ptr, tempbuf, len);
- ptr += len;
- }
- }
- *ptr = 0;
- return buffer;
+ char *ptr, /* Pointer into buffer */
+ *end; /* End of buffer */
+ int len; /* Length of node */
+ mxml_node_t *current; /* Current node */
+
+
+ ptr = (char*)buffer;
+ end = (char*)buffer + buflen - 1;
+ char tempbuf[256];
+ current = node->child;
+ for (current = node->child; current && ptr < end; current = current->next)
+ {
+ if (current->type == MXML_TEXT)
+ {
+ if (current->value.text.whitespace)
+ *ptr++ = ' ';
+
+ len = (int)strlen(current->value.text.string);
+ if (len > (int)(end - ptr))
+ len = (int)(end - ptr);
+
+ memcpy(ptr, current->value.text.string, len);
+ ptr += len;
+ }
+ else if (current->type == MXML_OPAQUE)
+ {
+ len = (int)strlen(current->value.opaque);
+ if (len > (int)(end - ptr))
+ len = (int)(end - ptr);
+
+ memcpy(ptr, current->value.opaque, len);
+ ptr += len;
+ }
+ else if (current->type == MXML_INTEGER)
+ {
+ sprintf(tempbuf, "%d", current->value.integer);
+ len = (int)strlen(tempbuf);
+ if (len > (int)(end - ptr))
+ len = (int)(end - ptr);
+
+ memcpy(ptr, tempbuf, len);
+ ptr += len;
+ }
+ else if (current->type == MXML_REAL)
+ {
+ sprintf(tempbuf, "%f", current->value.real);
+ len = (int)strlen(tempbuf);
+ if (len > (int)(end - ptr))
+ len = (int)(end - ptr);
+
+ memcpy(ptr, tempbuf, len);
+ ptr += len;
+ }
+ }
+ *ptr = 0;
+ return buffer;
}