-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into master_github
- Loading branch information
Showing
60 changed files
with
1,023 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
* Copyright (C) 2021, 2022, Albert Astals Cid <[email protected]> | ||
* Copyright (C) 2022, Tobias C. Berner <[email protected]> | ||
* Copyright (C) 2022, Oliver Sander <[email protected]> | ||
* Copyright (C) 2024, [email protected] | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -98,7 +99,7 @@ typedef unsigned int /* time_t */ time_type; | |
# pragma warning(push) | ||
# pragma warning(disable : 4251) /* class 'A' needs to have dll interface for to be used by clients of class 'B'. */ | ||
#endif | ||
class POPPLER_CPP_EXPORT ustring : public std::basic_string<unsigned short> | ||
class POPPLER_CPP_EXPORT ustring : public std::basic_string<char16_t> | ||
{ | ||
public: | ||
ustring(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
* Copyright (C) 2017-2019 Albert Astals Cid <[email protected]> | ||
* Copyright (C) 2018 Suzuki Toshiya <[email protected]> | ||
* Copyright (C) 2020 Adam Reichold <[email protected]> | ||
* Copyright (C) 2024 Oliver Sander <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -26,6 +27,7 @@ | |
|
||
#include "GooString.h" | ||
#include "Page.h" | ||
#include "UTF.h" | ||
|
||
#include <ctime> | ||
#include <iostream> | ||
|
@@ -63,8 +65,8 @@ ustring detail::unicode_GooString_to_ustring(const GooString *str) | |
const char *data = str->c_str(); | ||
const int len = str->getLength(); | ||
|
||
const bool is_unicodeLE = str->hasUnicodeMarkerLE(); | ||
const bool is_unicode = str->hasUnicodeMarker() || is_unicodeLE; | ||
const bool is_unicodeLE = hasUnicodeByteOrderMarkLE(str->toStr()); | ||
const bool is_unicode = hasUnicodeByteOrderMark(str->toStr()) || is_unicodeLE; | ||
int i = is_unicode ? 2 : 0; | ||
ustring::size_type ret_len = len - i; | ||
if (is_unicode) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Copyright (C) 2016 Jakub Alba <[email protected]> | ||
* Copyright (C) 2018, 2019, 2021, 2022 Marek Kasik <[email protected]> | ||
* Copyright (C) 2019 Masamichi Hosoda <[email protected]> | ||
* Copyright (C) 2019, 2021 Oliver Sander <[email protected]> | ||
* Copyright (C) 2019, 2021, 2024 Oliver Sander <[email protected]> | ||
* Copyright (C) 2020, 2022 Albert Astals Cid <[email protected]> | ||
* Copyright (C) 2021 André Guerreiro <[email protected]> | ||
* Copyright (C) 2024 g10 Code GmbH, Author: Sune Stolborg Vuorela <[email protected]> | ||
|
@@ -1099,9 +1099,9 @@ char *_poppler_goo_string_to_utf8(const GooString *s) | |
|
||
char *result; | ||
|
||
if (s->hasUnicodeMarker()) { | ||
if (hasUnicodeByteOrderMark(s->toStr())) { | ||
result = g_convert(s->c_str() + 2, s->getLength() - 2, "UTF-8", "UTF-16BE", nullptr, nullptr, nullptr); | ||
} else if (s->hasUnicodeMarkerLE()) { | ||
} else if (hasUnicodeByteOrderMarkLE(s->toStr())) { | ||
result = g_convert(s->c_str() + 2, s->getLength() - 2, "UTF-8", "UTF-16LE", nullptr, nullptr, nullptr); | ||
} else { | ||
int len; | ||
|
@@ -1139,8 +1139,8 @@ static GooString *_poppler_goo_string_from_utf8(const gchar *src) | |
GooString *result = new GooString(utf16, outlen); | ||
g_free(utf16); | ||
|
||
if (!result->hasUnicodeMarker()) { | ||
result->prependUnicodeMarker(); | ||
if (!hasUnicodeByteOrderMark(result->toStr())) { | ||
prependUnicodeByteOrderMark(result->toNonConstStr()); | ||
} | ||
|
||
return result; | ||
|
@@ -3733,7 +3733,7 @@ gboolean _poppler_convert_pdf_date_to_gtime(const GooString *date, time_t *gdate | |
gchar *date_string; | ||
gboolean retval; | ||
|
||
if (date->hasUnicodeMarker()) { | ||
if (hasUnicodeByteOrderMark(date->toStr())) { | ||
date_string = g_convert(date->c_str() + 2, date->getLength() - 2, "UTF-8", "UTF-16BE", nullptr, nullptr, nullptr); | ||
} else { | ||
date_string = g_strndup(date->c_str(), date->getLength()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* Copyright (C) 2020 Oliver Sander <[email protected]> | ||
* Copyright (C) 2021 André Guerreiro <[email protected]> | ||
* Copyright (C) 2021, 2023 Marek Kasik <[email protected]> | ||
* Copyright (C) 2023 g10 Code GmbH, Author: Sune Stolborg Vuorela <[email protected]> | ||
* Copyright (C) 2023, 2024 g10 Code GmbH, Author: Sune Stolborg Vuorela <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -449,8 +449,9 @@ static PopplerSignatureInfo *_poppler_form_field_signature_validate(PopplerFormF | |
|
||
sig_field = static_cast<FormFieldSignature *>(field->widget->getField()); | ||
|
||
sig_info = sig_field->validateSignature(flags & POPPLER_SIGNATURE_VALIDATION_FLAG_VALIDATE_CERTIFICATE, force_revalidation, -1, flags & POPPLER_SIGNATURE_VALIDATION_FLAG_WITHOUT_OCSP_REVOCATION_CHECK, | ||
flags & POPPLER_SIGNATURE_VALIDATION_FLAG_USE_AIA_CERTIFICATE_FETCH); | ||
sig_info = sig_field->validateSignatureAsync(flags & POPPLER_SIGNATURE_VALIDATION_FLAG_VALIDATE_CERTIFICATE, force_revalidation, -1, flags & POPPLER_SIGNATURE_VALIDATION_FLAG_WITHOUT_OCSP_REVOCATION_CHECK, | ||
flags & POPPLER_SIGNATURE_VALIDATION_FLAG_USE_AIA_CERTIFICATE_FETCH, {}); | ||
CertificateValidationStatus certificateStatus = sig_field->validateSignatureResult(); | ||
|
||
poppler_sig_info = g_new0(PopplerSignatureInfo, 1); | ||
switch (sig_info->getSignatureValStatus()) { | ||
|
@@ -477,7 +478,7 @@ static PopplerSignatureInfo *_poppler_form_field_signature_validate(PopplerFormF | |
break; | ||
} | ||
|
||
switch (sig_info->getCertificateValStatus()) { | ||
switch (certificateStatus) { | ||
case CERTIFICATE_TRUSTED: | ||
poppler_sig_info->cert_status = POPPLER_CERTIFICATE_TRUSTED; | ||
break; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich | ||
// Copyright (C) 2018 Adam Reichold <[email protected]> | ||
// Copyright (C) 2018 Greg Knight <[email protected]> | ||
// Copyright (C) 2019, 2022, 2023 Oliver Sander <[email protected]> | ||
// Copyright (C) 2019, 2022-2024 Oliver Sander <[email protected]> | ||
// Copyright (C) 2023 Even Rouault <[email protected]> | ||
// | ||
// To see a description of the changes please see the Changelog file that | ||
|
@@ -620,18 +620,3 @@ std::string GooString::toLowerCase(const std::string &s) | |
lowerCase(newString); | ||
return s; | ||
} | ||
|
||
void GooString::prependUnicodeMarker() | ||
{ | ||
insert(0, "\xFE\xFF", 2); | ||
} | ||
|
||
bool GooString::startsWith(const char *prefix) const | ||
{ | ||
return startsWith(toStr(), prefix); | ||
} | ||
|
||
bool GooString::endsWith(const char *suffix) const | ||
{ | ||
return endsWith(toStr(), suffix); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich | ||
// Copyright (C) 2019 Christophe Fergeau <[email protected]> | ||
// Copyright (C) 2019 Tomoyuki Kubota <[email protected]> | ||
// Copyright (C) 2019, 2020, 2022, 2023 Oliver Sander <[email protected]> | ||
// Copyright (C) 2019, 2020, 2022-2024 Oliver Sander <[email protected]> | ||
// Copyright (C) 2019 Hans-Ulrich Jüttner <[email protected]> | ||
// Copyright (C) 2020 Thorsten Behrens <[email protected]> | ||
// Copyright (C) 2022 Even Rouault <[email protected]> | ||
|
@@ -156,11 +156,7 @@ class GooString : private std::string | |
void setChar(int i, char c) { (*this)[i] = c; } | ||
|
||
// Clear string to zero length. | ||
GooString *clear() | ||
{ | ||
static_cast<std::string &>(*this).clear(); | ||
return this; | ||
} | ||
using std::string::clear; | ||
|
||
// Append a character or string. | ||
GooString *append(char c) | ||
|
@@ -242,19 +238,10 @@ class GooString : private std::string | |
int cmpN(const char *sA, int n) const { return compare(0, n, sA); } | ||
|
||
// Return true if strings starts with prefix | ||
POPPLER_PRIVATE_EXPORT bool startsWith(const char *prefix) const; | ||
// Return true if string ends with suffix | ||
POPPLER_PRIVATE_EXPORT bool endsWith(const char *suffix) const; | ||
using std::string::starts_with; | ||
|
||
static bool startsWith(std::string_view str, std::string_view prefix) { return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix); } | ||
static bool endsWith(std::string_view str, std::string_view suffix) { return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } | ||
|
||
bool hasUnicodeMarker() const { return hasUnicodeMarker(*this); } | ||
static bool hasUnicodeMarker(const std::string &s) { return s.size() >= 2 && s[0] == '\xfe' && s[1] == '\xff'; } | ||
bool hasUnicodeMarkerLE() const { return hasUnicodeMarkerLE(*this); } | ||
static bool hasUnicodeMarkerLE(const std::string &s) { return s.size() >= 2 && s[0] == '\xff' && s[1] == '\xfe'; } | ||
|
||
POPPLER_PRIVATE_EXPORT void prependUnicodeMarker(); | ||
// Return true if string ends with suffix | ||
using std::string::ends_with; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.