various: use thread safe mp_strerror()

This commit is contained in:
nanahi 2024-03-19 12:02:19 -04:00 committed by Kacper Michajłow
parent df01ebaafc
commit 5fea0f9a47
4 changed files with 9 additions and 6 deletions

View File

@ -36,6 +36,7 @@
#include <sys/types.h> #include <sys/types.h>
#include "audio/format.h" #include "audio/format.h"
#include "common/common.h"
#include "common/msg.h" #include "common/msg.h"
#include "options/options.h" #include "options/options.h"
#include "osdep/endian.h" #include "osdep/endian.h"
@ -89,7 +90,7 @@ static const int format_table[][2] = {
#define MP_WARN_IOCTL_ERR(__ao) \ #define MP_WARN_IOCTL_ERR(__ao) \
MP_WARN((__ao), "%s: ioctl() fail, err = %i: %s\n", \ MP_WARN((__ao), "%s: ioctl() fail, err = %i: %s\n", \
__FUNCTION__, errno, strerror(errno)) __FUNCTION__, errno, mp_strerror(errno))
static void uninit(struct ao *ao); static void uninit(struct ao *ao);
@ -329,7 +330,7 @@ static bool audio_write(struct ao *ao, void **data, int samples)
if (errno == EINTR) if (errno == EINTR)
continue; continue;
MP_WARN(ao, "audio_write: write() fail, err = %i: %s.\n", MP_WARN(ao, "audio_write: write() fail, err = %i: %s.\n",
errno, strerror(errno)); errno, mp_strerror(errno));
return false; return false;
} }
if ((size_t)rc != size) { if ((size_t)rc != size) {

View File

@ -27,6 +27,7 @@
#include <spa/utils/result.h> #include <spa/utils/result.h>
#include <math.h> #include <math.h>
#include "common/common.h"
#include "common/msg.h" #include "common/msg.h"
#include "options/m_config.h" #include "options/m_config.h"
#include "options/m_option.h" #include "options/m_option.h"
@ -166,7 +167,7 @@ static void on_process(void *userdata)
void *data[MP_NUM_CHANNELS]; void *data[MP_NUM_CHANNELS];
if ((b = pw_stream_dequeue_buffer(p->stream)) == NULL) { if ((b = pw_stream_dequeue_buffer(p->stream)) == NULL) {
MP_WARN(ao, "out of buffers: %s\n", strerror(errno)); MP_WARN(ao, "out of buffers: %s\n", mp_strerror(errno));
return; return;
} }
@ -518,7 +519,7 @@ static int pipewire_init_boilerplate(struct ao *ao)
if (!p->core) { if (!p->core) {
MP_MSG(ao, ao->probing ? MSGL_V : MSGL_ERR, MP_MSG(ao, ao->probing ? MSGL_V : MSGL_ERR,
"Could not connect to context '%s': %s\n", "Could not connect to context '%s': %s\n",
p->options.remote, strerror(errno)); p->options.remote, mp_strerror(errno));
pw_context_destroy(context); pw_context_destroy(context);
goto error; goto error;
} }

View File

@ -388,7 +388,7 @@ bool vo_drm_acquire_crtc(struct vo_drm_state *drm)
drm_object_set_property(request, atomic_ctx->draw_plane, "CRTC_H", drm->mode.mode.vdisplay); drm_object_set_property(request, atomic_ctx->draw_plane, "CRTC_H", drm->mode.mode.vdisplay);
if (drmModeAtomicCommit(drm->fd, request, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL)) { if (drmModeAtomicCommit(drm->fd, request, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL)) {
MP_ERR(drm, "Failed to commit ModeSetting atomic request: %s\n", strerror(errno)); MP_ERR(drm, "Failed to commit ModeSetting atomic request: %s\n", mp_strerror(errno));
goto err; goto err;
} }

View File

@ -15,6 +15,7 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>. * License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "common/common.h"
#include "context.h" #include "context.h"
#include "options/m_config.h" #include "options/m_config.h"
#include "utils.h" #include "utils.h"
@ -296,7 +297,7 @@ static void open_render_fd(struct ra_ctx *ctx, const char *render_path)
p->drm_params.render_fd = open(render_path, O_RDWR | O_CLOEXEC); p->drm_params.render_fd = open(render_path, O_RDWR | O_CLOEXEC);
if (p->drm_params.render_fd == -1) { if (p->drm_params.render_fd == -1) {
MP_WARN(ctx, "Failed to open render node: %s\n", MP_WARN(ctx, "Failed to open render node: %s\n",
strerror(errno)); mp_strerror(errno));
} }
} }