mirror of
https://github.com/transmission/transmission.git
synced 2026-04-20 00:40:03 +01:00
modify the Quick Look plugin's main.c
This commit is contained in:
@@ -92,19 +92,19 @@ static QLGeneratorInterfaceStruct myInterfaceFtbl = {
|
||||
QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID)
|
||||
{
|
||||
QuickLookGeneratorPluginType *theNewInstance;
|
||||
|
||||
|
||||
theNewInstance = (QuickLookGeneratorPluginType *)malloc(sizeof(QuickLookGeneratorPluginType));
|
||||
memset(theNewInstance,0,sizeof(QuickLookGeneratorPluginType));
|
||||
|
||||
/* Point to the function table Malloc enough to store the stuff and copy the filler from myInterfaceFtbl over */
|
||||
|
||||
/* Point to the function table Malloc enough to store the stuff and copy the filler from myInterfaceFtbl over */
|
||||
theNewInstance->conduitInterface = malloc(sizeof(QLGeneratorInterfaceStruct));
|
||||
memcpy(theNewInstance->conduitInterface,&myInterfaceFtbl,sizeof(QLGeneratorInterfaceStruct));
|
||||
|
||||
/* Retain and keep an open instance refcount for each factory. */
|
||||
|
||||
/* Retain and keep an open instance refcount for each factory. */
|
||||
theNewInstance->factoryID = CFRetain(inFactoryID);
|
||||
CFPlugInAddInstanceForFactory(inFactoryID);
|
||||
|
||||
/* This function returns the IUnknown interface so set the refCount to one. */
|
||||
|
||||
/* This function returns the IUnknown interface so set the refCount to one. */
|
||||
theNewInstance->refCount = 1;
|
||||
return theNewInstance;
|
||||
}
|
||||
@@ -120,12 +120,12 @@ QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFact
|
||||
void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance)
|
||||
{
|
||||
CFUUIDRef theFactoryID;
|
||||
|
||||
|
||||
theFactoryID = thisInstance->factoryID;
|
||||
/* Free the conduitInterface table up */
|
||||
/* Free the conduitInterface table up */
|
||||
free(thisInstance->conduitInterface);
|
||||
|
||||
/* Free the instance structure */
|
||||
|
||||
/* Free the instance structure */
|
||||
free(thisInstance);
|
||||
if (theFactoryID){
|
||||
CFPlugInRemoveInstanceForFactory(theFactoryID);
|
||||
@@ -141,14 +141,14 @@ void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInsta
|
||||
HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv)
|
||||
{
|
||||
CFUUIDRef interfaceID;
|
||||
|
||||
|
||||
interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault,iid);
|
||||
|
||||
|
||||
if (CFEqual(interfaceID,kQLGeneratorCallbacksInterfaceID)){
|
||||
/* If the Right interface was requested, bump the ref count,
|
||||
* set the ppv parameter equal to the instance, and
|
||||
* return good status.
|
||||
*/
|
||||
/* If the Right interface was requested, bump the ref count,
|
||||
* set the ppv parameter equal to the instance, and
|
||||
* return good status.
|
||||
*/
|
||||
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GenerateThumbnailForURL = GenerateThumbnailForURL;
|
||||
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelThumbnailGeneration = CancelThumbnailGeneration;
|
||||
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GeneratePreviewForURL = GeneratePreviewForURL;
|
||||
@@ -202,17 +202,17 @@ void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID)
|
||||
{
|
||||
QuickLookGeneratorPluginType *result;
|
||||
CFUUIDRef uuid;
|
||||
|
||||
/* If correct type is being requested, allocate an
|
||||
* instance of kQLGeneratorTypeID and return the IUnknown interface.
|
||||
*/
|
||||
|
||||
/* If correct type is being requested, allocate an
|
||||
* instance of kQLGeneratorTypeID and return the IUnknown interface.
|
||||
*/
|
||||
if (CFEqual(typeID,kQLGeneratorTypeID)){
|
||||
uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID));
|
||||
result = AllocQuickLookGeneratorPluginType(uuid);
|
||||
CFRelease(uuid);
|
||||
return result;
|
||||
}
|
||||
/* If the requested type is incorrect, return NULL. */
|
||||
/* If the requested type is incorrect, return NULL. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user