[Libreoffice-commits] .: extensions/source

Fridrich Strba fridrich at kemper.freedesktop.org
Mon Jul 16 03:45:02 PDT 2012


 extensions/source/config/ldap/ldapaccess.cxx      |   12 ++++++------
 extensions/source/config/ldap/wrapldapinclude.hxx |    2 ++
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 1d1e7313ab076c919ce1bd095bac07480cea392f
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Mon Jul 16 12:44:48 2012 +0200

    Cast from const sal_Char* to const PCHAR on Windows
    
    Change-Id: If77916c59c3752f166482e0b8929fda859fac2f4

diff --git a/extensions/source/config/ldap/ldapaccess.cxx b/extensions/source/config/ldap/ldapaccess.cxx
index 72d5bf7..674ddc7 100644
--- a/extensions/source/config/ldap/ldapaccess.cxx
+++ b/extensions/source/config/ldap/ldapaccess.cxx
@@ -138,8 +138,8 @@ void  LdapConnection::connectSimple()
 
         // Do the bind
         LdapErrCode retCode = ldap_simple_bind_s(mConnection,
-                                               mLdapDefinition.mAnonUser.getStr(),
-                                               mLdapDefinition.mAnonCredentials.getStr()) ;
+                                               CONST_PCHAR_CAST mLdapDefinition.mAnonUser.getStr(),
+                                               CONST_PCHAR_CAST mLdapDefinition.mAnonCredentials.getStr()) ;
 
         checkLdapReturnCode("SimpleBind", retCode, mConnection) ;
     }
@@ -158,7 +158,7 @@ void LdapConnection::initConnection()
 
     if (mLdapDefinition.mPort == 0) mLdapDefinition.mPort = LDAP_PORT;
 
-    mConnection = ldap_init(mLdapDefinition.mServer.getStr(),
+    mConnection = ldap_init(CONST_PCHAR_CAST mLdapDefinition.mServer.getStr(),
                             mLdapDefinition.mPort) ;
     if (mConnection == NULL)
     {
@@ -185,7 +185,7 @@ void LdapConnection::initConnection()
 
     LdapMessageHolder result;
     LdapErrCode retCode = ldap_search_s(mConnection,
-                                      aUserDn.getStr(),
+                                      CONST_PCHAR_CAST aUserDn.getStr(),
                                       LDAP_SCOPE_BASE,
                                       "(objectclass=*)",
                                       0,
@@ -235,9 +235,9 @@ void LdapConnection::initConnection()
     attributes[0]= const_cast<sal_Char *>(LDAP_NO_ATTRS);
     attributes[1]= NULL;
     LdapErrCode retCode = ldap_search_s(mConnection,
-                                      mLdapDefinition.mBaseDN.getStr(),
+                                      CONST_PCHAR_CAST mLdapDefinition.mBaseDN.getStr(),
                                       LDAP_SCOPE_SUBTREE,
-                                      filter.makeStringAndClear().getStr(), attributes, 0, &result.msg) ;
+                                      CONST_PCHAR_CAST filter.makeStringAndClear().getStr(), attributes, 0, &result.msg) ;
 
     checkLdapReturnCode("FindUserDn", retCode,mConnection) ;
     rtl::OString userDn ;
diff --git a/extensions/source/config/ldap/wrapldapinclude.hxx b/extensions/source/config/ldap/wrapldapinclude.hxx
index 1b84b76..9283790 100644
--- a/extensions/source/config/ldap/wrapldapinclude.hxx
+++ b/extensions/source/config/ldap/wrapldapinclude.hxx
@@ -34,6 +34,7 @@
 #ifdef WNT
 #include <windows.h>
 #include <winldap.h>
+#define CONST_PCHAR_CAST (const PCHAR)
 #ifndef LDAP_API
 #    define LDAP_API(rt) rt
 #endif
@@ -44,6 +45,7 @@
 #    define LDAP_NO_ATTRS "1.1"
 #endif
 #else // !defined WNT
+#define CONST_PCHAR_CAST
 #ifndef LDAP_INCLUDED
 #define LDAP_INCLUDED
 #include <ldap/ldap.h>


More information about the Libreoffice-commits mailing list