Haftungsausschluß.patch KontaktUnknown {[0] [0] [0]}diese Dinge liegen außhalb unserer Verantwortung
--- a/src/csutil.cxx
+++ b/src/csutil.cxx
@@ -98,11 +98,7 @@
#endif
#ifdef MOZILLA_CLIENT
-#include "nsCOMPtr.h"
-#include "nsUnicharUtils.h"
-#include "mozilla/Encoding.h"
-
-using namespace mozilla;
+#include "mozHunspellRLBoxGlue.h"
#endif
#ifndef MOZILLA_CLIENT
@@ -2341,91 +2337,8 @@
return ccs;
}
#else
-// XXX This function was rewritten for mozilla. Instead of storing the
-// conversion tables static in this file, create them when needed
-// with help the mozilla backend.
const struct cs_info* get_current_cs(const std::string& es) {
- struct cs_info* ccs = new cs_info[256];
- // Initialze the array with dummy data so that we wouldn't need
- // to return null in case of failures.
- for (int i = 0; i <= 0xff; ++i) {
- ccs[i].ccase = false;
- ccs[i].clower = i;
- ccs[i].cupper = i;
- }
-
- auto encoding = Encoding::ForLabelNoReplacement(es);
- if (!encoding) {
- return ccs;
- }
- auto encoder = encoding->NewEncoder();
- auto decoder = encoding->NewDecoderWithoutBOMHandling();
-
- for (unsigned int i = 0; i <= 0xff; ++i) {
- bool success = false;
- // We want to find the upper/lowercase equivalents of each byte
- // in this 1-byte character encoding. Call our encoding/decoding
- // APIs separately for each byte since they may reject some of the
- // bytes, and we want to handle errors separately for each byte.
- uint8_t lower, upper;
- do {
- if (i == 0)
- break;
- uint8_t source = uint8_t(i);
- char16_t uni[2];
- char16_t uniCased;
- uint8_t destination[4];
- auto src1 = MakeSpan(&source, 1);
- auto dst1 = MakeSpan(uni);
- auto src2 = MakeSpan(&uniCased, 1);
- auto dst2 = MakeSpan(destination);
-
- uint32_t result;
- size_t read;
- size_t written;
- Tie(result, read, written) =
- decoder->DecodeToUTF16WithoutReplacement(src1, dst1, true);
- if (result != kInputEmpty || read != 1 || written != 1) {
- break;
- }
-
- uniCased = ToLowerCase(uni[0]);
- Tie(result, read, written) =
- encoder->EncodeFromUTF16WithoutReplacement(src2, dst2, true);
- if (result != kInputEmpty || read != 1 || written != 1) {
- break;
- }
- lower = destination[0];
-
- uniCased = ToUpperCase(uni[0]);
- Tie(result, read, written) =
- encoder->EncodeFromUTF16WithoutReplacement(src2, dst2, true);
- if (result != kInputEmpty || read != 1 || written != 1) {
- break;
- }
- upper = destination[0];
-
- success = true;
- } while (0);
-
- encoding->NewEncoderInto(*encoder);
- encoding->NewDecoderWithoutBOMHandlingInto(*decoder);
-
- if (success) {
- ccs[i].cupper = upper;
- ccs[i].clower = lower;
- } else {
- ccs[i].cupper = i;
- ccs[i].clower = i;
- }
-
- if (ccs[i].clower != (unsigned char)i)
- ccs[i].ccase = true;
- else
- ccs[i].ccase = false;
- }
-
- return ccs;
+ return moz_hunspell_GetCurrentCS(es.c_str());
}
#endif
@@ -2488,7 +2401,7 @@
return static_cast<unsigned short>(u_toupper(c));
#else
#ifdef MOZILLA_CLIENT
- return ToUpperCase((char16_t)c);
+ return moz_hunspell_ToUpperCase((char16_t)c);
#else
return utf_tbl[c].cupper;
#endif
@@ -2505,7 +2418,7 @@
return static_cast<unsigned short>(u_tolower(c));
#else
#ifdef MOZILLA_CLIENT
- return ToLowerCase((char16_t)c);
+ return moz_hunspell_ToLowerCase((char16_t)c);
#else
return utf_tbl[c].clower;
#endif
@@ -2515,6 +2428,11 @@
int unicodeisalpha(unsigned short c) {
#ifdef OPENOFFICEORG
return u_isalpha(c);
+#elif defined(MOZILLA_CLIENT)
+ // utf_tbl is not available in MOZILLA_CLIENT mode and this function is not
+ // called by any internal Hunspell code path used via the RLBox sandbox.
+ (void)c;
+ return 0;
#else
return utf_tbl[c].cletter;
#endif
--- a/src/csutil.hxx
+++ b/src/csutil.hxx
@@ -84,10 +84,6 @@
#include "w_char.hxx"
#include "htypes.hxx"
-#ifdef MOZILLA_CLIENT
-#include "nscore.h" // for mozalloc headers
-#endif
-
// casing
#define NOCAP 0
#define INITCAP 1
[Dauer der Verarbeitung: 0.20 Sekunden, vorverarbeitet 2026-08-25]