Skip to content

Commit

Permalink
style: fixed initializer formatting
Browse files Browse the repository at this point in the history
Former-commit-id: 0007803 [formerly a7adf63]
Former-commit-id: a934b07
  • Loading branch information
ronag committed Feb 4, 2018
1 parent e691f1d commit ebd8041
Show file tree
Hide file tree
Showing 44 changed files with 301 additions and 87 deletions.
6 changes: 3 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ BraceWrapping:
BreakBeforeBinaryOperators: None
BreakBeforeInheritanceComma: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 160
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
Expand Down
10 changes: 8 additions & 2 deletions accelerator/accelerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ struct accelerator::impl
std::mutex mutex_;
std::shared_ptr<ogl::device> ogl_device_;

impl(const std::wstring& path) : path_(path) {}
impl(const std::wstring& path)
: path_(path)
{
}

std::unique_ptr<core::image_mixer> create_image_mixer(int channel_id)
{
Expand All @@ -43,7 +46,10 @@ struct accelerator::impl
}
};

accelerator::accelerator(const std::wstring& path) : impl_(std::make_unique<impl>(path)) {}
accelerator::accelerator(const std::wstring& path)
: impl_(std::make_unique<impl>(path))
{
}

accelerator::~accelerator() {}

Expand Down
8 changes: 6 additions & 2 deletions accelerator/cpu/image/image_mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ struct image_mixer::impl : boost::noncopyable
std::vector<core::image_transform> transform_stack_;
std::vector<item> items_; // layer/stream/items
public:
impl(int channel_id) : transform_stack_(1)
impl(int channel_id)
: transform_stack_(1)
{
CASPAR_LOG(info) << L"Initialized Streaming SIMD Extensions Accelerated CPU Image Mixer for channel " << channel_id;
}
Expand Down Expand Up @@ -377,7 +378,10 @@ struct image_mixer::impl : boost::noncopyable
}
};

image_mixer::image_mixer(int channel_id) : impl_(std::make_unique<impl>(channel_id)) {}
image_mixer::image_mixer(int channel_id)
: impl_(std::make_unique<impl>(channel_id))
{
}
image_mixer::~image_mixer() {}
void image_mixer::push(const core::frame_transform& transform) { impl_->push(transform); }
void image_mixer::visit(const core::const_frame& frame) { impl_->visit(frame); }
Expand Down
11 changes: 9 additions & 2 deletions accelerator/ogl/image/image_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ struct image_kernel::impl
spl::shared_ptr<device> ogl_;
spl::shared_ptr<shader> shader_;

impl(const spl::shared_ptr<device>& ogl) : ogl_(ogl), shader_(ogl_->dispatch_sync([&] { return get_image_shader(ogl); })) {}
impl(const spl::shared_ptr<device>& ogl)
: ogl_(ogl)
, shader_(ogl_->dispatch_sync([&] { return get_image_shader(ogl); }))
{
}

void draw(draw_params params)
{
Expand Down Expand Up @@ -432,7 +436,10 @@ struct image_kernel::impl
}
};

image_kernel::image_kernel(const spl::shared_ptr<device>& ogl) : impl_(new impl(ogl)) {}
image_kernel::image_kernel(const spl::shared_ptr<device>& ogl)
: impl_(new impl(ogl))
{
}
image_kernel::~image_kernel() {}
void image_kernel::draw(const draw_params& params) { impl_->draw(params); }

Expand Down
21 changes: 17 additions & 4 deletions accelerator/ogl/image/image_mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ struct layer
std::vector<item> items;
core::blend_mode blend_mode;

layer(core::blend_mode blend_mode) : blend_mode(blend_mode) {}
layer(core::blend_mode blend_mode)
: blend_mode(blend_mode)
{
}
};

class image_renderer
Expand All @@ -71,7 +74,11 @@ class image_renderer
image_kernel kernel_;

