mirror of
https://github.com/transmission/transmission
synced 2025-02-21 21:57:01 +00:00
modify the Quick Look plugin's main.c
This commit is contained in:
parent
1d58e9df1b
commit
3d4f9a140c
2 changed files with 23 additions and 23 deletions
|
@ -1108,7 +1108,7 @@
|
|||
A2F35BC715C5A0A100EBF632 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
A2F35BC915C5A0A100EBF632 /* GenerateThumbnailForURL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = GenerateThumbnailForURL.m; path = macosx/QuickLookPlugin/GenerateThumbnailForURL.m; sourceTree = SOURCE_ROOT; };
|
||||
A2F35BCB15C5A0A100EBF632 /* GeneratePreviewForURL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = GeneratePreviewForURL.m; path = macosx/QuickLookPlugin/GeneratePreviewForURL.m; sourceTree = SOURCE_ROOT; };
|
||||
A2F35BCD15C5A0A100EBF632 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = main.c; path = macosx/QuickLookPlugin/main.c; sourceTree = SOURCE_ROOT; };
|
||||
A2F35BCD15C5A0A100EBF632 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = main.c; path = macosx/QuickLookPlugin/main.c; sourceTree = "<group>"; };
|
||||
A2F35BCF15C5A0A100EBF632 /* QuickLookPlugin-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "QuickLookPlugin-Prefix.pch"; path = "macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch"; sourceTree = SOURCE_ROOT; };
|
||||
A2F35BE015C5A7ED00EBF632 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
||||
A2F35BE215C5A7F900EBF632 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue