[Libreoffice-commits] core.git: codemaker/source include/codemaker unodevtools/source

2019-04-05 Thread Mike Kaganski (via logerrit)
 codemaker/source/codemaker/exceptiontree.cxx  |6 
 codemaker/source/codemaker/typemanager.cxx|4 
 codemaker/source/commoncpp/commoncpp.cxx  |3 
 codemaker/source/cppumaker/cppumaker.cxx  |2 
 codemaker/source/cppumaker/cpputype.cxx   |  128 +-
 codemaker/source/cppumaker/dependencies.cxx   |4 
 codemaker/source/cppumaker/includes.cxx   |   14 -
 codemaker/source/javamaker/javamaker.cxx  |2 
 codemaker/source/javamaker/javatype.cxx   |   10 -
 include/codemaker/typemanager.hxx |9 +
 unodevtools/source/skeletonmaker/cppcompskeleton.cxx  |   18 +-
 unodevtools/source/skeletonmaker/cpptypemaker.cxx |   59 
 unodevtools/source/skeletonmaker/javacompskeleton.cxx |   18 +-
 unodevtools/source/skeletonmaker/javatypemaker.cxx|   40 ++---
 unodevtools/source/skeletonmaker/skeletoncommon.cxx   |6 
 15 files changed, 167 insertions(+), 156 deletions(-)

New commits:
commit dacde2c0394d33a04bc9ad929df394465c14b093
Author: Mike Kaganski 
AuthorDate: Fri Apr 5 11:41:39 2019 +0100
Commit: Mike Kaganski 
CommitDate: Fri Apr 5 16:13:14 2019 +0200

Revert "Get rid of b2u/u2b helpers; use OUString's toUtf8/fromUtf8 instead"

This reverts commit 84662e9030a855c8db7cd40d9ce354b773d78c16.

Change-Id: I1cc98d3201390609ae3615baa8e92c926cdcde9a
Reviewed-on: https://gerrit.libreoffice.org/70294
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/codemaker/source/codemaker/exceptiontree.cxx 
b/codemaker/source/codemaker/exceptiontree.cxx
index 796f52671ce3..b6c2aeee6f87 100644
--- a/codemaker/source/codemaker/exceptiontree.cxx
+++ b/codemaker/source/codemaker/exceptiontree.cxx
@@ -55,10 +55,12 @@ void ExceptionTree::add(
 }
 list.push_back(n);
 rtl::Reference< unoidl::Entity > ent;
-codemaker::UnoType::Sort s = manager->getSort(OUString::fromUtf8(n), 
&ent);
+codemaker::UnoType::Sort s = manager->getSort(b2u(n), &ent);
 (void) s; // WaE: unused variable
 assert(s == codemaker::UnoType::Sort::Exception);
