Visual Studio 32-bit compiler error in httpContext.cc [Patch]

Daniel Krügler via omniORB-list <[email protected]> Wed, 14 Feb 2024 18:01:18 +0100
Newsgroups gmane.comp.corba.omniorb.user
Message-ID <CAGNvRgAYvZ7HCE=AfW6KjPopmdmkRO7wrqbd67FpF7wrWbXB6w@mail.gmail.com>
--0000000000005ca2b406115a76e2
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,

We recently tried to activate CORBA SSL and build OmniORB (4.3.2)
according to the instructions. It should be pointed out that we also
compiled the code against C++20.

When doing so, the build worked fine except for the 32-bit build using
Visual Studio 2022, which produced the following error:

httpContext.cc
httpContext.cc(259): error C2666: '_CORBA_String_var::operator []':
overloaded functions have similar conversions
D:\_DEV\git\net.sourceforge.omniorb\target\build32\omniORB-4.3.2\include\om=
niORB4/stringtypes.h(150):
note: could be 'char _CORBA_String_var::operator [](_CORBA_ULong)
const'
D:\_DEV\git\net.sourceforge.omniorb\target\build32\omniORB-4.3.2\include\om=
niORB4/stringtypes.h(143):
note: or       'char &_CORBA_String_var::operator [](_CORBA_ULong)'
httpContext.cc(259): note: or       'built-in C++ operator[](char *, int)'
httpContext.cc(259): note: or       'built-in C++ operator[](const char *, =
int)'

This ambiguity is understandable, since for the Windows compiler CORBA::ULo=
ng is
unsigned long and the affected code uses an int argument for the
operator[] call and on 32-bit ptrdiff_t is a typedef to int for this
standard library vendor. The right fix seems to be to effectively use
a CORBA::ULong argument for the operator[] invocation. We have applied
the attached patch and the library built successfully for Visual
Studio 2022, 2019 (32-bit and 64-bit) as well as gcc12 and gcc13 (each
64-bit). We would like to suggest to apply it to the main branch.

Thanks,

Daniel Kr=C3=BCgler

--0000000000005ca2b406115a76e2
Content-Type: text/plain; charset="US-ASCII"; name="omniORB-4.3.2.patch"
Content-Disposition: attachment; filename="omniORB-4.3.2.patch"
Content-Transfer-Encoding: base64
Content-ID: <f_lsm1fap80>
X-Attachment-Id: f_lsm1fap80

ZGlmZiAtLWdpdCAiYS9idWlsZC9vbW5pT1JCLTQuMy4yL3NyYy9saWIvb21uaU9SQi9vcmJjb3Jl
L2h0dHAvaHR0cENvbnRleHQuY2MiICJiL2J1aWxkL29tbmlPUkItNC4zLjIvc3JjL2xpYi9vbW5p
T1JCL29yYmNvcmUvaHR0cC9odHRwQ29udGV4dC5jYyINCmluZGV4IDRhMmYyODcuLjMzMjg0NDQg
MTAwNjQ0DQotLS0gImEvYnVpbGQvb21uaU9SQi00LjMuMi9zcmMvbGliL29tbmlPUkIvb3JiY29y
ZS9odHRwL2h0dHBDb250ZXh0LmNjIg0KKysrICJiL2J1aWxkL29tbmlPUkItNC4zLjIvc3JjL2xp
Yi9vbW5pT1JCL29yYmNvcmUvaHR0cC9odHRwQ29udGV4dC5jYyINCkBAIC0yNTYsNyArMjU2LDcg
QEAgaHR0cENvbnRleHQ6OmI2NGRlY29kZShjb25zdCBjaGFyKiBkYXRhLCBzaXplX3QmIGxlbikg
ew0KICAgaWYgKGwgPCAwKQ0KICAgICBPTU5JT1JCX1RIUk9XKE1BUlNIQUwsIE1BUlNIQUxfSW52
YWxpZEJhc2U2NERhdGEsIENPUkJBOjpDT01QTEVURURfTk8pOw0KDQotICBvdXRbbF0gPSAnXDAn
Ow0KKyAgb3V0WyhDT1JCQTo6VUxvbmcpbF0gPSAnXDAnOw0KDQogICBsZW4gPSAoc2l6ZV90KWw7
DQogICByZXR1cm4gb3V0Ll9yZXRuKCk7DQoNCg==
--0000000000005ca2b406115a76e2
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
omniORB-list mailing list
[email protected]
https://www.omniorb-support.com/mailman/listinfo/omniorb-list

--0000000000005ca2b406115a76e2--