Open Bug 1680362 Opened 5 years ago Updated 3 years ago

warning: Usage of ASCII file functions (here fopen) is forbidden on Windows.

Categories

(Core :: Audio/Video, defect)

x86_64
Windows 10
defect

Tracking

()

People

(Reporter: saschanaz, Unassigned)

Details

It's mainly from dom/media but also from other directories. I'm on VS 16.8.2.

12:37.98 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/WavDumper.h(43,13): note: On Windows executed functions: fopen, fopen_s, open, _open, _sopen, _sopen_s, OpenFile, CreateFileA should never be used due to lossy conversion from UTF8 to ANSI.
12:38.37 1 warning generated.
12:39.43 dom/media/imagecapture
12:40.47 In file included from Unified_cpp_gtest_mp4_demuxer0.cpp:2:
12:40.48 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/mp4_demuxer/TestMP4.cpp(111,13): warning: Usage of ASCII file functions (here fopen) is forbidden on Windows.
12:40.48   FILE* f = fopen("street.mp4", "rb");
12:40.52             ^
12:40.54 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/mp4_demuxer/TestMP4.cpp(111,13): note: On Windows executed functions: fopen, fopen_s, open, _open, _sopen, _sopen_s, OpenFile, CreateFileA should never be used due to lossy conversion from UTF8 to ANSI.
12:40.56 1 warning generated.
12:46.30 dom/media/ipc
12:47.10 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/mp4_demuxer/TestParser.cpp(124,13): warning: Usage of ASCII file functions (here fopen) is forbidden on Windows.
12:47.12   FILE* f = fopen(aFilename, "rb");
12:47.12             ^
12:47.13 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/mp4_demuxer/TestParser.cpp(124,13): note: On Windows executed functions: fopen, fopen_s, open, _open, _sopen, _sopen_s, OpenFile, CreateFileA should never be used due to lossy conversion from UTF8 to ANSI.
12:47.21 1 warning generated.
12:56.93 dom/media/mediacapabilities
13:00.07 In file included from Unified_cpp_dom_media_gtest2.cpp:65:
13:00.11 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/TestVPXDecoding.cpp(15,13): warning: Usage of ASCII file functions (here fopen) is forbidden on Windows.
13:00.14   FILE* f = fopen(aPath, "rb");
13:00.18             ^
13:00.21 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/TestVPXDecoding.cpp(15,13): note: On Windows executed functions: fopen, fopen_s, open, _open, _sopen, _sopen_s, OpenFile, CreateFileA should never be used due to lossy conversion from UTF8 to ANSI.
13:00.80 dom/media/mediacontrol
13:00.99 In file included from Unified_cpp_dom_media_gtest2.cpp:110:
13:01.03 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/TestWebMBuffered.cpp(41,13): warning: Usage of ASCII file functions (here fopen) is forbidden on Windows.
13:01.07   FILE* f = fopen(aPath, "rb");
13:01.08             ^
13:01.11 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/TestWebMBuffered.cpp(41,13): note: On Windows executed functions: fopen, fopen_s, open, _open, _sopen, _sopen_s, OpenFile, CreateFileA should never be used due to lossy conversion from UTF8 to ANSI.
13:01.12 2 warnings generated.
13:01.45 dom/media/mediacontrol/tests/gtest
13:03.31 In file included from Unified_cpp_dom_media_gtest0.cpp:11:
13:03.33 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/MockMediaResource.cpp(16,17): warning: Usage of ASCII file functions (here fopen) is forbidden on Windows.
13:03.34   mFileHandle = fopen(mFileName, "rb");
13:03.35                 ^
13:03.38 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/MockMediaResource.cpp(16,17): note: On Windows executed functions: fopen, fopen_s, open, _open, _sopen, _sopen_s, OpenFile, CreateFileA should never be used due to lossy conversion from UTF8 to ANSI.
13:03.43 In file included from Unified_cpp_dom_media_gtest0.cpp:29:
13:03.45 In file included from C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/gtest/TestAudioCallbackDriver.cpp:7:
13:03.46 In file included from C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/GraphDriver.h:12:
13:03.49 In file included from C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media\AudioMixer.h:10:
13:03.49 In file included from C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/AudioStream.h:22:
13:03.49 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/WavDumper.h(43,13): warning: Usage of ASCII file functions (here fopen) is forbidden on Windows.
13:03.54     mFile = fopen(buf, "wb");
13:03.58             ^
13:03.60 C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/WavDumper.h(43,13): note: On Windows executed functions: fopen, fopen_s, open, _open, _sopen, _sopen_s, OpenFile, CreateFileA should never be used due to lossy conversion from UTF8 to ANSI.
13:06.18 2 warnings generated.
13:06.49 dom/media/mediasession
13:09.38 dom/media/mediasink
13:12.64 dom/media/mediasource/gtest
13:27.71 In file included from Unified_cpp_dom_media_mediasink0.cpp:2:
13:27.72 In file included from C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/mediasink/AudioSink.cpp:7:
13:27.74 In file included from C:/Users/Kagami/Documents/GitHub/gecko-dev/dom/media/mediasink/AudioSink.h:9:
13:27.74 In file included from C:/Users/Kagami/Documents/GitHub/gecko-dev/obj-x86_64-pc-mingw32/dist/include\AudioStream.h:22:
13:27.76 C:/Users/Kagami/Documents/GitHub/gecko-dev/obj-x86_64-pc-mingw32/dist/include/WavDumper.h(43,13): warning: Usage of ASCII file functions (here fopen) is forbidden on Windows.
13:27.78     mFile = fopen(buf, "wb");
13:27.78             ^
13:27.78 C:/Users/Kagami/Documents/GitHub/gecko-dev/obj-x86_64-pc-mingw32/dist/include/WavDumper.h(43,13): note: On Windows executed functions: fopen, fopen_s, open, _open, _sopen, _sopen_s, OpenFile, CreateFileA should never be used due to lossy conversion from UTF8 to ANSI.
13:29.34 1 warning generated.
13:29.69 dom/media/mediasource

We try to keep Core: General pretty empty so let's file bugs for the different directories with issues. We can use this one for dom/media.

Component: General → Audio/Video
Summary: wraning: Usage of ASCII file functions (here fopen) is forbidden on Windows. → warning: Usage of ASCII file functions (here fopen) is forbidden on Windows.

I've audited the instances mentioned in comment 0 and they all look safe because they are called using strings that will not contain characters that trip us up.

In the interest of not producing warnings I'll look at fixing the sites. I had a look at conventions around this and it seems like nsIFIle is probably the way to go (I'd considered the std lib streams and filesystem API, but there doesn't seem to be much existing usage and folks I spoke to suggested sticking with our xpcom abstractions).

Assignee: nobody → bvandyk
Severity: -- → S3

Unassigning bugs assigned to Bryce because he no longer works at Mozilla.

Assignee: brycebugemail → nobody
You need to log in before you can comment on or make changes to this bug.