[CalendarServer-changes] [3321] PyOpenDirectory/trunk/src
source_changes at macosforge.org
source_changes at macosforge.org
Wed Nov 5 12:12:00 PST 2008
Revision: 3321
http://trac.macosforge.org/projects/calendarserver/changeset/3321
Author: cdaboo at apple.com
Date: 2008-11-05 12:11:59 -0800 (Wed, 05 Nov 2008)
Log Message:
-----------
Fix 64-bit build issue with integer types.
Modified Paths:
--------------
PyOpenDirectory/trunk/src/CDirectoryService.cpp
PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp
PyOpenDirectory/trunk/src/CDirectoryServiceException.h
Modified: PyOpenDirectory/trunk/src/CDirectoryService.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryService.cpp 2008-11-04 20:04:40 UTC (rev 3320)
+++ PyOpenDirectory/trunk/src/CDirectoryService.cpp 2008-11-05 20:11:59 UTC (rev 3321)
@@ -795,28 +795,28 @@
// Send: <length><recordname>
// <length><cleartextpassword>
// Receive: success or failure.
- long aDataBufSize = sizeof(long) + ::strlen(user) + sizeof(long) + ::strlen(pswd);
+ UInt32 aDataBufSize = sizeof(UInt32) + ::strlen(user) + sizeof(UInt32) + ::strlen(pswd);
authData = ::dsDataBufferAllocate(mDir, aDataBufSize);
if (authData == NULL)
ThrowIfDSErr(eDSNullDataBuff);
- long aCurLength = 0;
- long aTempLength = ::strlen(user);
- ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(long));
- aCurLength += sizeof(long);
+ UInt32 aCurLength = 0;
+ UInt32 aTempLength = ::strlen(user);
+ ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(UInt32));
+ aCurLength += sizeof(UInt32);
::memcpy(&(authData->fBufferData[aCurLength]), user, aTempLength);
aCurLength += aTempLength;
aTempLength = ::strlen(pswd);
- ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(long));
- aCurLength += sizeof(long);
+ ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(UInt32));
+ aCurLength += sizeof(UInt32);
::memcpy(&(authData->fBufferData[aCurLength]), pswd, aTempLength);
authData->fBufferLength = aDataBufSize;
// Do authentication
- long dirStatus = ::dsDoDirNodeAuth(node, authType, true, authData, mData, &context);
+ tDirStatus dirStatus = ::dsDoDirNodeAuth(node, authType, true, authData, mData, &context);
result = (dirStatus == eDSNoErr);
// Cleanup
@@ -894,45 +894,45 @@
// <length><response>
// <length><method>
// Receive: success or failure.
- long aDataBufSize = sizeof(long) + ::strlen(user) +
- sizeof(long) + ::strlen(challenge) +
- sizeof(long) + ::strlen(response) +
- sizeof(long) + ::strlen(method);
+ UInt32 aDataBufSize = sizeof(UInt32) + ::strlen(user) +
+ sizeof(UInt32) + ::strlen(challenge) +
+ sizeof(UInt32) + ::strlen(response) +
+ sizeof(UInt32) + ::strlen(method);
authData = ::dsDataBufferAllocate(mDir, aDataBufSize);
if (authData == NULL)
ThrowIfDSErr(eDSNullDataBuff);
- long aCurLength = 0;
- long aTempLength = ::strlen(user);
- ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(long));
- aCurLength += sizeof(long);
+ UInt32 aCurLength = 0;
+ UInt32 aTempLength = ::strlen(user);
+ ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(UInt32));
+ aCurLength += sizeof(UInt32);
::memcpy(&(authData->fBufferData[aCurLength]), user, aTempLength);
aCurLength += aTempLength;
aTempLength = ::strlen(challenge);
- ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(long));
- aCurLength += sizeof(long);
+ ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(UInt32));
+ aCurLength += sizeof(UInt32);
::memcpy(&(authData->fBufferData[aCurLength]), challenge, aTempLength);
aCurLength += aTempLength;
aTempLength = ::strlen(response);
- ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(long));
- aCurLength += sizeof(long);
+ ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(UInt32));
+ aCurLength += sizeof(UInt32);
::memcpy(&(authData->fBufferData[aCurLength]), response, aTempLength);
aCurLength += aTempLength;
aTempLength = ::strlen(method);
- ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(long));
- aCurLength += sizeof(long);
+ ::memcpy(&(authData->fBufferData[aCurLength]), &aTempLength, sizeof(UInt32));
+ aCurLength += sizeof(UInt32);
::memcpy(&(authData->fBufferData[aCurLength]), method, aTempLength);
authData->fBufferLength = aDataBufSize;
// Do authentication
- long dirStatus = ::dsDoDirNodeAuth(node, authType, true, authData, mData, &context);
+ tDirStatus dirStatus = ::dsDoDirNodeAuth(node, authType, true, authData, mData, &context);
result = (dirStatus == eDSNoErr);
// Cleanup
@@ -979,7 +979,7 @@
{
if (mDir == 0L)
{
- long dirStatus = ::dsOpenDirService(&mDir);
+ tDirStatus dirStatus = ::dsOpenDirService(&mDir);
if (dirStatus != eDSNoErr)
{
mDir = 0L;
@@ -1022,7 +1022,7 @@
//
tDirNodeReference CDirectoryService::OpenNamedNode(const char* nodename)
{
- long dirStatus = eDSNoErr;
+ tDirStatus dirStatus = eDSNoErr;
tDataListPtr nodePath = NULL;
tDirNodeReference result = NULL;
Modified: PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp 2008-11-04 20:04:40 UTC (rev 3320)
+++ PyOpenDirectory/trunk/src/CDirectoryServiceException.cpp 2008-11-05 20:11:59 UTC (rev 3321)
@@ -30,11 +30,11 @@
CDirectoryServiceException::CDirectoryServiceException()
{
- mDSError = -1;
+ mDSError = eUndefinedError;
::snprintf(mDescription, 1024, "Unknown Error");
}
-CDirectoryServiceException::CDirectoryServiceException(long error, const char* file, long line)
+CDirectoryServiceException::CDirectoryServiceException(tDirStatus error, const char* file, long line)
{
mDSError = error;
::snprintf(mDescription, 1024, "Exception raised in file %s at line %ld", file, line);
@@ -44,7 +44,7 @@
{
}
-void CDirectoryServiceException::ThrowDSError(long error, const char* file, long line)
+void CDirectoryServiceException::ThrowDSError(tDirStatus error, const char* file, long line)
{
CDirectoryServiceException dirStatus(error, file, line);
throw dirStatus;
Modified: PyOpenDirectory/trunk/src/CDirectoryServiceException.h
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryServiceException.h 2008-11-04 20:04:40 UTC (rev 3320)
+++ PyOpenDirectory/trunk/src/CDirectoryServiceException.h 2008-11-05 20:11:59 UTC (rev 3321)
@@ -19,21 +19,23 @@
#pragma once
+#include <DirectoryService/DirectoryService.h>
+
class CDirectoryServiceException
{
public:
CDirectoryServiceException();
- CDirectoryServiceException(long error, const char* file, long line);
+ CDirectoryServiceException(tDirStatus error, const char* file, long line);
~CDirectoryServiceException();
- static void ThrowDSError(long error, const char* file, long line);
+ static void ThrowDSError(tDirStatus error, const char* file, long line);
void SetPythonException();
private:
- long mDSError;
+ tDirStatus mDSError;
char mDescription[1024];
};
# define ThrowIfDSErr(x) { if (x != eDSNoErr) CDirectoryServiceException::ThrowDSError(x, __FILE__, __LINE__); }
-# define ThrowIfNULL(x) { if (x == NULL) CDirectoryServiceException::ThrowDSError(-1, __FILE__, __LINE__); }
+# define ThrowIfNULL(x) { if (x == NULL) CDirectoryServiceException::ThrowDSError(eUndefinedError, __FILE__, __LINE__); }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081105/bbaffb25/attachment.html>
More information about the calendarserver-changes
mailing list