SDL_ScreenKeyboard compatibility for SDL2, updated mxml and jpeg libraries
This commit is contained in:
@@ -1,30 +1,29 @@
|
||||
/*
|
||||
* "$Id: mxml-set.c 270 2007-04-23 21:48:03Z mike $"
|
||||
* "$Id: mxml-set.c 441 2011-12-09 23:49:00Z mike $"
|
||||
*
|
||||
* Node set functions for Mini-XML, a small XML-like file parsing library.
|
||||
*
|
||||
* Copyright 2003-2007 by Michael Sweet.
|
||||
* Copyright 2003-2011 by Michael R Sweet.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2, or (at your option) any later version.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Michael R Sweet and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "COPYING"
|
||||
* which should have been included with this file. If this file is
|
||||
* missing or damaged, see the license at:
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* http://www.minixml.org/
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* mxmlSetCustom() - Set the data and destructor of a custom data node.
|
||||
* mxmlSetCDATA() - Set the element name of a CDATA node.
|
||||
* mxmlSetElement() - Set the name of an element node.
|
||||
* mxmlSetInteger() - Set the value of an integer node.
|
||||
* mxmlSetOpaque() - Set the value of an opaque node.
|
||||
* mxmlSetReal() - Set the value of a real number node.
|
||||
* mxmlSetText() - Set the value of a text node.
|
||||
* mxmlSetTextf() - Set the value of a text node to a formatted string.
|
||||
* mxmlSetCDATA() - Set the element name of a CDATA node.
|
||||
* mxmlSetCustom() - Set the data and destructor of a custom data node.
|
||||
* mxmlSetElement() - Set the name of an element node.
|
||||
* mxmlSetInteger() - Set the value of an integer node.
|
||||
* mxmlSetOpaque() - Set the value of an opaque node.
|
||||
* mxmlSetReal() - Set the value of a real number node.
|
||||
* mxmlSetText() - Set the value of a text node.
|
||||
* mxmlSetTextf() - Set the value of a text node to a formatted string.
|
||||
* mxmlSetUserData() - Set the user data pointer for a node.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -35,10 +34,49 @@
|
||||
#include "mxml.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetCDATA()' - Set the element name of a CDATA node.
|
||||
*
|
||||
* The node is not changed if it (or its first child) is not a CDATA element node.
|
||||
*
|
||||
* @since Mini-XML 2.3@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
mxmlSetCDATA(mxml_node_t *node, /* I - Node to set */
|
||||
const char *data) /* I - New data string */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (node && node->type == MXML_ELEMENT &&
|
||||
strncmp(node->value.element.name, "![CDATA[", 8) &&
|
||||
node->child && node->child->type == MXML_ELEMENT &&
|
||||
!strncmp(node->child->value.element.name, "![CDATA[", 8))
|
||||
node = node->child;
|
||||
|
||||
if (!node || node->type != MXML_ELEMENT || !data ||
|
||||
strncmp(node->value.element.name, "![CDATA[", 8))
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Free any old element value and set the new value...
|
||||
*/
|
||||
|
||||
if (node->value.element.name)
|
||||
free(node->value.element.name);
|
||||
|
||||
node->value.element.name = _mxml_strdupf("![CDATA[%s]]", data);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetCustom()' - Set the data and destructor of a custom data node.
|
||||
*
|
||||
* The node is not changed if it is not a custom node.
|
||||
* The node is not changed if it (or its first child) is not a custom node.
|
||||
*
|
||||
* @since Mini-XML 2.1@
|
||||
*/
|
||||
@@ -53,6 +91,10 @@ mxmlSetCustom(
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (node && node->type == MXML_ELEMENT &&
|
||||
node->child && node->child->type == MXML_CUSTOM)
|
||||
node = node->child;
|
||||
|
||||
if (!node || node->type != MXML_CUSTOM)
|
||||
return (-1);
|
||||
|
||||
@@ -70,39 +112,6 @@ mxmlSetCustom(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetCDATA()' - Set the element name of a CDATA node.
|
||||
*
|
||||
* The node is not changed if it is not a CDATA element node.
|
||||
*
|
||||
* @since Mini-XML 2.3@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
mxmlSetCDATA(mxml_node_t *node, /* I - Node to set */
|
||||
const char *data) /* I - New data string */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node || node->type != MXML_ELEMENT || !data ||
|
||||
strncmp(node->value.element.name, "![CDATA[", 8))
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Free any old element value and set the new value...
|
||||
*/
|
||||
|
||||
if (node->value.element.name)
|
||||
free(node->value.element.name);
|
||||
|
||||
node->value.element.name = _mxml_strdupf("![CDATA[%s]]", data);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetElement()' - Set the name of an element node.
|
||||
*
|
||||
@@ -136,7 +145,7 @@ mxmlSetElement(mxml_node_t *node, /* I - Node to set */
|
||||
/*
|
||||
* 'mxmlSetInteger()' - Set the value of an integer node.
|
||||
*
|
||||
* The node is not changed if it is not an integer node.
|
||||
* The node is not changed if it (or its first child) is not an integer node.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
@@ -147,6 +156,10 @@ mxmlSetInteger(mxml_node_t *node, /* I - Node to set */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (node && node->type == MXML_ELEMENT &&
|
||||
node->child && node->child->type == MXML_INTEGER)
|
||||
node = node->child;
|
||||
|
||||
if (!node || node->type != MXML_INTEGER)
|
||||
return (-1);
|
||||
|
||||
@@ -163,7 +176,7 @@ mxmlSetInteger(mxml_node_t *node, /* I - Node to set */
|
||||
/*
|
||||
* 'mxmlSetOpaque()' - Set the value of an opaque node.
|
||||
*
|
||||
* The node is not changed if it is not an opaque node.
|
||||
* The node is not changed if it (or its first child) is not an opaque node.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
@@ -174,6 +187,10 @@ mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (node && node->type == MXML_ELEMENT &&
|
||||
node->child && node->child->type == MXML_OPAQUE)
|
||||
node = node->child;
|
||||
|
||||
if (!node || node->type != MXML_OPAQUE || !opaque)
|
||||
return (-1);
|
||||
|
||||
@@ -193,7 +210,7 @@ mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */
|
||||
/*
|
||||
* 'mxmlSetReal()' - Set the value of a real number node.
|
||||
*
|
||||
* The node is not changed if it is not a real number node.
|
||||
* The node is not changed if it (or its first child) is not a real number node.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
@@ -204,6 +221,10 @@ mxmlSetReal(mxml_node_t *node, /* I - Node to set */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (node && node->type == MXML_ELEMENT &&
|
||||
node->child && node->child->type == MXML_REAL)
|
||||
node = node->child;
|
||||
|
||||
if (!node || node->type != MXML_REAL)
|
||||
return (-1);
|
||||
|
||||
@@ -220,7 +241,7 @@ mxmlSetReal(mxml_node_t *node, /* I - Node to set */
|
||||
/*
|
||||
* 'mxmlSetText()' - Set the value of a text node.
|
||||
*
|
||||
* The node is not changed if it is not a text node.
|
||||
* The node is not changed if it (or its first child) is not a text node.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
@@ -232,6 +253,10 @@ mxmlSetText(mxml_node_t *node, /* I - Node to set */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (node && node->type == MXML_ELEMENT &&
|
||||
node->child && node->child->type == MXML_TEXT)
|
||||
node = node->child;
|
||||
|
||||
if (!node || node->type != MXML_TEXT || !string)
|
||||
return (-1);
|
||||
|
||||
@@ -252,7 +277,7 @@ mxmlSetText(mxml_node_t *node, /* I - Node to set */
|
||||
/*
|
||||
* 'mxmlSetTextf()' - Set the value of a text node to a formatted string.
|
||||
*
|
||||
* The node is not changed if it is not a text node.
|
||||
* The node is not changed if it (or its first child) is not a text node.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
@@ -268,6 +293,10 @@ mxmlSetTextf(mxml_node_t *node, /* I - Node to set */
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (node && node->type == MXML_ELEMENT &&
|
||||
node->child && node->child->type == MXML_TEXT)
|
||||
node = node->child;
|
||||
|
||||
if (!node || node->type != MXML_TEXT || !format)
|
||||
return (-1);
|
||||
|
||||
@@ -290,5 +319,31 @@ mxmlSetTextf(mxml_node_t *node, /* I - Node to set */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: mxml-set.c 270 2007-04-23 21:48:03Z mike $".
|
||||
* 'mxmlSetUserData()' - Set the user data pointer for a node.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
mxmlSetUserData(mxml_node_t *node, /* I - Node to set */
|
||||
void *data) /* I - User data pointer */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Set the user data pointer and return...
|
||||
*/
|
||||
|
||||
node->user_data = data;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: mxml-set.c 441 2011-12-09 23:49:00Z mike $".
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user