From 5cd56af350f58339e6fe83a7d034353dfc034922 Mon Sep 17 00:00:00 2001 From: Konstantin Vukolov Date: Sat, 17 Jan 2026 01:46:52 +0300 Subject: [PATCH] Fix format --- lib/OpdsParser/OpdsParser.cpp | 20 +++++++------- lib/OpdsParser/OpdsParser.h | 2 +- lib/OpdsParser/OpdsStream.cpp | 27 +++++++------------ lib/OpdsParser/OpdsStream.h | 26 +++++++++--------- .../browser/OpdsBookBrowserActivity.cpp | 18 ++++++------- src/network/HttpDownloader.cpp | 3 +-- 6 files changed, 41 insertions(+), 55 deletions(-) diff --git a/lib/OpdsParser/OpdsParser.cpp b/lib/OpdsParser/OpdsParser.cpp index 77a1c05..c95d295 100644 --- a/lib/OpdsParser/OpdsParser.cpp +++ b/lib/OpdsParser/OpdsParser.cpp @@ -23,9 +23,9 @@ OpdsParser::~OpdsParser() { } void OpdsParser::push(const char* xmlData, const size_t length) { - if (errorOccured) { - return; - } + if (errorOccured) { + return; + } XML_SetUserData(parser, this); XML_SetElementHandler(parser, startElement, endElement); @@ -64,16 +64,14 @@ void OpdsParser::push(const char* xmlData, const size_t length) { } void OpdsParser::finish() { - if (XML_Parse(parser, nullptr, 0, XML_TRUE) != XML_STATUS_OK) { - errorOccured = true; - XML_ParserFree(parser); - parser = nullptr; - } + if (XML_Parse(parser, nullptr, 0, XML_TRUE) != XML_STATUS_OK) { + errorOccured = true; + XML_ParserFree(parser); + parser = nullptr; + } } -bool OpdsParser::error() const { - return errorOccured; -} +bool OpdsParser::error() const { return errorOccured; } void OpdsParser::clear() { entries.clear(); diff --git a/lib/OpdsParser/OpdsParser.h b/lib/OpdsParser/OpdsParser.h index 93d310a..5d50836 100644 --- a/lib/OpdsParser/OpdsParser.h +++ b/lib/OpdsParser/OpdsParser.h @@ -59,7 +59,7 @@ class OpdsParser { * Get the parsed entries (both navigation and book entries). * @return Vector of OpdsEntry entries */ - const std::vector& getEntries() const & { return entries; } + const std::vector& getEntries() const& { return entries; } std::vector getEntries() && { return std::move(entries); } /** diff --git a/lib/OpdsParser/OpdsStream.cpp b/lib/OpdsParser/OpdsStream.cpp index d23405f..68a2676 100644 --- a/lib/OpdsParser/OpdsStream.cpp +++ b/lib/OpdsParser/OpdsStream.cpp @@ -2,29 +2,20 @@ OpdsParserStream::OpdsParserStream(OpdsParser& parser) : parser(parser) {} +int OpdsParserStream::available() { return 0; } -int OpdsParserStream::available() { - return 0; -} +int OpdsParserStream::peek() { abort(); } -int OpdsParserStream::peek() { - abort(); -} - -int OpdsParserStream::read() { - abort(); -} +int OpdsParserStream::read() { abort(); } size_t OpdsParserStream::write(uint8_t c) { - parser.push(reinterpret_cast(&c), 1); - return 1; + parser.push(reinterpret_cast(&c), 1); + return 1; } -size_t OpdsParserStream::write(const uint8_t *buffer, size_t size) { - parser.push(reinterpret_cast(buffer), size); - return size; +size_t OpdsParserStream::write(const uint8_t* buffer, size_t size) { + parser.push(reinterpret_cast(buffer), size); + return size; } -OpdsParserStream::~OpdsParserStream() { - parser.finish(); -} +OpdsParserStream::~OpdsParserStream() { parser.finish(); } diff --git a/lib/OpdsParser/OpdsStream.h b/lib/OpdsParser/OpdsStream.h index 2b234e3..c72f2b6 100644 --- a/lib/OpdsParser/OpdsStream.h +++ b/lib/OpdsParser/OpdsStream.h @@ -1,23 +1,23 @@ #pragma once -#include "OpdsParser.h" - #include +#include "OpdsParser.h" + class OpdsParserStream : public Stream { -public: - explicit OpdsParserStream(OpdsParser& parser); + public: + explicit OpdsParserStream(OpdsParser& parser); - // That functions are not implimented for that stream - int available() override; - int peek() override; - int read() override; + // That functions are not implimented for that stream + int available() override; + int peek() override; + int read() override; - virtual size_t write(uint8_t c) override; - virtual size_t write(const uint8_t *buffer, size_t size) override; + virtual size_t write(uint8_t c) override; + virtual size_t write(const uint8_t* buffer, size_t size) override; - ~OpdsParserStream() override; + ~OpdsParserStream() override; -private: - OpdsParser& parser; + private: + OpdsParser& parser; }; diff --git a/src/activities/browser/OpdsBookBrowserActivity.cpp b/src/activities/browser/OpdsBookBrowserActivity.cpp index 4a33baf..104eaac 100644 --- a/src/activities/browser/OpdsBookBrowserActivity.cpp +++ b/src/activities/browser/OpdsBookBrowserActivity.cpp @@ -2,9 +2,8 @@ #include #include -#include - #include +#include #include "CrossPointSettings.h" #include "MappedInputManager.h" @@ -269,16 +268,15 @@ void OpdsBookBrowserActivity::fetchFeed(const std::string& path) { OpdsParser parser; { - OpdsParserStream stream{parser}; - if (!HttpDownloader::fetchUrl(url, stream)) { - state = BrowserState::ERROR; - errorMessage = "Failed to fetch feed"; - updateRequired = true; - return; - } + OpdsParserStream stream{parser}; + if (!HttpDownloader::fetchUrl(url, stream)) { + state = BrowserState::ERROR; + errorMessage = "Failed to fetch feed"; + updateRequired = true; + return; + } } - if (parser.error()) { state = BrowserState::ERROR; errorMessage = "Failed to parse feed"; diff --git a/src/network/HttpDownloader.cpp b/src/network/HttpDownloader.cpp index 9382697..fe65ea6 100644 --- a/src/network/HttpDownloader.cpp +++ b/src/network/HttpDownloader.cpp @@ -2,11 +2,10 @@ #include #include +#include #include #include -#include - #include #include "util/UrlUtils.h"