public:
image_renderer(const spl::shared_ptr<device>& ogl) : ogl_(ogl), kernel_(ogl_) {}
image_renderer(const spl::shared_ptr<device>& ogl)
: ogl_(ogl)
, kernel_(ogl_)
{
}

std::future<array<const std::uint8_t>> operator()(std::vector<layer> layers, const core::video_format_desc& format_desc)
{
Expand Down Expand Up @@ -214,7 +221,10 @@ struct image_mixer::impl : public core::frame_factory
std::vector<layer*> layer_stack_;

public:
impl(const spl::shared_ptr<device>& ogl, int channel_id) : ogl_(ogl), renderer_(ogl), transform_stack_(1)
impl(const spl::shared_ptr<device>& ogl, int channel_id)
: ogl_(ogl)
, renderer_(ogl)
, transform_stack_(1)
{
CASPAR_LOG(info) << L"Initialized OpenGL Accelerated GPU Image Mixer for channel " << channel_id;
}
Expand Down Expand Up @@ -280,7 +290,10 @@ struct image_mixer::impl : public core::frame_factory
}
};

image_mixer::image_mixer(const spl::shared_ptr<device>& ogl, int channel_id) : impl_(std::make_unique<impl>(ogl, channel_id)) {}
image_mixer::image_mixer(const spl::shared_ptr<device>& ogl, int channel_id)
: impl_(std::make_unique<impl>(ogl, channel_id))
{
}
image_mixer::~image_mixer() {}
void image_mixer::push(const core::frame_transform& transform) { impl_->push(transform); }
void image_mixer::visit(const core::const_frame& frame) { impl_->visit(frame); }
Expand Down
10 changes: 8 additions & 2 deletions accelerator/ogl/util/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ struct buffer::impl : boost::noncopyable
void unbind() { GL(glBindBuffer(target_, 0)); }
};

