1
0
Эх сурвалжийг харах

obs-outputs: Make rtmp packet alloc code path clearer

On 64bit systems, this check will always evaluate to false due to
SIZE_MAX type and triggers a compiler warning.

This both makes it clearer that its only needed on 32bit system and
clear the compiler warning.
Shaolin 7 жил өмнө
parent
commit
d500ef3bb5

+ 2 - 0
plugins/obs-outputs/librtmp/rtmp.c

@@ -242,8 +242,10 @@ int
 RTMPPacket_Alloc(RTMPPacket *p, uint32_t nSize)
 RTMPPacket_Alloc(RTMPPacket *p, uint32_t nSize)
 {
 {
     char *ptr;
     char *ptr;
+#if ARCH_BITS == 32
     if (nSize > SIZE_MAX - RTMP_MAX_HEADER_SIZE)
     if (nSize > SIZE_MAX - RTMP_MAX_HEADER_SIZE)
         return FALSE;
         return FALSE;
+#endif
 
 
     ptr = calloc(1, nSize + RTMP_MAX_HEADER_SIZE);
     ptr = calloc(1, nSize + RTMP_MAX_HEADER_SIZE);
     if (!ptr)
     if (!ptr)