From f8bf84307f4dabb60c7afb7241548c086616f686 Mon Sep 17 00:00:00 2001 From: Ederson de Souza Date: Thu, 2 Jul 2020 16:17:01 -0700 Subject: [PATCH] avtp: Use g_strerror instead of strerror It should avoid some implicit declaration errors (and be utf-8 friendly). Part-of: --- ext/avtp/gstavtpcrfbase.c | 12 ++++++------ ext/avtp/gstavtpsink.c | 12 +++++++----- ext/avtp/gstavtpsrc.c | 11 ++++++----- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ext/avtp/gstavtpcrfbase.c b/ext/avtp/gstavtpcrfbase.c index 8baf29f..f2ac6c1 100644 --- a/ext/avtp/gstavtpcrfbase.c +++ b/ext/avtp/gstavtpcrfbase.c @@ -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; } diff --git a/ext/avtp/gstavtpsink.c b/ext/avtp/gstavtpsink.c index 2718ce7..00db126 100644 --- a/ext/avtp/gstavtpsink.c +++ b/ext/avtp/gstavtpsink.c @@ -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); diff --git a/ext/avtp/gstavtpsrc.c b/ext/avtp/gstavtpsrc.c index 9db1fd1..0a91221 100644 --- a/ext/avtp/gstavtpsrc.c +++ b/ext/avtp/gstavtpsrc.c @@ -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; -- 2.7.4