summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-19 13:18:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-05 09:39:11 +0200
commit14cfff500e93f0d6cbf8412065feea85c01ea81d (patch)
tree76e3fb8fbf2b0d8a12c8406d8cf994ea6a37aaff /basic
parentd924ce30e0ca260682bd2aed192b8b1b2ca3e7c0 (diff)
Pass context and resource string down to boost::locale separately
because this is often on a hot path, and we can avoid the splitting and joining of strings like this. Change-Id: Ia36047209368ca53431178c2e8723a18cfe8260a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119220 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r--basic/inc/basic.hrc6
-rw-r--r--basic/inc/strings.hrc2
-rw-r--r--basic/source/classes/sb.cxx4
-rw-r--r--basic/source/sbx/sbxscan.cxx2
4 files changed, 7 insertions, 7 deletions
diff --git a/basic/inc/basic.hrc b/basic/inc/basic.hrc
index 1a063615318e..3208737a2564 100644
--- a/basic/inc/basic.hrc
+++ b/basic/inc/basic.hrc
@@ -19,9 +19,9 @@
#pragma once
-#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String)
+#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
-std::pair<const char*, ErrCode> const RID_BASIC_START[] =
+std::pair<TranslateId, ErrCode> const RID_BASIC_START[] =
{
{ NC_("RID_BASIC_START", "Syntax error."), ERRCODE_BASIC_SYNTAX },
{ NC_("RID_BASIC_START", "Return without Gosub."), ERRCODE_BASIC_NO_GOSUB },
@@ -152,7 +152,7 @@ std::pair<const char*, ErrCode> const RID_BASIC_START[] =
{ NC_("RID_BASIC_START", "Too many DLL application clients."), ERRCODE_BASIC_TOO_MANY_DLL },
{ NC_("RID_BASIC_START", "For loop not initialized."), ERRCODE_BASIC_LOOP_NOT_INIT },
{ NC_("RID_BASIC_START", "$(ARG1)"), ERRCODE_BASIC_COMPAT },
- { nullptr, ERRCODE_NONE }
+ { {}, ERRCODE_NONE }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/strings.hrc b/basic/inc/strings.hrc
index ff8e0fc22618..7aeb2831a64a 100644
--- a/basic/inc/strings.hrc
+++ b/basic/inc/strings.hrc
@@ -19,7 +19,7 @@
#pragma once
-#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String)
+#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
#define STR_BASICKEY_FORMAT_ON NC_("STR_BASICKEY_FORMAT_ON", "On")
#define STR_BASICKEY_FORMAT_OFF NC_("STR_BASICKEY_FORMAT_OFF", "Off")
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index d394c9c8d9a1..e4ee5b508451 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1543,8 +1543,8 @@ void StarBASIC::MakeErrorText( ErrCode nId, std::u16string_view aMsg )
SolarMutexGuard aSolarGuard;
sal_uInt16 nOldID = GetVBErrorCode( nId );
- const char* pErrorMsg = nullptr;
- for (std::pair<const char *, ErrCode> const *pItem = RID_BASIC_START; pItem->second; ++pItem)
+ TranslateId pErrorMsg;
+ for (std::pair<TranslateId, ErrCode> const *pItem = RID_BASIC_START; pItem->second; ++pItem)
{
if (nId == pItem->second)
{
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index b59f948aa6d8..a632a689a42f 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -591,7 +591,7 @@ std::locale BasResLocale()
return Translate::Create("sb");
}
-OUString BasResId(std::string_view aId)
+OUString BasResId(TranslateId aId)
{
return Translate::get(aId, BasResLocale());
}