mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1406687 Pass return values from fwrite to Unused to silence the warn-unused-result warning r=njn
MozReview-Commit-ID: 4v6tPF5aMz7 --HG-- extra : rebase_source : c54b129c6815096035e262322f40aa0884b1ae56
This commit is contained in:
parent
a5a84f5cd7
commit
22d2cdf063
@ -13,6 +13,7 @@
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include <algorithm>
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "CubebUtils.h"
|
||||
@ -277,7 +278,7 @@ OpenDumpFile(uint32_t aChannels, uint32_t aRate)
|
||||
SetUint16LE(header + CHANNEL_OFFSET, aChannels);
|
||||
SetUint32LE(header + SAMPLE_RATE_OFFSET, aRate);
|
||||
SetUint16LE(header + BLOCK_ALIGN_OFFSET, aChannels * 2);
|
||||
fwrite(header, sizeof(header), 1, f);
|
||||
Unused << fwrite(header, sizeof(header), 1, f);
|
||||
|
||||
return f;
|
||||
}
|
||||
@ -285,7 +286,7 @@ OpenDumpFile(uint32_t aChannels, uint32_t aRate)
|
||||
template <typename T>
|
||||
typename EnableIf<IsSame<T, int16_t>::value, void>::Type
|
||||
WriteDumpFileHelper(T* aInput, size_t aSamples, FILE* aFile) {
|
||||
fwrite(aInput, sizeof(T), aSamples, aFile);
|
||||
Unused << fwrite(aInput, sizeof(T), aSamples, aFile);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -297,7 +298,7 @@ WriteDumpFileHelper(T* aInput, size_t aSamples, FILE* aFile) {
|
||||
for (uint32_t i = 0; i < aSamples; ++i) {
|
||||
SetUint16LE(output + i*2, int16_t(aInput[i]*32767.0f));
|
||||
}
|
||||
fwrite(output, 2, aSamples, aFile);
|
||||
Unused << fwrite(output, 2, aSamples, aFile);
|
||||
fflush(aFile);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
extern mozilla::LogModule* GetSourceBufferResourceLog();
|
||||
|
||||
@ -171,7 +172,7 @@ ResourceQueue::Dump(const char* aPath)
|
||||
if (!fp) {
|
||||
return;
|
||||
}
|
||||
fwrite(item->mData->Elements(), item->mData->Length(), 1, fp);
|
||||
Unused << fwrite(item->mData->Elements(), item->mData->Length(), 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/Vector.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIClipboardHelper.h"
|
||||
@ -1048,7 +1049,7 @@ EncodeSourceSurfaceInternal(SourceSurface* aSurface,
|
||||
|
||||
if (aBinaryOrData == gfxUtils::eBinaryEncode) {
|
||||
if (aFile) {
|
||||
fwrite(imgData.begin(), 1, imgSize, aFile);
|
||||
Unused << fwrite(imgData.begin(), 1, imgSize, aFile);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
3
media/webrtc/signaling/gtest/mediaconduit_unittests.cpp
Normal file → Executable file
3
media/webrtc/signaling/gtest/mediaconduit_unittests.cpp
Normal file → Executable file
@ -13,6 +13,7 @@ using namespace std;
|
||||
#include <MediaConduitInterface.h>
|
||||
#include <VideoConduit.h>
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nss.h"
|
||||
#include "runnable_utils.h"
|
||||
#include "signaling/src/common/EncodingConstraints.h"
|
||||
@ -224,7 +225,7 @@ void AudioSendAndReceive::GenerateAndReadSamples()
|
||||
//Create input file with the music
|
||||
WriteWaveHeader(PLAYOUT_SAMPLE_FREQUENCY, 1, inFile);
|
||||
GenerateMusic(inbuf, SAMPLES);
|
||||
fwrite(inbuf,1,SAMPLES*sizeof(inbuf[0])*CHANNELS,inFile);
|
||||
Unused << fwrite(inbuf,1,SAMPLES*sizeof(inbuf[0])*CHANNELS,inFile);
|
||||
FinishWaveHeader(inFile);
|
||||
fclose(inFile);
|
||||
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "pkixder.h"
|
||||
#include "pkixutil.h"
|
||||
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace mozilla { namespace pkix { namespace test {
|
||||
@ -509,7 +511,7 @@ MaybeLogOutput(const ByteString& result, const char* suffix)
|
||||
++counter;
|
||||
ScopedFILE file(OpenFile(logPath, filename, "wb"));
|
||||
if (file) {
|
||||
(void) fwrite(result.data(), result.length(), 1, file.get());
|
||||
Unused << fwrite(result.data(), result.length(), 1, file.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
testing/gtest/gtest/src/gtest.cc
Normal file → Executable file
4
testing/gtest/gtest/src/gtest.cc
Normal file → Executable file
@ -35,6 +35,8 @@
|
||||
#include "gtest/internal/custom/gtest.h"
|
||||
#include "gtest/gtest-spi.h"
|
||||
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
@ -3866,7 +3868,7 @@ class ScopedPrematureExitFile {
|
||||
// errors are ignored as there's nothing better we can do and we
|
||||
// don't want to fail the test because of this.
|
||||
FILE* pfile = posix::FOpen(premature_exit_filepath, "w");
|
||||
fwrite("0", 1, 1, pfile);
|
||||
Unused << fwrite("0", 1, 1, pfile);
|
||||
fclose(pfile);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
@ -59,7 +60,7 @@ public:
|
||||
str.AppendPrintf(aFormat, list);
|
||||
va_end(list);
|
||||
mSHA1.update(str.get(), str.Length());
|
||||
fwrite(str.get(), 1, str.Length(), mFile);
|
||||
Unused << fwrite(str.get(), 1, str.Length(), mFile);
|
||||
}
|
||||
void Finish(SHA1Sum::Hash& aHash)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user