[vlc-commits] chroma: copy: do not use an empty structure if SSE2 is not supported

Steve Lhomme git at videolan.org
Tue May 7 12:01:05 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu May  2 11:35:03 2019 +0200| [8e091be3ffd71400c8b925d3ccec707a741fd0dc] | committer: Steve Lhomme

chroma: copy: do not use an empty structure if SSE2 is not supported

Structures with no field should not be used, it's Undefined Behavior:
https://stackoverflow.com/questions/3849334/sizeof-empty-structure-is-0-in-c-and-1-in-c-why

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8e091be3ffd71400c8b925d3ccec707a741fd0dc
---

 modules/video_chroma/copy.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/modules/video_chroma/copy.h b/modules/video_chroma/copy.h
index 6c463226f1..b06dc680cc 100644
--- a/modules/video_chroma/copy.h
+++ b/modules/video_chroma/copy.h
@@ -29,6 +29,8 @@ typedef struct {
 # ifdef CAN_COMPILE_SSE2
     uint8_t *buffer;
     size_t  size;
+# else
+    char dummy;
 # endif
 } copy_cache_t;
 



More information about the vlc-commits mailing list