About removing long time deprecated types from public API

julien2412 serval2412 at yahoo.fr
Fri Sep 11 16:54:17 UTC 2020


sberg wrote
>> ...
> sounds ok at least to me

For replace sal_uChar, I could build and use "make check" for concerned
modules, so I submitted the patch on gerrit.

But replacing sal_Char triggers a lot of errors.
First one is:
In file included from /home/julien/lo/libreoffice/include/rtl/string.hxx:43:
/home/julien/lo/libreoffice/include/rtl/stringconcat.hxx:384:59: error: no
matching function for call to 'rtl_str_valueOfInt32'
    OStringNumber(number_t i, sal_Int16 radix) { length =
rtl_str_valueOfInt32(buf, i, radix); }
                                                         
^~~~~~~~~~~~~~~~~~~~
/home/julien/lo/libreoffice/include/rtl/string.h:623:34: note: candidate
function not viable: no known conversion from 'char [33]' to 'signed char *'
for 1st argument
SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_str_valueOfInt32(
                                 ^
So I first tried static_cast buf to "signed char*" but it's incorrect. So I
tried these changes:
diff --git a/include/rtl/stringconcat.hxx b/include/rtl/stringconcat.hxx
index e2cba5d86f0d..eadaae6eb2bb 100644
--- a/include/rtl/stringconcat.hxx
+++ b/include/rtl/stringconcat.hxx
@@ -366,14 +366,14 @@ template <typename Number, std::size_t nBufSize>
struct OStringNumberBase
     // OString::number(value).getStr() is very common (writing xml code,
...),
     // so implement that one also here, to avoid having to explicitly to
convert
     // to OString in all such places
-    const char * getStr() const SAL_RETURNS_NONNULL { return buf; }
+    const signed char * getStr() const SAL_RETURNS_NONNULL { return buf; }
     OStringNumber<number_t>&& toAsciiUpperCase()
     {
         rtl_str_toAsciiUpperCase_WithLength(buf, length);
         return std::move(*static_cast<OStringNumber<number_t>*>(this));
     }
     operator std::string_view() const { return std::string_view(buf,
length); }
-    char buf[nBufSize];
+    signed char buf[nBufSize];
     sal_Int32 length;
 };

but not sure if it's ok and I still got plenty errors.

In brief, it seems I won't be able to get rid of sal_Char :-(

Julien




--
Sent from: http://document-foundation-mail-archive.969070.n3.nabble.com/Dev-f1639786.html


More information about the LibreOffice mailing list