Skip to content

Commit 859680d

Browse files
generatedunixname89002005232357facebook-github-bot
authored andcommitted
Revert D79333449
Summary: This diff reverts D79333449 This diff broke the code - and these code changes do not help at all. Depends on D79333449 Reviewed By: janherling Differential Revision: D79358487 fbshipit-source-id: b410119da2855370d1bcdcc7831f904cc1aed2ad
1 parent 5638302 commit 859680d

24 files changed

Lines changed: 85 additions & 153 deletions

impl/ocean/io/FileResolver.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ FileResolver::FileResolver()
2121

2222
bool FileResolver::addReferencePath(const Directory& reference)
2323
{
24-
if (!reference.isAbsolute()) {
24+
if (!reference.isAbsolute())
2525
return false;
26-
}
2726

2827
referencePaths.push_back(reference);
2928
return true;
@@ -33,9 +32,8 @@ Files FileResolver::resolve(const File& file, const bool checkExistence) const
3332
{
3433
if (file.isAbsolute())
3534
{
36-
if (!checkExistence || file.exists()) {
35+
if (!checkExistence || file.exists())
3736
return Files(1, file);
38-
}
3937
}
4038

4139
Files files;
@@ -44,9 +42,8 @@ Files FileResolver::resolve(const File& file, const bool checkExistence) const
4442
{
4543
const IO::File resolvedFile(*i + file);
4644

47-
if (!checkExistence || resolvedFile.exists()) {
45+
if (!checkExistence || resolvedFile.exists())
4846
files.push_back(*i + file);
49-
}
5047
}
5148

5249
return files;
@@ -69,9 +66,8 @@ Files FileResolver::resolve(const File& file, const Path& reference, const bool
6966
{
7067
if (file.isAbsolute())
7168
{
72-
if (!checkExistence || file.exists()) {
69+
if (!checkExistence || file.exists())
7370
return Files(1, file);
74-
}
7571
}
7672

7773
Files result;
@@ -82,27 +78,24 @@ Files FileResolver::resolve(const File& file, const Path& reference, const bool
8278
{
8379
const IO::File refFile(refDirectory + file);
8480

85-
if (!checkExistence || refFile.exists()) {
81+
if (!checkExistence || refFile.exists())
8682
result.push_back(refFile);
87-
}
8883
}
8984

9085
for (Directories::const_iterator i = referencePaths.begin(); i != referencePaths.end(); ++i)
9186
{
9287
const IO::File resolvedFile(*i + file);
9388

94-
if (!checkExistence || resolvedFile.exists()) {
89+
if (!checkExistence || resolvedFile.exists())
9590
result.push_back(*i + file);
96-
}
9791
}
9892

9993
if (result.empty())
10094
{
10195
const IO::File defaultFile(file);
10296

103-
if (!checkExistence || defaultFile.exists()) {
97+
if (!checkExistence || defaultFile.exists())
10498
result.push_back(defaultFile);
105-
}
10699
}
107100

108101
return result;

impl/ocean/media/BufferImageRecorder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ bool BufferImageRecorder::start()
2828
{
2929
const ScopedLock scopedLock(recorderLock);
3030

31-
if (recorderSaveImage) {
31+
if (recorderSaveImage)
3232
return false;
33-
}
3433

3534
recorderSaveImage = true;
3635
return true;

impl/ocean/media/ImageRecorder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ bool ImageRecorder::start()
2828
{
2929
const ScopedLock scopedLock(recorderLock);
3030

31-
if (recorderSaveImage) {
31+
if (recorderSaveImage)
3232
return false;
33-
}
3433

3534
recorderSaveImage = true;
3635
return true;

impl/ocean/media/ImageSequenceFrameProviderInterface.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ ImageSequenceFrameProviderInterface::~ImageSequenceFrameProviderInterface()
5454
return;
5555
}
5656
}
57-
while (pendingAsynchronousRequests_ != 0u) {;
58-
}
57+
while (pendingAsynchronousRequests_ != 0u);
5958

6059
ocean_assert(false && "Still pending asynchronous requests");
6160
}

impl/ocean/media/Medium.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,27 +86,26 @@ std::string Medium::convertType(const Type type)
8686

8787
Medium::Type Medium::convertType(const std::string& type)
8888
{
89-
if (type == "FrameMedium") {
89+
if (type == "FrameMedium")
9090
return FRAME_MEDIUM;
91-
} else if (type == "SoundMedium") {
91+
else if (type == "SoundMedium")
9292
return SOUND_MEDIUM;
93-
} else if (type == "FiniteMedium") {
93+
else if (type == "FiniteMedium")
9494
return FINITE_MEDIUM;
95-
} else if (type == "LiveMedium") {
95+
else if (type == "LiveMedium")
9696
return LIVE_MEDIUM;
97-
} else if (type == "ConfigMedium") {
97+
else if (type == "ConfigMedium")
9898
return CONFIG_MEDIUM;
99-
} else if (type == "Audio") {
99+
else if (type == "Audio")
100100
return AUDIO;
101-
} else if (type == "Image") {
101+
else if (type == "Image")
102102
return IMAGE;
103-
} else if (type == "LiveAudio") {
103+
else if (type == "LiveAudio")
104104
return LIVE_AUDIO;
105-
} else if (type == "LiveVideo") {
105+
else if (type == "LiveVideo")
106106
return LIVE_VIDEO;
107-
} else if (type == "Movie") {
107+
else if (type == "Movie")
108108
return MOVIE;
109-
}
110109

111110
return MEDIUM;
112111
}

impl/ocean/media/SoundMedium.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,21 @@ bool SoundMedium::SortableSoundType::operator<(const SortableSoundType& right) c
3636
int leftDifference = abs(int(preferableSoundType.channels()) - int(actualSoundType.channels()));
3737
int rightDifference = abs(int(preferableSoundType.channels()) - int(right.actualSoundType.channels()));
3838

39-
if (leftDifference < rightDifference) {
39+
if (leftDifference < rightDifference)
4040
return true;
41-
}
42-
if (rightDifference < leftDifference) {
41+
if (rightDifference < leftDifference)
4342
return false;
44-
}
4543
}
4644

4745
if (preferableSoundType.frequency() != 0)
4846
{
4947
SoundFrequency leftDifference = NumericT<SoundFrequency>::abs(preferableSoundType.frequency() - actualSoundType.frequency());
5048
SoundFrequency rightDifference = NumericT<SoundFrequency>::abs(preferableSoundType.frequency() - right.actualSoundType.frequency());
5149

52-
if (leftDifference < rightDifference) {
50+
if (leftDifference < rightDifference)
5351
return true;
54-
}
55-
if (rightDifference < leftDifference) {
52+
if (rightDifference < leftDifference)
5653
return false;
57-
}
5854
}
5955

6056
return false;
@@ -78,9 +74,8 @@ bool SoundMedium::setPreferredSoundChannels(const unsigned int channels)
7874

7975
bool SoundMedium::setPreferredSoundFrequency(const SoundFrequency frequency)
8076
{
81-
if (frequency < 0 || frequency > 1000000) {
77+
if (frequency < 0 || frequency > 1000000)
8278
return false;
83-
}
8479

8580
mediumPreferredSoundType.setFrequency(frequency);
8681
return true;

impl/ocean/media/SoundMedium.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -337,19 +337,15 @@ inline bool SoundMedium::SoundType::operator==(const SoundType& right) const
337337

338338
inline bool SoundMedium::SoundType::operator<(const SoundType& right) const
339339
{
340-
if (typeChannels < right.typeChannels) {
340+
if (typeChannels < right.typeChannels)
341341
return true;
342-
}
343-
if (typeChannels > right.typeChannels) {
342+
if (typeChannels > right.typeChannels)
344343
return false;
345-
}
346344

347-
if (typeFrequency < right.typeFrequency) {
345+
if (typeFrequency < right.typeFrequency)
348346
return true;
349-
}
350-
if (typeFrequency > right.typeFrequency) {
347+
if (typeFrequency > right.typeFrequency)
351348
return false;
352-
}
353349

354350
return typeBitsPerSample < right.typeBitsPerSample;
355351
}

impl/ocean/media/Utilities.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,13 @@ bool Utilities::decodeFrame(const uint8_t*& data, size_t& size, Frame& frame)
117117
{
118118
static_assert(sizeof(unsigned long long) == 8, "Invalid data type!");
119119

120-
if (size < 16) {
120+
if (size < 16)
121121
return false;
122-
}
123122

124123
const size_t bytesType = size_t(((unsigned long long*)data)[0]);
125124

126-
if (bytesType > size - 16) {
125+
if (bytesType > size - 16)
127126
return false;
128-
}
129127

130128
std::string frameType((char*)data + 8, bytesType);
131129

impl/ocean/media/openimagelibraries/OILImageSequenceRecorder.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ bool OILImageSequenceRecorder::setMode(const RecorderMode mode)
6969
{
7070
const ScopedLock scopedLock(recorderLock);
7171

72-
if (isRecording_) {
72+
if (isRecording_)
7373
return false;
74-
}
7574

7675
return ImageSequenceRecorder::setMode(mode);
7776
}
@@ -123,13 +122,11 @@ bool OILImageSequenceRecorder::start()
123122
{
124123
const ScopedLock scopedLock(recorderLock);
125124

126-
if (isRecording_) {
125+
if (isRecording_)
127126
return true;
128-
}
129127

130-
if (recorderFilename.empty()) {
128+
if (recorderFilename.empty())
131129
return false;
132-
}
133130

134131
frameCounter_ = 0u;
135132
while (!frameQueue_.empty())
@@ -152,9 +149,8 @@ bool OILImageSequenceRecorder::stop()
152149
{
153150
const ScopedLock scopedLock(recorderLock);
154151

155-
if (!isRecording_) {
152+
if (!isRecording_)
156153
return true;
157-
}
158154

159155
isRecording_ = false;
160156
return true;

impl/ocean/media/openimagelibraries/OILLibrary.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,14 @@ MediumRef OILLibrary::newMedium(const std::string& url, const Medium::Type type,
5959
{
6060
const ScopedLock scopedLock(lock);
6161

62-
if (type == Medium::BUFFER_IMAGE) {
62+
if (type == Medium::BUFFER_IMAGE)
6363
return newBufferImage(url, useExclusive);
64-
}
6564

66-
if (type == Medium::IMAGE_SEQUENCE) {
65+
if (type == Medium::IMAGE_SEQUENCE)
6766
return newImageSequence(url, useExclusive);
68-
}
6967

70-
if (type == Medium::IMAGE || type == Medium::FRAME_MEDIUM) {
68+
if (type == Medium::IMAGE || type == Medium::FRAME_MEDIUM)
7169
return newImage(url, useExclusive);
72-
}
7370

7471
return MediumRef();
7572
}

0 commit comments

Comments
 (0)