/*************************************************************************** * FUNCTION NAME * SpProfileSetLinkHeader * * DESCRIPTION * This function sets the fields of the header of the device link * profile pointed to by pProfile. * ***************************************************************************/ SpStatus_t SpProfileSetLinkHeader(SpProfile_t pProfile, SpDevLinkPB_p pDevLinkDesc) { SpHeader_t header, tempHeader; SpProfListEntry_p pCurProfEntry; SpStatus_t spStatus; /* Get the header from the profile */ spStatus = SpProfileGetHeader(pProfile, &header); if (SpStatSuccess != spStatus) { return spStatus; } /* Set the class information to device link */ header.DeviceClass = SpProfileClassLink; /* Set the device color spaces from the first profile in the list */ pCurProfEntry = pDevLinkDesc->pProfileList; spStatus = SpProfileGetHeader (pCurProfEntry->profile, &tempHeader); if (SpStatSuccess != spStatus) { return spStatus; } if (SpTransTypeIn == pCurProfEntry->whichTransform) { header.DataColorSpace = tempHeader.DataColorSpace; } else { header.DataColorSpace = tempHeader.InterchangeColorSpace; } /* Set the connection color spaces from the last profile in the list */ pCurProfEntry = pDevLinkDesc->pProfileList + (pDevLinkDesc->numProfiles - 1); spStatus = SpProfileGetHeader(pCurProfEntry->profile, &tempHeader); if (SpStatSuccess != spStatus) { return spStatus; } if (SpTransTypeOut == pCurProfEntry->whichTransform) { header.InterchangeColorSpace = tempHeader.DataColorSpace; } else { header.InterchangeColorSpace = tempHeader.InterchangeColorSpace; } /* Set the Device Manufacturer to "KODK" and the Device Model to "unkn" */ header.DeviceManufacturer = SpSigMfgKodak; header.DeviceModel = SpSigNone; header.Originator = SpSigOrgKodak; /* Write the updated header back to the profile */ spStatus = SpProfileSetHeader(pProfile, &header); return spStatus; } /* SpProfileSetLinkHeader */
static KpBool_t TestFile(KpfileDirEntry_t FAR *fileSearch, SpCallerId_t CallerId, SpStatus_t *ReturnStatus, SpSearch_t *SearchCriterion, SpProfile_t *profileList, KpInt32_t listSize, KpInt32_t TotalAvailable, KpInt32_t *CurrentIndex) { SpProfile_t *profPtr; SpHeader_t Header; SpStatus_t Status; SpFileProps_t FileProp; SpProfileData_t FAR *ProfData; KpBool_t returnBool = KPTRUE; /* assume we will continue */ char *filename; KpInt32_t searchMode = SEARCH_RECURSIVE | SPSEARCHFORALL; SpDataBase_t DataBase; char Dir1[MAX_PATH]; SpDataBaseEntry_t List[1]; #if defined (KPMAC) KpUInt16_t vRefNumSave; KpUInt32_t dirIDSave; int i; #endif if ((fileSearch->opStatus == IOFILE_FINISHED) || (fileSearch->opStatus == IOFILE_STARTED) || (fileSearch->opStatus == IOFILE_ERROR)) { return returnBool; } #if defined (KPMAC) FileProp.vRefNum = fileSearch->osfPrivate.parm.dirInfo.ioVRefNum; FileProp.dirID = fileSearch->osfPrivate.parm.dirInfo.ioDrParID; #endif /* Search into sub-directories */ if (IsDirectory(fileSearch)) { DataBase.numEntries = 1; if (fileSearch->nwAttr & ATTR_DIRECTORY) searchMode |= SEARCH_NOT_RECURSIVE; if (fileSearch->nwAttr & ATTR_LINK) searchMode |= SEARCH_NOT_RESOLVE_ALIAS; #if defined (KPMAC) // Setup vRefNum/DirID of subdirectory. Save original and restore vefore returning List[0].fileProps.vRefNum = fileSearch->osfPrivate.parm.dirInfo.ioVRefNum; List[0].fileProps.dirID = fileSearch->osfPrivate.parm.dirInfo.ioDrParID; vRefNumSave = fileSearch->osfPrivate.vRefNum; dirIDSave = fileSearch->osfPrivate.dirID; // Only search one level of subdirectory on Mac searchMode |= SEARCH_NOT_RECURSIVE; #endif #if defined (KPUNIX) strcpy(Dir1, fileSearch->osfPrivate.base_Dir); strcat(Dir1, "/"); strcat(Dir1, fileSearch->fileName); #else strcpy(Dir1, fileSearch->fileName); #endif List[0].dirName = (char *)Dir1; DataBase.Entries = List; Status = SpSearchEngine(CallerId, &DataBase, SearchCriterion, KPFALSE, profileList, listSize, CurrentIndex, searchMode, (KpfileCallBack_t)TestFileCB); #if defined (KPMAC) fileSearch->osfPrivate.vRefNum = vRefNumSave; fileSearch->osfPrivate.dirID = dirIDSave; #endif if (Status == SpStatSuccess) return KPTRUE; else return KPFALSE; } Status = SpProfileLoadHeader(fileSearch->fileName, &FileProp, &Header); if (Status == SpStatSuccess) { Status = SpProfileCheck(SearchCriterion, &Header); if (Status == SpStatSuccess) { if (*CurrentIndex < listSize) { profPtr = &profileList[*CurrentIndex]; Status = SpProfileAlloc(CallerId, profPtr, &ProfData); if (Status == SpStatSuccess) { if ((Status = SpProfileSetHeader(*profPtr, &Header)) == SpStatSuccess) { ProfData->FileName = allocBufferHandle( strlen(fileSearch->fileName) + 1); if (ProfData->FileName == 0) { SpProfileFree(profPtr); return KPFALSE; } filename = (char *)lockBuffer(ProfData->FileName); if (filename == 0) { freeBuffer(ProfData->FileName); SpProfileFree(profPtr); return KPFALSE; } strcpy(filename, fileSearch->fileName); unlockBuffer (ProfData->FileName); ProfData->TotalCount = 0; freeBuffer(ProfData->TagArray); ProfData->TagArray = NULL; #if defined (KPMAC) ProfData->Props.vRefNum = fileSearch->osfPrivate.vRefNum; ProfData->Props.dirID = fileSearch->osfPrivate.dirID; for (i= 0; i < 5; i++) { ProfData->Props.fileType[i] = NULL; ProfData->Props.creatorType[i] = NULL; } #endif (*CurrentIndex)++; if ((*CurrentIndex >= listSize) && (TotalAvailable == 0)) returnBool = KPFALSE; } else { *ReturnStatus = Status; returnBool = KPFALSE; } /* if SpProfileSetHeader */ SpProfileUnlock(*profPtr); } else { *ReturnStatus = (KpInt32_t)Status; returnBool = KPFALSE; } /* if SpProfileAlloc */ } else (*CurrentIndex)++; } /* if SpProfileCheck */ } /* if SpProfileLoadHeader */ return returnBool; }