avtp: Use g_strerror instead of strerror

It should avoid some implicit declaration errors (and be utf-8 friendly).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1404>
This commit is contained in:
Ederson de Souza 2020-07-02 16:17:01 -07:00 committed by GStreamer Merge Bot
parent 890df7ac8c
commit f8bf84307f
3 changed files with 19 additions and 16 deletions

View file

@ -183,7 +183,7 @@ setup_socket (GstAvtpCrfBase * avtpcrfbase)
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_TSN));
if (fd < 0) {
GST_ERROR_OBJECT (avtpcrfbase, "Failed to open socket: %s",
strerror (errno));
g_strerror (errno));
return fd;
}
@ -191,7 +191,7 @@ setup_socket (GstAvtpCrfBase * avtpcrfbase)
if (!ifindex) {
res = -1;
GST_ERROR_OBJECT (avtpcrfbase, "Failed to get index for interface: %s",
strerror (errno));
g_strerror (errno));
goto err;
}
@ -202,7 +202,7 @@ setup_socket (GstAvtpCrfBase * avtpcrfbase)
res = bind (fd, (struct sockaddr *) &sk_addr, sizeof (sk_addr));
if (res < 0) {
GST_ERROR_OBJECT (avtpcrfbase, "Failed to bind socket: %s",
strerror (errno));
g_strerror (errno));
goto err;
}
@ -222,7 +222,7 @@ setup_socket (GstAvtpCrfBase * avtpcrfbase)
sizeof (struct packet_mreq));
if (res < 0) {
GST_ERROR_OBJECT (avtpcrfbase, "Failed to set multicast address: %s",
strerror (errno));
g_strerror (errno));
goto err;
}
@ -232,7 +232,7 @@ setup_socket (GstAvtpCrfBase * avtpcrfbase)
sizeof (struct timeval));
if (res < 0) {
GST_ERROR_OBJECT (avtpcrfbase, "Failed to set receive timeout: %s",
strerror (errno));
g_strerror (errno));
goto err;
}
@ -495,7 +495,7 @@ crf_listener_thread_func (GstAvtpCrfBase * avtpcrfbase)
continue;
GST_ERROR_OBJECT (avtpcrfbase, "Failed to receive packet: %s",
strerror (errno));
g_strerror (errno));
break;
}

View file

@ -224,20 +224,22 @@ gst_avtp_sink_init_socket (GstAvtpSink * avtpsink)
index = if_nametoindex (avtpsink->ifname);
if (!index) {
GST_ERROR_OBJECT (avtpsink, "Failed to get if_index: %s", strerror (errno));
GST_ERROR_OBJECT (avtpsink, "Failed to get if_index: %s",
g_strerror (errno));
return FALSE;
}
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_TSN));
if (fd < 0) {
GST_ERROR_OBJECT (avtpsink, "Failed to open socket: %s", strerror (errno));
GST_ERROR_OBJECT (avtpsink, "Failed to open socket: %s",
g_strerror (errno));
return FALSE;
}
res = setsockopt (fd, SOL_SOCKET, SO_PRIORITY, &avtpsink->priority,
sizeof (avtpsink->priority));
if (res < 0) {
GST_ERROR_OBJECT (avtpsink, "Failed to socket priority: %s", strerror
GST_ERROR_OBJECT (avtpsink, "Failed to socket priority: %s", g_strerror
(errno));
goto err;
}
@ -247,7 +249,7 @@ gst_avtp_sink_init_socket (GstAvtpSink * avtpsink)
res = setsockopt (fd, SOL_SOCKET, SO_TXTIME, &txtime_cfg,
sizeof (txtime_cfg));
if (res < 0) {
GST_ERROR_OBJECT (avtpsink, "Failed to set SO_TXTIME: %s", strerror
GST_ERROR_OBJECT (avtpsink, "Failed to set SO_TXTIME: %s", g_strerror
(errno));
goto err;
}
@ -445,7 +447,7 @@ gst_avtp_sink_render (GstBaseSink * basesink, GstBuffer * buffer)
n = sendmsg (avtpsink->sk_fd, avtpsink->msg, 0);
if (n < 0) {
GST_INFO_OBJECT (avtpsink, "Failed to send AVTPDU: %s", strerror (errno));
GST_INFO_OBJECT (avtpsink, "Failed to send AVTPDU: %s", g_strerror (errno));
if (G_LIKELY (basesink->sync))
gst_avtp_sink_process_error_queue (avtpsink, avtpsink->sk_fd);

View file

@ -203,13 +203,14 @@ gst_avtp_src_start (GstBaseSrc * basesrc)
index = if_nametoindex (avtpsrc->ifname);
if (!index) {
GST_ERROR_OBJECT (avtpsrc, "Failed to get if_index: %s", strerror (errno));
GST_ERROR_OBJECT (avtpsrc, "Failed to get if_index: %s",
g_strerror (errno));
return FALSE;
}
fd = socket (AF_PACKET, SOCK_DGRAM, htons (ETH_P_TSN));
if (fd < 0) {
GST_ERROR_OBJECT (avtpsrc, "Failed to open socket: %s", strerror (errno));
GST_ERROR_OBJECT (avtpsrc, "Failed to open socket: %s", g_strerror (errno));
return FALSE;
}
@ -219,7 +220,7 @@ gst_avtp_src_start (GstBaseSrc * basesrc)
res = bind (fd, (struct sockaddr *) &sk_addr, sizeof (sk_addr));
if (res < 0) {
GST_ERROR_OBJECT (avtpsrc, "Failed to bind socket: %s", strerror (errno));
GST_ERROR_OBJECT (avtpsrc, "Failed to bind socket: %s", g_strerror (errno));
goto err;
}
@ -238,7 +239,7 @@ gst_avtp_src_start (GstBaseSrc * basesrc)
sizeof (struct packet_mreq));
if (res < 0) {
GST_ERROR_OBJECT (avtpsrc, "Failed to set multicast address: %s",
strerror (errno));
g_strerror (errno));
goto err;
}
@ -292,7 +293,7 @@ retry:
goto retry;
}
GST_ELEMENT_ERROR (avtpsrc, RESOURCE, READ, (NULL),
("Failed to receive AVTPDU: %s", strerror (errno)));
("Failed to receive AVTPDU: %s", g_strerror (errno)));
gst_buffer_unmap (buffer, &map);
return GST_FLOW_ERROR;