diff options
author | Roland Reichwein <mail@reichwein.it> | 2023-02-12 15:56:29 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2023-02-12 15:56:29 +0100 |
commit | 5d2a6916cacdda97431c1e4c73660c3f6db615e8 (patch) | |
tree | 3ac3398ea983cdf1d046cbc4fe64c3f7f2bea9d3 | |
parent | e724452c00a56d0579ea685f90da6200993de5e0 (diff) |
-rwxr-xr-x | Makefile | 8 | ||||
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | downtube.cpp | 4 | ||||
-rw-r--r-- | file.cpp | 46 | ||||
-rw-r--r-- | file.h | 15 |
6 files changed, 15 insertions, 67 deletions
@@ -4,7 +4,7 @@ # Environment: Debian # -DISTROS=debian10 debian11 ubuntu1910 ubuntu2004 +DISTROS=debian11 VERSION=$(shell dpkg-parsechangelog --show-field Version) CXX=clang++-10 @@ -21,10 +21,10 @@ ifeq ($(shell which $(CXX)),) CXX=g++ endif -LIBS=-lfcgi -lboost_filesystem +LIBS=-lfcgi -lboost_filesystem -lreichwein -lfmt INCLUDES=-I. -CXXFLAGS=-Wall -g -O2 -fPIC -std=c++17 -Wpedantic -HEADERS=file.h +CXXFLAGS=-Wall -g -O2 -fPIC -std=c++17 -Wpedantic -gdwarf-4 +HEADERS= SOURCES=$(HEADERS:.h=.cpp) OBJECTS=$(HEADERS:.h=.o) TARGETS=downtube.fcgi diff --git a/debian/changelog b/debian/changelog index e807c44..953dacb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +downtube (1.4) UNRELEASED; urgency=medium + + * Use libreichwein + * Update build environment + + -- Roland Reichwein <mail@reichwein.it> Sun, 12 Feb 2023 15:39:31 +0100 + downtube (1.3) unstable; urgency=medium * Fix youtube-dl command line: Fix extension for ffmpeg diff --git a/debian/control b/debian/control index a523452..5942ba6 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: downtube Section: web Priority: optional Maintainer: Roland Reichwein <mail@reichwein.it> -Build-Depends: debhelper (>= 12), libboost-all-dev | libboost1.71-all-dev, clang | g++-9, node-uglify, python3-pkg-resources, htmlmin, cleancss, libfcgi-dev +Build-Depends: debhelper (>= 12), libboost-all-dev | libboost1.71-all-dev, clang | g++-9, uglifyjs, python3-pkg-resources, htmlmin, cleancss, libfcgi-dev, libreichwein-dev, libfmt-dev Standards-Version: 4.5.0 Homepage: http://www.reichwein.it/downtube/ diff --git a/downtube.cpp b/downtube.cpp index 60cfcc2..11851ed 100644 --- a/downtube.cpp +++ b/downtube.cpp @@ -16,12 +16,14 @@ #include <boost/algorithm/string/trim.hpp> #include <boost/property_tree/xml_parser.hpp> -#include "file.h" +#include "libreichwein/file.h" namespace pt = boost::property_tree; using namespace std::string_literals; namespace fs = std::filesystem; +using namespace Reichwein; + namespace { class TempDir diff --git a/file.cpp b/file.cpp deleted file mode 100644 index 47ab8be..0000000 --- a/file.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "file.h" - -#include <fstream> - -namespace fs = std::filesystem; - -using namespace std::string_literals; - -std::string File::getFile(const fs::path& filename) -{ - std::ifstream file(filename.string(), std::ios::in | std::ios::binary | std::ios::ate); - - if (file.is_open()) { - std::ifstream::pos_type fileSize = file.tellg(); - file.seekg(0, std::ios::beg); - - std::string bytes(fileSize, ' '); - file.read(reinterpret_cast<char*>(bytes.data()), fileSize); - - return bytes; - - } else { - throw std::runtime_error("Opening "s + filename.string() + " for reading"); - } -} - -void File::setFile(const fs::path& filename, const std::string& s) -{ - File::setFile(filename, s.data(), s.size()); -} - -void File::setFile(const fs::path& filename, const char* data, size_t size) -{ - std::ofstream file(filename.string(), std::ios::out | std::ios::binary); - if (file.is_open()) { - file.write(data, size); - } else { - throw std::runtime_error("Opening "s + filename.string() + " for writing"); - } -} - -void File::setFile(const fs::path& filename, const std::vector<uint8_t>& data) -{ - File::setFile(filename, reinterpret_cast<const char*>(data.data()), data.size()); -} - @@ -1,15 +0,0 @@ -#pragma once - -#include <cstdint> -#include <filesystem> -#include <string> -#include <vector> - -namespace File { - -std::string getFile(const std::filesystem::path& filename); -void setFile(const std::filesystem::path& filename, const std::string& s); -void setFile(const std::filesystem::path& filename, const char* data, size_t size); -void setFile(const std::filesystem::path& filename, const std::vector<uint8_t>& data); - -} |