Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (maplibre#2192)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Mar 13, 2024
1 parent 3a836b8 commit 8bf3040
Show file tree
Hide file tree
Showing 24 changed files with 45 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
hooks:
- id: check-yaml
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
rev: v18.1.1
hooks:
- id: clang-format
files: '.*\.(hpp|cpp|h)'
Expand Down
4 changes: 2 additions & 2 deletions bin/offline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ int main(int argc, char* argv[]) {
std::cout << status.completedResourceCount << " / " << status.requiredResourceCount << " resources | "
<< status.completedTileCount << " / " << status.requiredTileCount << " tiles"
<< (status.requiredResourceCountIsPrecise ? " | " : " (indeterminate); ")
<< status.completedResourceSize << " bytes downloaded"
<< " (" << bytesPerSecond << " bytes/sec)" << std::endl;
<< status.completedResourceSize << " bytes downloaded" << " (" << bytesPerSecond << " bytes/sec)"
<< std::endl;

if (status.complete()) {
std::cout << "Finished Download" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/actor/scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Scheduler {
/// Makes a weak pointer to this Scheduler.
virtual mapbox::base::WeakPtr<Scheduler> makeWeakPtr() = 0;
/// Enqueues a function for execution on the render thread.
virtual void runOnRenderThread(std::function<void()>&&){};
virtual void runOnRenderThread(std::function<void()>&&) {};
virtual void runRenderJobs() {}

/// Returns a closure wrapping the given one.
Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/gfx/drawable_custom_layer_host_tweaker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DrawableCustomLayerHostTweaker : public gfx::DrawableTweaker {
: host(host_) {}
~DrawableCustomLayerHostTweaker() override = default;

void init(Drawable&) override{};
void init(Drawable&) override {};

void execute(Drawable&, const PaintParameters&) override;

Expand Down
2 changes: 1 addition & 1 deletion include/mbgl/map/map_observer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MapObserver {
virtual bool onCanRemoveUnusedStyleImage(const std::string&) { return true; }
// Observe this event to easily mutate or observe shaders as soon
// as the registry becomes available.
virtual void onRegisterShaders(gfx::ShaderRegistry&){};
virtual void onRegisterShaders(gfx::ShaderRegistry&) {};
};

} // namespace mbgl
2 changes: 1 addition & 1 deletion include/mbgl/renderer/renderer_observer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class RendererObserver {
virtual void onRemoveUnusedStyleImages(const std::vector<std::string>&) {}

// Entry point for custom shader registration
virtual void onRegisterShaders(gfx::ShaderRegistry&){};
virtual void onRegisterShaders(gfx::ShaderRegistry&) {};
};

} // namespace mbgl
2 changes: 1 addition & 1 deletion include/mbgl/storage/file_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class FileSource {
virtual void resume() {}

/// Generic setter method
virtual void setProperty(const std::string&, const mapbox::base::Value&){};
virtual void setProperty(const std::string&, const mapbox::base::Value&) {};
/// Generic getter method
virtual mapbox::base::Value getProperty(const std::string&) const { return {}; };

Expand Down
8 changes: 2 additions & 6 deletions include/mbgl/style/conversion_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,11 @@ Value makeValue(T&& arg) {
template <typename T>
StyleProperty makeStyleProperty(const PropertyValue<T>& value) {
return value.match([](const Undefined&) -> StyleProperty { return {}; },
[](const Color& c) -> StyleProperty {
return {makeValue(c), StyleProperty::Kind::Expression};
},
[](const Color& c) -> StyleProperty { return {makeValue(c), StyleProperty::Kind::Expression}; },
[](const PropertyExpression<T>& fn) -> StyleProperty {
return {fn.getExpression().serialize(), StyleProperty::Kind::Expression};
},
[](const auto& t) -> StyleProperty {
return {makeValue(t), StyleProperty::Kind::Constant};
});
[](const auto& t) -> StyleProperty { return {makeValue(t), StyleProperty::Kind::Constant}; });
}

inline StyleProperty makeStyleProperty(const TransitionOptions& value) {
Expand Down
8 changes: 3 additions & 5 deletions platform/default/src/mbgl/storage/main_resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ class MainResourceLoaderThread {
if (res.kind == Resource::Kind::Tile) {
// onlineResponse.data will be null if data not modified
MBGL_TIMING_FINISH(watch,
" Action: "
<< "Requesting,"
<< " URL: " << res.url.c_str() << " Size: "
<< (response.data != nullptr ? response.data->size() : 0) << "B,"
<< " Time")
" Action: " << "Requesting," << " URL: " << res.url.c_str() << " Size: "
<< (response.data != nullptr ? response.data->size() : 0) << "B,"
<< " Time")
}
callback(response);
});
Expand Down
6 changes: 2 additions & 4 deletions render-test/runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ std::string simpleDiff(const Value& result, const Value& expected) {
}

if (resultTokens[i] != expectedTokens[i]) {
diff << "<b>"
<< "-" << expectedTokens[i] << "</b>" << std::endl;
diff << "<b>"
<< "+" << resultTokens[i] << "</b>" << std::endl;
diff << "<b>" << "-" << expectedTokens[i] << "</b>" << std::endl;
diff << "<b>" << "+" << resultTokens[i] << "</b>" << std::endl;
} else {
diff << resultTokens[i] << std::endl;
}
Expand Down
14 changes: 6 additions & 8 deletions src/mbgl/gl/vertex_attribute_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,17 @@ bool VertexAttributeGL::get(const gfx::VertexAttribute::ElementType& element, GL
case GL_FLOAT:
return gl::get<float>(element, buffer) || gl::get<float, std::int32_t>(element, buffer);
case GL_FLOAT_VEC2:
return gl::get<float2>(element, buffer) || gl::get<int2, float2>(element, buffer, [](int2 x) {
return float2{(float)x[0], (float)x[1]};
});
return gl::get<float2>(element, buffer) ||
gl::get<int2, float2>(element, buffer, [](int2 x) { return float2{(float)x[0], (float)x[1]}; });
case GL_FLOAT_VEC3:
return gl::get<float3>(element, buffer);
case GL_FLOAT_VEC4:
case GL_FLOAT_MAT2:
return gl::get<float4>(element, buffer) ||
gl::get<int4, float4>(element,
buffer,
[](int4 x) {
return float4{(float)x[0], (float)x[1], (float)x[2], (float)x[3]};
}) ||
gl::get<int4, float4>(
element,
buffer,
[](int4 x) { return float4{(float)x[0], (float)x[1], (float)x[2], (float)x[3]}; }) ||
gl::get<ushort8, float4>(element, buffer, [](ushort8 x) {
return float4{(float)x[0], (float)x[1], (float)x[2], (float)x[3]};
});
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/layout/layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Layout {
bool,
const CanonicalTileID&) = 0;

virtual void prepareSymbols(const GlyphMap&, const GlyphPositions&, const ImageMap&, const ImagePositions&){};
virtual void prepareSymbols(const GlyphMap&, const GlyphPositions&, const ImageMap&, const ImagePositions&) {};

virtual bool hasSymbolInstances() const { return true; };

Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/bucket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Bucket {
const ImagePositions&,
const PatternLayerMap&,
std::size_t,
const CanonicalTileID&){};
const CanonicalTileID&) {};

virtual void update(const FeatureStates&, const GeometryTileLayer&, const std::string&, const ImagePositions&) {}

Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/layers/render_fill_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class OutlineDrawableTweaker : public gfx::DrawableTweaker {
opacity(opacity_) {}
~OutlineDrawableTweaker() override = default;

void init(gfx::Drawable&) override{};
void init(gfx::Drawable&) override {};

virtual void execute(gfx::Drawable& drawable, const PaintParameters& parameters) override {
if (!drawable.getTileID().has_value()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class RenderLocationIndicatorImpl {
}
virtual void bind() { MBGL_CHECK_ERROR(glUseProgram(program)); }
void detach() { MBGL_CHECK_ERROR(glUseProgram(0)); }
virtual void pullLocations(){};
virtual void pullLocations() {};

GLuint program = 0;
GLuint vertexShader = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/mbgl/renderer/paint_property_binder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class ConstantPaintPropertyBinder : public PaintPropertyBinder<T, T, PossiblyEva

void setPatternParameters(const std::optional<ImagePosition>&,
const std::optional<ImagePosition>&,
const CrossfadeParameters&) override{};
const CrossfadeParameters&) override {};

std::tuple<float> interpolationFactor(float) const override { return std::tuple<float>{0.0f}; }

Expand Down Expand Up @@ -272,7 +272,7 @@ class SourceFunctionPaintPropertyBinder final : public PaintPropertyBinder<T, T,

void setPatternParameters(const std::optional<ImagePosition>&,
const std::optional<ImagePosition>&,
const CrossfadeParameters&) override{};
const CrossfadeParameters&) override {};
void populateVertexVector(const GeometryTileFeature& feature,
std::size_t length,
std::size_t index,
Expand Down Expand Up @@ -391,7 +391,7 @@ class CompositeFunctionPaintPropertyBinder final

void setPatternParameters(const std::optional<ImagePosition>&,
const std::optional<ImagePosition>&,
const CrossfadeParameters&) override{};
const CrossfadeParameters&) override {};
void populateVertexVector(const GeometryTileFeature& feature,
std::size_t length,
std::size_t index,
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/render_layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class RenderLayer {
bool supportsZoom(float zoom) const;

virtual void upload(gfx::UploadPass&) {}
virtual void render(PaintParameters&){};
virtual void render(PaintParameters&) {};

// Check wether the given geometry intersects
// with the feature
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/sources/render_image_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ImageSourceRenderData final : public RenderItem {
const std::string& getName() const override { return name; }
std::string name;
#if MLN_DRAWABLE_RENDERER
void updateDebugDrawables(DebugLayerGroupMap&, PaintParameters&) const override{};
void updateDebugDrawables(DebugLayerGroupMap&, PaintParameters&) const override {};
#endif
mutable std::optional<gfx::Texture> debugTexture;
};
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/sources/render_tile_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void TileSourceRenderItem::updateDebugDrawables(DebugLayerGroupMap& debugLayerGr
: linePropertiesUBO(properties) {}
~PolylineDrawableTweaker() override = default;

void init(gfx::Drawable&) override{};
void init(gfx::Drawable&) override {};

void execute(gfx::Drawable& drawable, const PaintParameters& parameters) override {
if (!drawable.getTileID().has_value()) {
Expand Down
5 changes: 2 additions & 3 deletions src/mbgl/style/conversion/constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ std::optional<T> Converter<T, typename std::enable_if_t<std::is_enum_v<T>>>::ope
}

template <class T>
auto Converter<std::vector<T>, typename std::enable_if_t<std::is_enum_v<T>>>::operator()(const Convertible& value,
Error& error) const
-> std::optional<std::vector<T>> {
auto Converter<std::vector<T>, typename std::enable_if_t<std::is_enum_v<T>>>::operator()(
const Convertible& value, Error& error) const -> std::optional<std::vector<T>> {
if (!isArray(value)) {
error.message = "value must be an array";
return std::nullopt;
Expand Down
6 changes: 2 additions & 4 deletions src/mbgl/style/conversion/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ bool hasTokens(const std::string& source) {
while (pos != end) {
auto brace = std::find(pos, end, '{');
if (brace == end) return false;
for (brace++; brace != end && tokenReservedChars.find(*brace) == std::string::npos; brace++)
;
for (brace++; brace != end && tokenReservedChars.find(*brace) == std::string::npos; brace++);
if (brace != end && *brace == '}') {
return true;
}
Expand Down Expand Up @@ -65,8 +64,7 @@ std::unique_ptr<Expression> convertTokenStringToExpression(const std::string& so
}
pos = brace;
if (pos != end) {
for (brace++; brace != end && tokenReservedChars.find(*brace) == std::string::npos; brace++)
;
for (brace++; brace != end && tokenReservedChars.find(*brace) == std::string::npos; brace++);
if (brace != end && *brace == '}') {
inputs.push_back(get(literal(std::string(pos + 1, brace))));
pos = brace + 1;
Expand Down
6 changes: 3 additions & 3 deletions src/mbgl/style/layers/custom_drawable_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class LineDrawableTweaker : public gfx::DrawableTweaker {
: linePropertiesUBO(properties) {}
~LineDrawableTweaker() override = default;

void init(gfx::Drawable&) override{};
void init(gfx::Drawable&) override {};

void execute(gfx::Drawable& drawable, const PaintParameters& parameters) override {
if (!drawable.getTileID().has_value()) {
Expand Down Expand Up @@ -136,7 +136,7 @@ class FillDrawableTweaker : public gfx::DrawableTweaker {
opacity(opacity_) {}
~FillDrawableTweaker() override = default;

void init(gfx::Drawable&) override{};
void init(gfx::Drawable&) override {};

void execute(gfx::Drawable& drawable, const PaintParameters& parameters) override {
if (!drawable.getTileID().has_value()) {
Expand Down Expand Up @@ -183,7 +183,7 @@ class SymbolDrawableTweaker : public gfx::DrawableTweaker {
: options(options_) {}
~SymbolDrawableTweaker() override = default;

void init(gfx::Drawable&) override{};
void init(gfx::Drawable&) override {};

void execute(gfx::Drawable& drawable, const PaintParameters& parameters) override {
if (!drawable.getTileID().has_value()) {
Expand Down
14 changes: 6 additions & 8 deletions src/mbgl/tile/geometry_tile_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,9 @@ void GeometryTileWorker::parse() {
requestNewImages(imageDependencies);

MBGL_TIMING_FINISH(watch,
" Action: "
<< "Parsing,"
<< " SourceID: " << sourceID.c_str() << " Canonical: " << static_cast<int>(id.canonical.z)
<< "/" << id.canonical.x << "/" << id.canonical.y << " Time");
" Action: " << "Parsing," << " SourceID: " << sourceID.c_str()
<< " Canonical: " << static_cast<int>(id.canonical.z) << "/" << id.canonical.x << "/"
<< id.canonical.y << " Time");
finalizeLayout();
}

Expand Down Expand Up @@ -493,10 +492,9 @@ void GeometryTileWorker::finalizeLayout() {
firstLoad = false;

MBGL_TIMING_FINISH(watch,
" Action: "
<< "SymbolLayout,"
<< " SourceID: " << sourceID.c_str() << " Canonical: " << static_cast<int>(id.canonical.z)
<< "/" << id.canonical.x << "/" << id.canonical.y << " Time");
" Action: " << "SymbolLayout," << " SourceID: " << sourceID.c_str()
<< " Canonical: " << static_cast<int>(id.canonical.z) << "/" << id.canonical.x << "/"
<< id.canonical.y << " Time");

parent.invoke(&GeometryTile::onLayout,
std::make_shared<GeometryTile::LayoutResult>(
Expand Down
3 changes: 1 addition & 2 deletions src/mbgl/util/token.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ std::string replaceTokens(const std::string &source, const Lookup &lookup) {
result.append(pos, brace);
pos = brace;
if (pos != end) {
for (brace++; brace != end && tokenReservedChars.find(*brace) == std::string::npos; brace++)
;
for (brace++; brace != end && tokenReservedChars.find(*brace) == std::string::npos; brace++);
if (brace != end && *brace == '}') {
std::string key{pos + 1, brace};
if (std::optional<std::string> replacement = lookup(key)) {
Expand Down

0 comments on commit 8bf3040

Please sign in to comment.