[bTSstream-devel] [Git][videolan/bitstream][master] 3 commits: SRT: fix qualifier warnings

Christophe Massiot (@cmassiot) gitlab at videolan.org
Thu Mar 21 14:15:18 UTC 2024



Christophe Massiot pushed to branch master at VideoLAN / bitstream


Commits:
6eeaaec8 by Rafaël Carré at 2024-03-21T14:50:17+01:00
SRT: fix qualifier warnings

- - - - -
59c68e00 by Rafaël Carré at 2024-03-21T14:50:21+01:00
srt: fix warning

- - - - -
dcb62334 by Rafaël Carré at 2024-03-21T14:50:25+01:00
srt: fix macOS build

- - - - -


1 changed file:

- haivision/srt.h


Changes:

=====================================
haivision/srt.h
=====================================
@@ -34,6 +34,7 @@
 #define __BITSTREAM_HAIVISION_SRT__
 
 #include <stdint.h>   /* uint8_t, uint16_t, etc... */
+#include <string.h>   /* memcpy */
 #include <stdbool.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -456,7 +457,7 @@ static inline void srt_set_handshake_ip(uint8_t *cif, const struct sockaddr *add
         case AF_INET6: {
             const struct sockaddr_in6 *in6 = (const struct sockaddr_in6 *)addr;
             for (int i = 0; i < 4; i++) {
-                memcpy(&ip, &in6->sin6_addr.s6_addr32[i], 4);
+                memcpy(&ip, &in6->sin6_addr.s6_addr[4*i], sizeof(ip));
                 cif[32+4*i] = (ip >> 24) & 0xff;
                 cif[33+4*i] = (ip >> 16) & 0xff;
                 cif[34+4*i] = (ip >>  8) & 0xff;
@@ -481,10 +482,11 @@ static inline void srt_get_handshake_ip(const uint8_t *cif, struct sockaddr *add
     } else {
         struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)addr;
         in6->sin6_family = AF_INET6;
-        memcpy(&in6->sin6_addr.s6_addr32[0], &ip0, 4); /* why ? */
-        memcpy(&in6->sin6_addr.s6_addr32[1], &ip1, 4); /* why ? */
-        memcpy(&in6->sin6_addr.s6_addr32[2], &ip2, 4); /* why ? */
-        memcpy(&in6->sin6_addr.s6_addr32[3], &ip3, 4); /* why ? */
+        memcpy(&in6->sin6_addr.s6_addr[4*0], &ip0, 4); /* why ? */
+        memcpy(&in6->sin6_addr.s6_addr[4*1], &ip1, 4); /* why ? */
+        memcpy(&in6->sin6_addr.s6_addr[4*2], &ip2, 4); /* why ? */
+        memcpy(&in6->sin6_addr.s6_addr[4*3], &ip3, 4); /* why ? */
+
     }
 }
 
@@ -533,7 +535,7 @@ static inline bool srt_check_handshake(const uint8_t *cif, size_t n)
     uint16_t ext = srt_get_handshake_extension(cif);
 
     if (v == SRT_HANDSHAKE_VERSION && ext && ext != SRT_MAGIC_CODE) {
-        const uint8_t *ext = srt_get_handshake_extension_buf(cif);
+        const uint8_t *ext = srt_get_handshake_extension_buf((uint8_t*)cif);
         while (n) {
             if (n < SRT_HANDSHAKE_CIF_EXTENSION_MIN_SIZE)
                 return false;
@@ -664,7 +666,7 @@ static inline void srt_km_set_klen(uint8_t *km, const uint8_t klen)
     km[15] = klen;
 }
 
-static inline uint8_t *srt_km_get_salt(const uint8_t *km)
+static inline const uint8_t *srt_km_get_salt(const uint8_t *km)
 {
     return &km[16];
 }



View it on GitLab: https://code.videolan.org/videolan/bitstream/-/compare/ca65d298d2cb958798c2c3da36b9a3fd48b8dadb...dcb62334b441c2d8dbeb256d8ebc2b7353c9a503

-- 
View it on GitLab: https://code.videolan.org/videolan/bitstream/-/compare/ca65d298d2cb958798c2c3da36b9a3fd48b8dadb...dcb62334b441c2d8dbeb256d8ebc2b7353c9a503
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the biTStream-devel mailing list