[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - tools/source

2023-06-16 Thread Patrick Luby (via logerrit)
 tools/source/misc/json_writer.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 422c26ef82e6391071b5c3c03d64d0e5d37c920e
Author: Patrick Luby 
AuthorDate: Thu Jun 8 17:28:42 2023 -0400
Commit: Andras Timar 
CommitDate: Fri Jun 16 17:41:09 2023 +0200

-Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): tools

(The "clang-format off" in tools/source/misc/json_writer.cxx is necessary
because otherwise the code between the 
SAL_WNODEPRECATED_DECLARATIONS_PUSH/POP
macros would be ill-formatted in a way that would trigger 
loplugin:indentation.)

Change-Id: I98af7311e1980829d94aa93f88acf11f0d67d5e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152776
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Patrick Luby 
Reviewed-by: Andras Timar 

diff --git a/tools/source/misc/json_writer.cxx 
b/tools/source/misc/json_writer.cxx
index 95210d7e7fa7..865b09d50e6a 100644
--- a/tools/source/misc/json_writer.cxx
+++ b/tools/source/misc/json_writer.cxx
@@ -159,7 +159,12 @@ static bool writeEscapedSequence(sal_uInt32 ch, char*& pos)
 // control characters
 if (ch <= 0x1f)
 {
+// clang-format off
+SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK)
 int written = sprintf(pos, "\\u%.4x", ch);
+SAL_WNODEPRECATED_DECLARATIONS_POP
+// clang-format on
+
 if (written > 0)
 pos += written;
 return true;


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - tools/source

2023-05-25 Thread Szymon Kłos (via logerrit)
 tools/source/misc/json_writer.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 5b4a36483719e3dbc87bde8df3f78f2c840be649
Author: Szymon Kłos 
AuthorDate: Thu May 25 09:38:12 2023 +0200
Commit: Andras Timar 
CommitDate: Thu May 25 10:50:41 2023 +0200

jsdialog: encode properly control characters

according to https://www.rfc-editor.org/rfc/rfc7159#section-7
strings in JSON should contain control characters (0x00-0x1f)
encoded as \u

Signed-off-by: Szymon Kłos 
Change-Id: I1f828f64e57328b5fa2dcf5853afe0d6ea643081
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152262
Reviewed-by: Attila Szűcs 
Tested-by: Attila Szűcs 

diff --git a/tools/source/misc/json_writer.cxx 
b/tools/source/misc/json_writer.cxx
index 5bc718608d6a..95210d7e7fa7 100644
--- a/tools/source/misc/json_writer.cxx
+++ b/tools/source/misc/json_writer.cxx
@@ -156,6 +156,15 @@ static char getEscapementChar(char ch)
 
 static bool writeEscapedSequence(sal_uInt32 ch, char*& pos)
 {
+// control characters
+if (ch <= 0x1f)
+{
+int written = sprintf(pos, "\\u%.4x", ch);
+if (written > 0)
+pos += written;
+return true;
+}
+
 switch (ch)
 {
 case '\b':


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - tools/source

2023-04-18 Thread Jaume Pujantell (via logerrit)
 tools/source/misc/json_writer.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 8790a9c408e3d8732993b228012eeb0c941ec2fb
Author: Jaume Pujantell 
AuthorDate: Tue Apr 18 10:34:47 2023 +0200
Commit: Michael Meeks 
CommitDate: Tue Apr 18 13:33:23 2023 +0200

fix bug in json_writer

Ruler stores null-terminated strings in fixed length char arrays, so when 
creating a JSON
a string might end earlier that it's size sugsests.

Change-Id: Icdcaf35f9ce54c24dcd36368dc49bb688a2a65ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150558
Tested-by: Michael Meeks 
Reviewed-by: Michael Meeks 

diff --git a/tools/source/misc/json_writer.cxx 
b/tools/source/misc/json_writer.cxx
index 3d78f82e08e6..aea89a15d421 100644
--- a/tools/source/misc/json_writer.cxx
+++ b/tools/source/misc/json_writer.cxx
@@ -274,7 +274,8 @@ void JsonWriter::put(const char* pPropName, 
std::string_view rPropVal)
 mPos += 4;
 
 // copy and perform escaping
-for (size_t i = 0; i < rPropVal.size(); ++i)
+bool bReachedEnd = false;
+for (size_t i = 0; i < rPropVal.size() && !bReachedEnd; ++i)
 {
 char ch = rPropVal[i];
 switch (ch)
@@ -289,6 +290,9 @@ void JsonWriter::put(const char* pPropName, 
std::string_view rPropVal)
 case '\\':
 writeEscapedSequence(ch, mPos);
 break;
+case 0:
+bReachedEnd = true;
+break;
 case '\xE2': // Special processing of U+2028 and U+2029
 if (i + 2 < rPropVal.size() && rPropVal[i + 1] == '\x80'
 && (rPropVal[i + 2] == '\xA8' || rPropVal[i + 2] == 
'\xA9'))


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - tools/source

2023-02-23 Thread Tor Lillqvist (via logerrit)
 tools/source/misc/extendapplicationenvironment.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7a0d7d6834ad5efd879968f706b75954e76acfa8
Author: Tor Lillqvist 
AuthorDate: Fri Dec 30 12:55:31 2022 +0200
Commit: Tor Lillqvist 
CommitDate: Fri Feb 24 07:58:22 2023 +

I get "warning: unsupported syscall: __sys_prlimit64" in WASM so avoid that

Change-Id: I8a9a19d3c7757e1b7e1d194c439280a9d4824c3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144876
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147564
Tested-by: Tor Lillqvist 

diff --git a/tools/source/misc/extendapplicationenvironment.cxx 
b/tools/source/misc/extendapplicationenvironment.cxx
index ce2237a88c70..07f9779ccc26 100644
--- a/tools/source/misc/extendapplicationenvironment.cxx
+++ b/tools/source/misc/extendapplicationenvironment.cxx
@@ -38,7 +38,7 @@ namespace tools
 {
 void extendApplicationEnvironment()
 {
-#if defined UNX
+#if defined UNX && !defined EMSCRIPTEN
 // Try to set RLIMIT_NOFILE as large as possible (failure is harmless):
 rlimit lim;
 if (getrlimit(RLIMIT_NOFILE, ) == 0)