D13327: Fix conversion error when compiled against MDNSRESPONDER option

2020-05-31 Thread Adriaan de Groot
adridg abandoned this revision.
adridg added a comment.


  Pretty much exact same changes were done in D15479 


REPOSITORY
  R272 KDNSSD

REVISION DETAIL
  https://phabricator.kde.org/D13327

To: adridg
Cc: sitter, kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns


D13327: Fix conversion error when compiled against MDNSRESPONDER option

2018-06-04 Thread Harald Sitter
sitter added a comment.


  `-DQT_NO_CAST_FROM_BYTEARRAY` is a default define from 
`KDEFrameworkCompilerSettings.cmake`, so kdnssd should be working. The reason 
it wasn't is likely because most/all distributions build with avahi. 
Additionally, build.kde.org seems to build without avahi and dnssd, so it 
doesn't validate half the code at all 
  
  With all that said, the change looks good.
  
  qUtf8Printable  might be 
nicer to read than `qString.toUtf8().constData()` though, might be worth 
thinking about.

INLINE COMMENTS

> mdnsd-publicservice.cpp:163
>  for (QMap::ConstIterator it = 
> d->m_textData.cbegin(); it != itEnd; ++it) {
> -if (TXTRecordSetValue(, it.key().toUtf8(), it.value().length(), 
> it.value()) != kDNSServiceErr_NoError) {
> +if (TXTRecordSetValue(, it.key().toUtf8().constData(), 
> it.value().length(), it.value().data()) != kDNSServiceErr_NoError) {
>  TXTRecordDeallocate();

Is there a reason the second call is going to `data()` rather than 
`constData()`? There is `const char *data() const` so it ultimately makes no 
difference, for code expressiveness I would say all calls should be to 
`constData()` though.

REPOSITORY
  R272 KDNSSD

REVISION DETAIL
  https://phabricator.kde.org/D13327

To: adridg
Cc: sitter, kde-frameworks-devel, michaelh, ngraham, bruns


D13327: Fix conversion error when compiled against MDNSRESPONDER option

2018-06-04 Thread Adriaan de Groot
adridg created this revision.
Restricted Application added a project: Frameworks.
Restricted Application added a subscriber: kde-frameworks-devel.
adridg requested review of this revision.

REVISION SUMMARY
  If QT_NO_CAST_FROM_BYTEARRAY is set, along with using MDNSRESPONDER,
  then the implicit cast from QByteArray to const char * is not available.
  The MDNSRESPONDER API uses const char * parameters and kdnssd passes
  QByteArray to them.  Make the necessary conversion explicit.
  
  Submitted downstream in FreeBSD by Ashish SHUKLA

TEST PLAN
  - builds ok, unpatched, with QT_NO_CAST_FROM_BYTEARRAY against AVAHI
  - build fails, unpatched, with QT_NO.. against MDNSRESPONDER
  - build succees, patched, with QT_NO.. against MDNS..

REPOSITORY
  R272 KDNSSD

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D13327

AFFECTED FILES
  src/mdnsd-publicservice.cpp
  src/mdnsd-remoteservice.cpp
  src/mdnsd-servicebrowser.cpp

To: adridg
Cc: kde-frameworks-devel, michaelh, ngraham, bruns