Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor compiler diagnostics and deprecations #1270

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ qt_add_executable(sioyek WIN32 MACOSX_BUNDLE
pdf_viewer/utils.cpp pdf_viewer/utils.h
)

target_compile_options(sioyek PRIVATE -Wno-inconsistent-missing-override)

target_include_directories(sioyek PRIVATE
pdf_viewer
${SQLite3_INCLUDE_DIRS}
Expand Down
4 changes: 2 additions & 2 deletions pdf_viewer/database.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "database.h";
#include "database.h"
#include <sstream>
#include <cassert>
#include <utility>
Expand Down Expand Up @@ -1880,7 +1880,7 @@ std::wstring encode_variant(QVariant var) {


std::vector<QString> specials = { "CURRENT_TIMESTAMP", "datetime('now')" };
if ((var.type() == QVariant::String) || (var.type() == QVariant::Char)) {
if ((var.typeId() == QMetaType::QString) || (var.typeId() == QMetaType::Char)) {
if (std::find(specials.begin(), specials.end(), var.toString()) != specials.end()) {
return var.toString().toStdWString();
}
Expand Down
10 changes: 5 additions & 5 deletions pdf_viewer/document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ std::optional<std::pair<std::wstring, std::wstring>> Document::get_generic_link_
std::pair<int,
int>* out_range) {

std::wregex regex(L"[a-zA-Z]{3,}(\.){0,1}[ \t]+[0-9]+(\.[0-9]+)*");
std::wregex regex(L"[a-zA-Z]{3,}(\\.){0,1}[ \t]+[0-9]+(\\.[0-9]+)*");
std::optional<std::wstring> match_string = get_regex_match_at_position(regex, flat_chars, position, out_range);
if (match_string) {
std::vector<std::wstring> parts = split_whitespace(match_string.value());
Expand Down Expand Up @@ -1985,7 +1985,7 @@ void Document::get_text_selection(fz_context* ctx, AbsoluteDocumentPos selection
selected_text.push_back(current_char->c);
selected_characters.push_back(to_absolute(i, current_char->quad));
}
if ((current_char->next == nullptr)) {
if (current_char->next == nullptr) {
if (current_char->c != '-')
{
selected_text.push_back(' ');
Expand Down Expand Up @@ -2843,7 +2843,7 @@ const std::vector<AbsoluteRect>& Document::get_page_lines(
}
else {
fz_pixmap* pixmap = get_small_pixmap(page);
if (pixmap == nullptr) return {};
if (pixmap == nullptr) return std::vector<AbsoluteRect>();
std::vector<unsigned int> hist = get_max_width_histogram_from_pixmap(pixmap);
std::vector<unsigned int> line_locations;
std::vector<unsigned int> line_locations_begins;
Expand Down Expand Up @@ -4040,7 +4040,7 @@ std::optional<DocumentPos> Document::find_abbreviation(std::wstring abbr, std::v

int Document::find_reference_page_with_reference_text(std::wstring ref) {

QStringList parts = QString::fromStdWString(ref).split(QRegularExpression("[ \w\(\);,]"));
QStringList parts = QString::fromStdWString(ref).split(QRegularExpression("[ \\w\\(\\);,]"));
QString largest_part = "";
for (int i = 0; i < parts.size(); i++) {
if (parts.at(i).size() > largest_part.size() ) {
Expand Down Expand Up @@ -4250,7 +4250,7 @@ int Document::get_page_text_and_line_rects_after_rect(int page_number,
line_rects.push_back(line->bbox);
char_rects.push_back(fz_rect_from_quad(chr->quad));

if ((chr->next == nullptr)) {
if (chr->next == nullptr) {
text.push_back(' ');

line_rects.push_back(line->bbox);
Expand Down
4 changes: 3 additions & 1 deletion pdf_viewer/document_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ NormalizedWindowPos DocumentView::document_to_window_pos(DocumentPos doc_pos) {
float window_y = static_cast<float>((window_pos.y - halfheight) / halfheight);
return { window_x, -window_y };
}

return { 0, 0 };
}

WindowPos DocumentView::absolute_to_window_pos_in_pixels(AbsoluteDocumentPos abspos) {
Expand Down Expand Up @@ -1337,7 +1339,7 @@ std::vector<SmartViewCandidate> DocumentView::find_line_definitions() {
return result;
}

std::wstring item_regex(L"[a-zA-Z]{2,}\\.?[ \t]+[0-9]+(\.[0-9]+)*");
std::wstring item_regex(L"[a-zA-Z]{2,}\\.?[ \t]+[0-9]+(\\.?[0-9]+)*");
std::wstring reference_regex(L"\\[[a-zA-Z0-9, ]+\\]");
std::wstring equation_regex(L"\\([0-9]+(\\.[0-9]+)*\\)");

Expand Down
Loading
Loading