Skip to content

cubeb __FILENAME__ macro incorrectly uses / to delimit paths on windows #852

Description

@mutexlox-signal

Since #581, cubeb_log.h has used the following logic to strip __FILE__ to only include the basename of the file (rather than the whole path):

#define __FILENAME__                                                           \
  (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)

Unfortunately, this is incorrect on Windows, since it uses '\' to delimit paths. In practice, this can lead to logs from, e.g., cubeb_wasapi.cpp being needlessly truncated, like the following, from ringrtc, which uses cubeb-rs:

C:\a\ringrtc-private\ringrtc-private\target\x86_64-pc-windows-msvc\release\build\cubeb-sys-5b33f650b6d0fb14\out\libcubeb\src\cubeb_wasapi.cpp:691:collection: Audio device state changed, id = {0.0.0.00000000}.{[omitted irrelevant uuid]}, state =

Note that a full 125 of the available 256 characters in the log string are taken up by the path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions