From 0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Thu, 14 May 2020 16:41:43 +0200
Subject: Style: Enforce braces around if blocks and loops

Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
---
 .../gdnative/videodecoder/video_stream_gdnative.cpp    | 18 ++++++++++++------
 modules/gdnative/videodecoder/video_stream_gdnative.h  |  3 ++-
 2 files changed, 14 insertions(+), 7 deletions(-)

(limited to 'modules/gdnative/videodecoder')

diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
index 476f44b185..9d9c5b6473 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
@@ -208,10 +208,12 @@ VideoStreamPlaybackGDNative::~VideoStreamPlaybackGDNative() {
 }
 
 void VideoStreamPlaybackGDNative::cleanup() {
-	if (data_struct)
+	if (data_struct) {
 		interface->destructor(data_struct);
-	if (pcm)
+	}
+	if (pcm) {
 		memfree(pcm);
+	}
 	pcm = nullptr;
 	time = 0;
 	num_channels = -1;
@@ -257,8 +259,9 @@ void VideoStreamPlaybackGDNative::stop() {
 void VideoStreamPlaybackGDNative::seek(float p_time) {
 	ERR_FAIL_COND(interface == nullptr);
 	interface->seek(data_struct, p_time);
-	if (p_time < time)
+	if (p_time < time) {
 		seek_backward = true;
+	}
 	time = p_time;
 	// reset audio buffers
 	memset(pcm, 0, num_channels * AUX_BUFFER_SIZE * sizeof(float));
@@ -320,12 +323,14 @@ int VideoStreamPlaybackGDNative::get_mix_rate() const {
 Ref<VideoStreamPlayback> VideoStreamGDNative::instance_playback() {
 	Ref<VideoStreamPlaybackGDNative> pb = memnew(VideoStreamPlaybackGDNative);
 	VideoDecoderGDNative *decoder = decoder_server.get_decoder(file.get_extension().to_lower());
-	if (decoder == nullptr)
+	if (decoder == nullptr) {
 		return nullptr;
+	}
 	pb->set_interface(decoder->interface);
 	pb->set_audio_track(audio_track);
-	if (pb->open_file(file))
+	if (pb->open_file(file)) {
 		return pb;
+	}
 	return nullptr;
 }
 
@@ -382,7 +387,8 @@ bool ResourceFormatLoaderVideoStreamGDNative::handles_type(const String &p_type)
 
 String ResourceFormatLoaderVideoStreamGDNative::get_resource_type(const String &p_path) const {
 	String el = p_path.get_extension().to_lower();
-	if (VideoDecoderServer::get_instance()->get_extensions().has(el))
+	if (VideoDecoderServer::get_instance()->get_extensions().has(el)) {
 		return "VideoStreamGDNative";
+	}
 	return "";
 }
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h
index 2da63e96d6..53017a6a97 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.h
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.h
@@ -86,8 +86,9 @@ public:
 	}
 
 	VideoDecoderGDNative *get_decoder(const String &extension) {
-		if (extensions.size() == 0 || !extensions.has(extension))
+		if (extensions.size() == 0 || !extensions.has(extension)) {
 			return nullptr;
+		}
 		return decoders[extensions[extension]];
 	}
 
-- 
cgit v1.2.3