buffer::buffer(int size, bool write) : impl_(new impl(size, write)) {}
buffer::buffer(buffer&& other) : impl_(std::move(other.impl_)) {}
buffer::buffer(int size, bool write)
: impl_(new impl(size, write))
{
}
buffer::buffer(buffer&& other)
: impl_(std::move(other.impl_))
{
}
buffer::~buffer() {}
buffer& buffer::operator=(buffer&& other)
{
Expand Down
8 changes: 6 additions & 2 deletions accelerator/ogl/util/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ struct device::impl : public std::enable_shared_from_this<impl>
std::thread thread_;

impl()
: work_(make_work_guard(service_)), thread_([&] {
: work_(make_work_guard(service_))
, thread_([&] {
set_thread_name(L"OpenGL Device");
service_.run();
})
Expand Down Expand Up @@ -270,7 +271,10 @@ struct device::impl : public std::enable_shared_from_this<impl>
}
};

device::device() : impl_(new impl()) {}
device::device()
: impl_(new impl())
{
}
device::~device() {}
std::shared_ptr<texture> device::create_texture(int width, int height, int stride) { return impl_->create_texture(width, height, stride, true); }
array<uint8_t> device::create_array(int size) { return impl_->create_array(size); }
Expand Down
8 changes: 6 additions & 2 deletions accelerator/ogl/util/shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ struct shader::impl : boost::noncopyable
std::unordered_map<std::string, GLint> locations_;

public:
impl(const std::string& vertex_source_str, const std::string& fragment_source_str) : program_(0)
impl(const std::string& vertex_source_str, const std::string& fragment_source_str)
: program_(0)
{
GLint success;

Expand Down Expand Up @@ -120,7 +121,10 @@ struct shader::impl : boost::noncopyable
void use() { GL(glUseProgramObjectARB(program_)); }
};

shader::shader(const std::string& vertex_source_str, const std::string& fragment_source_str) : impl_(new impl(vertex_source_str, fragment_source_str)) {}
shader::shader(const std::string& vertex_source_str, const std::string& fragment_source_str)
: impl_(new impl(vertex_source_str, fragment_source_str))
{
}
shader::~shader() {}
void shader::set(const std::string& name, bool value) { impl_->set(name, value); }
void shader::set(const std::string& name, int value) { impl_->set(name, value); }
Expand Down
15 changes: 12 additions & 3 deletions accelerator/ogl/util/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ struct texture::impl : boost::noncopyable
GLsizei stride_ = 0;

public:
impl(int width, int height, int stride) : width_(width), height_(height), stride_(stride)
impl(int width, int height, int stride)
: width_(width)
, height_(height)
, stride_(stride)
{
GL(glCreateTextures(GL_TEXTURE_2D, 1, &id_));
GL(glTextureParameteri(id_, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
Expand Down Expand Up @@ -81,8 +84,14 @@ struct texture::impl : boost::noncopyable
}
};

texture::texture(int width, int height, int stride) : impl_(new impl(width, height, stride)) {}
texture::texture(texture&& other) : impl_(std::move(other.impl_)) {}
texture::texture(int width, int height, int stride)
: impl_(new impl(width, height, stride))
{
}
texture::texture(texture&& other)
: impl_(std::move(other.impl_))
{
}
texture::~texture() {}
texture& texture::operator=(texture&& other)
{
Expand Down
5 changes: 4 additions & 1 deletion common/diagnostics/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ struct graph::impl
impl& operator=(impl&);
};

graph::graph() : impl_(new impl) {}
graph::graph()
: impl_(new impl)
{
}

void graph::set_text(const std::wstring& value) { impl_->set_text(value); }
void graph::set_value(const std::string& name, double value) { impl_->set_value(name, value); }
Expand Down
5 changes: 4 additions & 1 deletion common/os/linux/prec_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ using namespace boost::chrono;

namespace caspar {

prec_timer::prec_timer() : time_(0) {}
prec_timer::prec_timer()
: time_(0)
{
}

void prec_timer::tick_nanos(int64_t ticks_to_wait)
{
Expand Down
5 changes: 4 additions & 1 deletion common/os/windows/prec_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ using namespace boost::chrono;

namespace caspar {

prec_timer::prec_timer() : time_(0) {}
prec_timer::prec_timer()
: time_(0)
{
}

void prec_timer::tick_nanos(int64_t ticks_to_wait)
{
Expand Down
6 changes: 5 additions & 1 deletion common/tweener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,11 @@ tweener_t get_tweener(std::wstring name)
return [=](double t, double b, double c, double d) { return tween(t, b, c, d, params); };
};

tweener::tweener(const std::wstring& name) : func_(get_tweener(name)), name_(name) {}
tweener::tweener(const std::wstring& name)
: func_(get_tweener(name))
, name_(name)
{
}

double tweener::operator()(double t, double b, double c, double d) const { return func_(t, b, c, d); }

Expand Down
16 changes: 12 additions & 4 deletions modules/decklink/consumer/decklink_consumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ class decklink_frame : public IDeckLinkVideoFrame

public:
decklink_frame(core::const_frame frame, const core::video_format_desc& format_desc, bool key_only)
: frame_(frame), format_desc_(format_desc), key_only_(key_only), data_(scalable_aligned_malloc(format_desc_.size, 64))
: frame_(frame)
, format_desc_(format_desc)
, key_only_(key_only)
, data_(scalable_aligned_malloc(format_desc_.size, 64))
{
ref_count_ = 0;
}
Expand Down Expand Up @@ -208,7 +211,8 @@ struct key_video_context
com_iface_ptr<Configuration> configuration_ = iface_cast<Configuration>(decklink_);
std::atomic<int64_t> scheduled_frames_completed_;

key_video_context(const configuration& config, const std::wstring& print) : config_(config)
key_video_context(const configuration& config, const std::wstring& print)
: config_(config)
{
scheduled_frames_completed_ = 0;

Expand Down Expand Up @@ -297,7 +301,10 @@ struct decklink_consumer

public:
decklink_consumer(const configuration& config, const core::video_format_desc& format_desc, int channel_index)
: channel_index_(channel_index), config_(config), format_desc_(format_desc), executor_(L"decklink")
: channel_index_(channel_index)
, config_(config)
, format_desc_(format_desc)
, executor_(L"decklink")
{
is_running_ = true;
scheduled_frames_completed_ = 0;
Expand Down Expand Up @@ -531,7 +538,8 @@ struct decklink_consumer_proxy : public core::frame_consumer

public:
decklink_consumer_proxy(const configuration& config)
: config_(config), executor_(L"decklink_consumer[" + boost::lexical_cast<std::wstring>(config.device_index) + L"]")
: config_(config)
, executor_(L"decklink_consumer[" + boost::lexical_cast<std::wstring>(config.device_index) + L"]")
{
auto ctx = core::diagnostics::call_context::for_thread();
executor_.begin_invoke([=] {
Expand Down
7 changes: 5 additions & 2 deletions modules/decklink/producer/decklink_producer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ class decklink_producer
int device_index,
const spl::shared_ptr<core::frame_factory>& frame_factory,
const std::wstring& filter)
: device_index_(device_index), format_desc_(format_desc), frame_factory_(frame_factory)
: device_index_(device_index)
, format_desc_(format_desc)
, frame_factory_(frame_factory)
{
frame_buffer_.set_capacity(4);

Expand Down Expand Up @@ -329,7 +331,8 @@ class decklink_producer_proxy : public core::frame_producer_base
int device_index,
const std::wstring& filter_str,
uint32_t length)
: executor_(L"decklink_producer[" + boost::lexical_cast<std::wstring>(device_index) + L"]"), length_(length)
: executor_(L"decklink_producer[" + boost::lexical_cast<std::wstring>(device_index) + L"]")
, length_(length)
{
auto ctx = core::diagnostics::call_context::for_thread();
executor_.invoke([=] {
Expand Down
4 changes: 3 additions & 1 deletion modules/ffmpeg/consumer/ffmpeg_consumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ struct ffmpeg_consumer : public core::frame_consumer

public:
ffmpeg_consumer(std::string path, std::string args)
: path_(std::move(path)), args_(std::move(args)), channel_index_([&] {
: path_(std::move(path))
, args_(std::move(args))
, channel_index_([&] {
boost::crc_16_type result;
result.process_bytes(path.data(), path.length());
return result.checksum();
Expand Down
6 changes: 4 additions & 2 deletions modules/ffmpeg/producer/av_producer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ struct Stream
std::atomic<bool> abort_request_ = false;
std::thread thread_;

Stream(AVStream* stream) : next_pts_(stream->start_time)
Stream(AVStream* stream)
: next_pts_(stream->start_time)
{
const auto codec = avcodec_find_decoder(stream->codecpar->codec_id);
if (!codec) {
Expand Down Expand Up @@ -256,7 +257,8 @@ struct Input
std::atomic<bool> abort_request_ = false;
std::thread thread_;

Input(const std::string& filename, std::shared_ptr<diagnostics::graph> graph) : graph_(graph)
Input(const std::string& filename, std::shared_ptr<diagnostics::graph> graph)
: graph_(graph)
{
graph_->set_color("seek", diagnostics::color(1.0f, 0.5f, 0.0f));
graph_->set_color("input", diagnostics::color(0.7f, 0.4f, 0.4f));
Expand Down
3 changes: 2 additions & 1 deletion modules/flash/flash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class flash_cg_proxy

public:
explicit flash_cg_proxy(const spl::shared_ptr<core::frame_producer>& producer, std::wstring base_folder = env::template_folder())
: flash_producer_(producer), base_folder_(base_folder)
: flash_producer_(producer)
, base_folder_(base_folder)
{
}

Expand Down
Loading

0 comments on commit ebd8041

Please sign in to comment.