-n = 
static_cast(ent.get())->getDirectBase().toUtf8();
+n = u2b(
+static_cast< unoidl::ExceptionTypeEntity * >(ent.get())->
+getDirectBase());
 assert(!n.isEmpty());
 }
 if (!bRuntimeException) {
diff --git a/codemaker/source/codemaker/typemanager.cxx 
b/codemaker/source/codemaker/typemanager.cxx
index f723ee699948..cf638f0ca4eb 100644
--- a/codemaker/source/codemaker/typemanager.cxx
+++ b/codemaker/source/codemaker/typemanager.cxx
@@ -164,7 +164,7 @@ codemaker::UnoType::Sort TypeManager::decompose(
 {
 sal_Int32 k;
 std::vector< OString > args;
-OUString n = 
OUString::fromUtf8(codemaker::UnoType::decompose(name.toUtf8(), &k, &args));
+OUString n = b2u(codemaker::UnoType::decompose(u2b(name), &k, &args));
 for (;;) {
 rtl::Reference< unoidl::Entity > ent;
 codemaker::UnoType::Sort s = getSort(n, &ent);
@@ -238,7 +238,7 @@ codemaker::UnoType::Sort TypeManager::decompose(
 arguments->clear();
 for (const OString& rArg : args)
 {
-arguments->push_back(OUString::fromUtf8(rArg));
+arguments->push_back(b2u(rArg));
 }
 }
 if (entity != nullptr) {
diff --git a/codemaker/source/commoncpp/commoncpp.cxx 
b/codemaker/source/commoncpp/commoncpp.cxx
index 07b689a39b06..6774aedf4fba 100644
--- a/codemaker/source/commoncpp/commoncpp.cxx
+++ b/codemaker/source/commoncpp/commoncpp.cxx
@@ -79,7 +79,8 @@ OString translateUnoToCppType(
 {
 buf.append("::css::uno::XInterface");
 } else {
-buf.append(nucleus.toUtf8()); // nucleus must be a valid UTF-16
+//TODO: check that nucleus is a valid (UTF-8) identifier
+buf.append(u2b(nucleus));
 }
 }
 return buf.makeStringAndClear();
diff --git a/codemaker/source/cppumaker/cppumaker.cxx 
b/codemaker/source/cppumaker/cppumaker.cxx
index 9adf31d07d36..b1769eda87a6 100644
--- a/codemaker/source/cppumaker/cppumaker.cxx
+++ b/codemaker/source/cppumaker/cppumaker.cxx
@@ -54,7 +54,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
 }
 codemaker::GeneratedTypeSet generated;
 if (options.isValid("-T")) {
-OUString names(OUString::fromUtf8(options.getOption("-T")));
+OUString names(b2u(options.getOption("-T")));
 for (sal_Int32 i = 0; i != -1;) {
 OUString name(names.getToken(0, ';', i));
 if (!name.isEmpty()) {
diff --git a/codemaker/source/cppumaker/cpputype.cxx 
b/codemaker/source/cppumaker/cpputype.cxx
index a32e8dd1d0ca..368cfb6e72f1 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -408,7 +408,7 @@ vo

[Libreoffice-commits] core.git: codemaker/source include/codemaker unodevtools/source

2019-04-04 Thread Mike Kaganski (via logerrit)
 codemaker/source/codemaker/exceptiontree.cxx  |6 
 codemaker/source/codemaker/typemanager.cxx|4 
 codemaker/source/commoncpp/commoncpp.cxx  |3 
 codemaker/source/cppumaker/cppumaker.cxx  |2 
 codemaker/source/cppumaker/cpputype.cxx   |  128 +-
 codemaker/source/cppumaker/dependencies.cxx   |4 
 codemaker/source/cppumaker/includes.cxx   |   14 -
 codemaker/source/javamaker/javamaker.cxx  |2 
 codemaker/source/javamaker/javatype.cxx   |   10 -
 include/codemaker/typemanager.hxx |9 -
 unodevtools/source/skeletonmaker/cppcompskeleton.cxx  |   18 +-
 unodevtools/source/skeletonmaker/cpptypemaker.cxx |   58 
 unodevtools/source/skeletonmaker/javacompskeleton.cxx |   18 +-
 unodevtools/source/skeletonmaker/javatypemaker.cxx|   40 ++---
 unodevtools/source/skeletonmaker/skeletoncommon.cxx   |6 
 15 files changed, 155 insertions(+), 167 deletions(-)

New commits:
commit 84662e9030a855c8db7cd40d9ce354b773d78c16
Author: Mike Kaganski 
AuthorDate: Thu Apr 4 12:27:22 2019 +0300
Commit: Mike Kaganski 
CommitDate: Thu Apr 4 20:36:11 2019 +0200

Get rid of b2u/u2b helpers; use OUString's toUtf8/fromUtf8 instead

These helpers are used in code generator code; so any invalid UTF-8
or UTF-16 in the conversion is programmer's error which needs fixing.
Thus, the behavior of toUtf8/fromUtf8 which asserts the validity is
fine here.

Change-Id: I3004e233c9de59f8e348455f1f04d23e8c51ed3d
Reviewed-on: https://gerrit.libreoffice.org/70249
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Mike Kaganski 

diff --git a/codemaker/source/codemaker/exceptiontree.cxx 
b/codemaker/source/codemaker/exceptiontree.cxx
index b6c2aeee6f87..796f52671ce3 100644
--- a/codemaker/source/codemaker/exceptiontree.cxx
+++ b/codemaker/source/codemaker/exceptiontree.cxx
@@ -55,12 +55,10 @@ void ExceptionTree::add(
 }
 list.push_back(n);
 rtl::Reference< unoidl::Entity > ent;
-codemaker::UnoType::Sort s = manager->getSort(b2u(n), &ent);
+codemaker::UnoType::Sort s = manager->getSort(OUString::fromUtf8(n), 
&ent);
 (void) s; // WaE: unused variable
 assert(s == codemaker::UnoType::Sort::Exception);
-n = u2b(
-static_cast< unoidl::ExceptionTypeEntity * >(ent.get())->
-getDirectBase());
+n = 
static_cast(ent.get())->getDirectBase().toUtf8();
 assert(!n.isEmpty());
 }
 if (!bRuntimeException) {
diff --git a/codemaker/source/codemaker/typemanager.cxx 
b/codemaker/source/codemaker/typemanager.cxx
index cf638f0ca4eb..f723ee699948 100644
--- a/codemaker/source/codemaker/typemanager.cxx
+++ b/codemaker/source/codemaker/typemanager.cxx
@@ -164,7 +164,7 @@ codemaker::UnoType::Sort TypeManager::decompose(
 {
 sal_Int32 k;
 std::vector< OString > args;
-OUString n = b2u(codemaker::UnoType::decompose(u2b(name), &k, &args));
+OUString n = 
OUString::fromUtf8(codemaker::UnoType::decompose(name.toUtf8(), &k, &args));
 for (;;) {
 rtl::Reference< unoidl::Entity > ent;
 codemaker::UnoType::Sort s = getSort(n, &ent);
@@ -238,7 +238,7 @@ codemaker::UnoType::Sort TypeManager::decompose(
 arguments->clear();
 for (const OString& rArg : args)
 {
-arguments->push_back(b2u(rArg));
+arguments->push_back(OUString::fromUtf8(rArg));
 }
 }
 if (entity != nullptr) {
diff --git a/codemaker/source/commoncpp/commoncpp.cxx 
b/codemaker/source/commoncpp/commoncpp.cxx
index 6774aedf4fba..07b689a39b06 100644
--- a/codemaker/source/commoncpp/commoncpp.cxx
+++ b/codemaker/source/commoncpp/commoncpp.cxx
@@ -79,8 +79,7 @@ OString translateUnoToCppType(
 {
 buf.append("::css::uno::XInterface");
 } else {
-//TODO: check that nucleus is a valid (UTF-8) identifier
-buf.append(u2b(nucleus));
+buf.append(nucleus.toUtf8()); // nucleus must be a valid UTF-16
 }
 }
 return buf.makeStringAndClear();
diff --git a/codemaker/source/cppumaker/cppumaker.cxx 
b/codemaker/source/cppumaker/cppumaker.cxx
index b1769eda87a6..9adf31d07d36 100644
--- a/codemaker/source/cppumaker/cppumaker.cxx
+++ b/codemaker/source/cppumaker/cppumaker.cxx
@@ -54,7 +54,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
 }
 codemaker::GeneratedTypeSet generated;
 if (options.isValid("-T")) {
-OUString names(b2u(options.getOption("-T")));
+OUString names(OUString::fromUtf8(options.getOption("-T")));
 for (sal_Int32 i = 0; i != -1;) {
 OUString name(names.getToken(0, ';', i));
 if (!name.isEmpty()) {
diff --git a/codemaker/source/cppumaker/cpputype.cxx 
b/codem