summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2021-04-19 12:21:36 -0700
committerEric Engestrom <eric@engestrom.ch>2021-04-20 19:43:32 +0200
commit46b9602c75dc14294d9f617a2c0d66de01612ada (patch)
tree71227c08d951af7ddcaf19822741b21f3d68217d
parent87b50c6f268dfd159b8b3bb7ed5a764cbac9d0f0 (diff)
xmlconfig: Fix MSVC warning C4334 (32bit shift cast to 64bit)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-By: Bill Kristiansen <billkris@microsoft.com> Cc: mesa-stable@lists.freedesktop.org Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10331> (cherry picked from commit 2b69dd68097ef86d3226aa074cb1bab6e6187707)
-rw-r--r--.pick_status.json2
-rw-r--r--src/util/xmlconfig.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 657bfacf331..5e713c6354f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -373,7 +373,7 @@
"description": "xmlconfig: Fix MSVC warning C4334 (32bit shift cast to 64bit)",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c
index a3c6429205d..62b5e0d925f 100644
--- a/src/util/xmlconfig.c
+++ b/src/util/xmlconfig.c
@@ -321,8 +321,8 @@ driParseOptionInfo(driOptionCache *info,
* config options we've ever seen in a driver.
*/
info->tableSize = 6;
- info->info = calloc(1 << info->tableSize, sizeof(driOptionInfo));
- info->values = calloc(1 << info->tableSize, sizeof(driOptionValue));
+ info->info = calloc((size_t)1 << info->tableSize, sizeof(driOptionInfo));
+ info->values = calloc((size_t)1 << info->tableSize, sizeof(driOptionValue));
if (info->info == NULL || info->values == NULL) {
fprintf(stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
abort();
@@ -1109,13 +1109,13 @@ initOptionCache(driOptionCache *cache, const driOptionCache *info)
unsigned i, size = 1 << info->tableSize;
cache->info = info->info;
cache->tableSize = info->tableSize;
- cache->values = malloc((1<<info->tableSize) * sizeof(driOptionValue));
+ cache->values = malloc(((size_t)1 << info->tableSize) * sizeof(driOptionValue));
if (cache->values == NULL) {
fprintf(stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
abort();
}
memcpy(cache->values, info->values,
- (1<<info->tableSize) * sizeof(driOptionValue));
+ ((size_t)1 << info->tableSize) * sizeof(driOptionValue));
for (i = 0; i < size; ++i) {
if (cache->info[i].type == DRI_STRING)
XSTRDUP(cache->values[i]._string, info->values[i]._string);