aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/html/pcdata
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:25 +0300
commit344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/html/pcdata
parent706b83ed7de5a473436620367af31fc0ceecde07 (diff)
downloadydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/html/pcdata')
-rw-r--r--library/cpp/html/pcdata/pcdata.cpp16
-rw-r--r--library/cpp/html/pcdata/pcdata.h6
-rw-r--r--library/cpp/html/pcdata/pcdata_ut.cpp8
-rw-r--r--library/cpp/html/pcdata/ut/ya.make16
-rw-r--r--library/cpp/html/pcdata/ya.make20
5 files changed, 33 insertions, 33 deletions
diff --git a/library/cpp/html/pcdata/pcdata.cpp b/library/cpp/html/pcdata/pcdata.cpp
index 70fe073bb9..740c240fd2 100644
--- a/library/cpp/html/pcdata/pcdata.cpp
+++ b/library/cpp/html/pcdata/pcdata.cpp
@@ -1,10 +1,10 @@
#include "pcdata.h"
-#include <util/string/strspn.h>
-
+#include <util/string/strspn.h>
+
static TCompactStrSpn sspn("\"<>&'");
-static void EncodeHtmlPcdataAppendInternal(const TStringBuf str, TString& strout, bool qAmp) {
+static void EncodeHtmlPcdataAppendInternal(const TStringBuf str, TString& strout, bool qAmp) {
const char* s = str.data();
const char* e = s + str.length();
@@ -49,18 +49,18 @@ static void EncodeHtmlPcdataAppendInternal(const TStringBuf str, TString& strout
}
}
-void EncodeHtmlPcdataAppend(const TStringBuf str, TString& strout) {
+void EncodeHtmlPcdataAppend(const TStringBuf str, TString& strout) {
EncodeHtmlPcdataAppendInternal(str, strout, true);
}
-TString EncodeHtmlPcdata(const TStringBuf str, bool qAmp) {
- TString strout;
+TString EncodeHtmlPcdata(const TStringBuf str, bool qAmp) {
+ TString strout;
EncodeHtmlPcdataAppendInternal(str, strout, qAmp);
return strout;
}
-TString DecodeHtmlPcdata(const TString& sz) {
- TString res;
+TString DecodeHtmlPcdata(const TString& sz) {
+ TString res;
const char* codes[] = {"&quot;", "&lt;", "&gt;", "&#39;", "&#039;", "&amp;", "&apos;", nullptr};
const char chars[] = {'\"', '<', '>', '\'', '\'', '&', '\''};
for (size_t i = 0; i < sz.length(); ++i) {
diff --git a/library/cpp/html/pcdata/pcdata.h b/library/cpp/html/pcdata/pcdata.h
index c1de2d0a31..7dd741f53d 100644
--- a/library/cpp/html/pcdata/pcdata.h
+++ b/library/cpp/html/pcdata/pcdata.h
@@ -3,8 +3,8 @@
#include <util/generic/fwd.h>
/// Converts a text into HTML-code. Special characters of HTML («<», «>», ...) replaced with entities.
-TString EncodeHtmlPcdata(const TStringBuf str, bool qAmp = true);
-void EncodeHtmlPcdataAppend(const TStringBuf str, TString& strout);
+TString EncodeHtmlPcdata(const TStringBuf str, bool qAmp = true);
+void EncodeHtmlPcdataAppend(const TStringBuf str, TString& strout);
/// Reverse of EncodeHtmlPcdata()
-TString DecodeHtmlPcdata(const TString& sz);
+TString DecodeHtmlPcdata(const TString& sz);
diff --git a/library/cpp/html/pcdata/pcdata_ut.cpp b/library/cpp/html/pcdata/pcdata_ut.cpp
index 6710d9dfce..5833f8bc59 100644
--- a/library/cpp/html/pcdata/pcdata_ut.cpp
+++ b/library/cpp/html/pcdata/pcdata_ut.cpp
@@ -6,18 +6,18 @@ Y_UNIT_TEST_SUITE(TPcdata) {
Y_UNIT_TEST(TestStress) {
{
ui64 key = 0x000017C0B76C4E87ull;
- TString res = EncodeHtmlPcdata(TStringBuf((const char*)&key, sizeof(key)));
+ TString res = EncodeHtmlPcdata(TStringBuf((const char*)&key, sizeof(key)));
}
for (size_t i = 0; i < 1000; ++i) {
- const TString s = NUnitTest::RandomString(i, i);
+ const TString s = NUnitTest::RandomString(i, i);
UNIT_ASSERT_VALUES_EQUAL(DecodeHtmlPcdata(EncodeHtmlPcdata(s)), s);
}
}
Y_UNIT_TEST(Test1) {
- const TString tests[] = {
+ const TString tests[] = {
"qw&qw",
"&<",
">&qw",
@@ -33,7 +33,7 @@ Y_UNIT_TEST_SUITE(TPcdata) {
}
Y_UNIT_TEST(TestEncodeHtmlPcdataAppend) {
- TString s;
+ TString s;
EncodeHtmlPcdataAppend("m&m", s);
EncodeHtmlPcdataAppend("'s", s);
UNIT_ASSERT_VALUES_EQUAL(EncodeHtmlPcdata("m&m's"), s);
diff --git a/library/cpp/html/pcdata/ut/ya.make b/library/cpp/html/pcdata/ut/ya.make
index ad9f9abe47..bc947baa89 100644
--- a/library/cpp/html/pcdata/ut/ya.make
+++ b/library/cpp/html/pcdata/ut/ya.make
@@ -1,9 +1,9 @@
UNITTEST_FOR(library/cpp/html/pcdata)
-
-OWNER(vladon)
-
-SRCS(
- pcdata_ut.cpp
-)
-
-END()
+
+OWNER(vladon)
+
+SRCS(
+ pcdata_ut.cpp
+)
+
+END()
diff --git a/library/cpp/html/pcdata/ya.make b/library/cpp/html/pcdata/ya.make
index 957fd964c2..637220e706 100644
--- a/library/cpp/html/pcdata/ya.make
+++ b/library/cpp/html/pcdata/ya.make
@@ -1,10 +1,10 @@
-LIBRARY()
-
-OWNER(vladon)
-
-SRCS(
- pcdata.cpp
- pcdata.h
-)
-
-END()
+LIBRARY()
+
+OWNER(vladon)
+
+SRCS(
+ pcdata.cpp
+ pcdata.h
+)
+
+END()