aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.c23
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.h4
2 files changed, 25 insertions, 2 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
index 2faaeba17..2639202c4 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
@@ -288,6 +288,29 @@ static float strToF (const XML_Char *string, const XML_Char **tail) {
return result;
}
+#if !defined(HAVE_STRNDUP)
+
+/* Emulates glibc's strndup() */
+char *
+strndup(const char *str, size_t size)
+{
+ size_t len;
+ char *result = (char *)NULL;
+
+ if ((char *)NULL == str) return (char *)NULL;
+
+ len = strlen(str);
+ if (!len) return strdup("");
+ if (size > len) size = len;
+
+ result = (char *)malloc((size + 1) * sizeof (char));
+ memcpy(result, str, size);
+ result[size] = 0x0;
+ return result;
+}
+
+#endif /* _WIN32 should be !HAVE_STRNDUP */
+
/** \brief Parse a value of a given type. */
static bool parseValue (driOptionValue *v, driOptionType type,
const XML_Char *string) {
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.h b/mesalib/src/mesa/drivers/dri/common/xmlconfig.h
index 386ddf19d..9cb831571 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.h
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.h
@@ -60,7 +60,7 @@ typedef struct driOptionInfo {
char *name; /**< \brief Name */
driOptionType type; /**< \brief Type */
driOptionRange *ranges; /**< \brief Array of ranges */
- uint nRanges; /**< \brief Number of ranges */
+ unsigned int nRanges; /**< \brief Number of ranges */
} driOptionInfo;
/** \brief Option cache
@@ -78,7 +78,7 @@ typedef struct driOptionCache {
* \li Default values in screen
* \li Actual values in contexts
*/
- uint tableSize;
+ unsigned int tableSize;
/**< \brief Size of the arrays
*
* In the current implementation it's not actually a size but log2(size).