X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/80e2389990082500d76eb566d4946be3e786c3ef..d8f41ccd20de16f8ebe2ccc84d47bf1cb2b26bbb:/libsecurity_transform/lib/Source.cpp diff --git a/libsecurity_transform/lib/Source.cpp b/libsecurity_transform/lib/Source.cpp deleted file mode 100644 index ad26b5b4..00000000 --- a/libsecurity_transform/lib/Source.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include "Source.h" -#include "Utilities.h" -#include "c++utils.h" - -#include - -using namespace std; - -Source::Source(CFStringRef sourceObjectName, Transform* destination, CFStringRef destinationName) : - CoreFoundationObject(sourceObjectName), - mDestination(destination), - mDestinationName(destinationName) -{ - CFStringRef queueName = CFStringCreateWithFormat(NULL, NULL, CFSTR("source:%@"), sourceObjectName); - char *queueName_cstr = utf8(queueName); - - mLastValue = NULL; - mDispatchQueue = MyDispatchQueueCreate(queueName_cstr, NULL); - free((void*)queueName_cstr); - CFRelease(queueName); -} - - - -Source::~Source() -{ - if (mLastValue != NULL) - { - CFRelease(mLastValue); - } - - dispatch_release(mDispatchQueue); -} - - - -void Source::Activate() -{ - dispatch_async(mDispatchQueue, ^{DoActivate();}); -} - - - -void Source::SetValue(CFTypeRef value) -{ - if (value == mLastValue) - { - return; - } - - if (mLastValue != NULL) // is there an existing value? If so, release it - { - CFRelease(mLastValue); - } - - if (value != NULL) - { - mLastValue = CFRetain(value); - } - else - { - mLastValue = NULL; - } -} - - - -Boolean Source::Equal(const CoreFoundationObject* obj) -{ - if (CoreFoundationObject::Equal(obj)) - { - const Source* objSource = (const Source*) obj; - if (objSource->mDestination == mDestination && - CFStringCompare(objSource->mDestinationName, mDestinationName, 0) == kCFCompareEqualTo) - { - return true; - } - } - - return false; -} - - - -std::string Source::DebugDescription() -{ - string result = CoreFoundationObject::DebugDescription() + ": Source "; - - char buffer[256]; - sprintf(buffer, "(Destination = %p, name = %s)", mDestination, StringFromCFString(mDestinationName).c_str()); - - result += buffer; - - return result; -} -