diff options
author | Ray Molenkamp <github@lazydodo.com> | 2020-08-28 18:46:57 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2020-08-28 18:47:52 +0300 |
commit | 1cb7267a9f9f1695f296bdbb618ec117f483484c (patch) | |
tree | 132fdc31da602a178439340ffaed19296a1df39b /source/blender/blenkernel | |
parent | 4749bd227723459097c246aa8a77c74545bc36ef (diff) |
Cleanup: Fix build error with msvc
`ssize_t` is not a standardized type (it's a posix type)
given the line in question here is calculating the size
of a memory allocation there's no logical way this
should ever be negative.
I do not know this code too well and was unsure if
`mdverts->totweight` could ever be < 0, so I protected
it with a clamp, just in case.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/deform.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 4f5a2740ca6..ea5e4ec6532 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -1557,7 +1557,7 @@ void BKE_defvert_blend_read(BlendDataReader *reader, int count, MDeformVert *mdv /*convert to vgroup allocation system*/ MDeformWeight *dw; if (mdverts->dw && (dw = BLO_read_get_new_data_address(reader, mdverts->dw))) { - const ssize_t dw_len = mdverts->totweight * sizeof(MDeformWeight); + const size_t dw_len = MAX2(mdverts->totweight, 0) * sizeof(MDeformWeight); void *dw_tmp = MEM_mallocN(dw_len, __func__); memcpy(dw_tmp, dw, dw_len); mdverts->dw = dw_tmp; |