CPipeConnectSuccResult::CPipeConnectSuccResult( int32 nPipeId, uint32 uSessionID, const CAddress& LocalAddr, const CAddress& RemoteAddr, CPipeThread* pThread) : CPipeResult(nPipeId, uSessionID) { m_szLocalAddr = CloneString(LocalAddr.GetAddress(), pThread); m_uLocalPort = LocalAddr.GetPort(); m_szRemoteAddr = CloneString(RemoteAddr.GetAddress(), pThread); m_uRemotePort = RemoteAddr.GetPort(); }
bool CloneFieldDef(const char* sLogName, CRdbFieldDef* &pDstFieldDefines, CRdbFieldDef* pSrcFieldDefines, uint32 nFieldCount) { uint32 i; pDstFieldDefines = NULL; if(nFieldCount) { pDstFieldDefines = new CRdbFieldDef[nFieldCount]; if(!pDstFieldDefines) { FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneFieldDef(%s): RDB_LACK_MEMORY")); return false; } CBinary::MemorySet(pDstFieldDefines, 0, nFieldCount*sizeof(CRdbFieldDef)); for(i=0; i<nFieldCount; ++i) { pDstFieldDefines[i] = pSrcFieldDefines[i]; pDstFieldDefines[i].nJob = 1; pDstFieldDefines[i].sFieldName = CloneString(sLogName, pSrcFieldDefines[i].sFieldName); pDstFieldDefines[i].sDefault = NULL; char * sDefault = pSrcFieldDefines[i].sDefault; if(sDefault && sDefault[0]) pDstFieldDefines[i].sDefault = CloneString(sLogName, sDefault); if(!pDstFieldDefines[i].sFieldName || (!pDstFieldDefines[i].sDefault && sDefault)) { FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneFieldDef(%s): RDB_LACK_MEMORY", pSrcFieldDefines[i].sFieldName)); if(pDstFieldDefines[i].sFieldName) delete[] pDstFieldDefines[i].sFieldName; if(pDstFieldDefines[i].sDefault) delete[] pDstFieldDefines[i].sDefault; for(uint32 j=0; j<i; ++i) FreeFieldDefine(pDstFieldDefines[j]); delete[] pDstFieldDefines; pDstFieldDefines = NULL; return false; } } for(i=0; i<nFieldCount; ++i) { if(CorrectFieldAttr(sLogName, pDstFieldDefines+i)) { FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneFieldDef(%s) Failure", pDstFieldDefines[i].sFieldName)); for(i=0; i<nFieldCount; ++i) FreeFieldDefine(pDstFieldDefines[i]); delete[] pDstFieldDefines; pDstFieldDefines = NULL; return false; } } } return true; }
CPipeAcceptedResult::CPipeAcceptedResult(int32 nPipeId,uint32 uSessionID, int32 newPipeId, uint32 threadId, uint32 oldthreadid, IPipe* pPipe, const CAddress& LocalAddr, const CAddress& RemoteAddr, CPipeThread* pThread) :CPipeResult(nPipeId, uSessionID) { m_szLocalAddr = CloneString( LocalAddr.GetAddress(), pThread ); m_uLocalPort = LocalAddr.GetPort(); m_szRemoteAddr = CloneString( RemoteAddr.GetAddress(), pThread ); m_uRemotePort = RemoteAddr.GetPort(); m_pPipe = pPipe; m_uOldThreadId = oldthreadid; m_nNewPipeID = newPipeId; m_uThreadId = threadId; }
STRING_LIST* SplitStringByWhitespace ( IN CHAR8 *String ) /*++ Routine Description: Creates and returns a 'split' STRING_LIST by splitting the string on whitespace boundaries. Arguments: String The string to 'split' Returns: EFI_STATUS --*/ { CHAR8 *Pos; CHAR8 *EndOfSubString; CHAR8 *EndOfString; STRING_LIST *Output; UINTN Item; String = CloneString (String); if (String == NULL) { return NULL; } EndOfString = String + strlen (String); Output = NewStringList (); for (Pos = String, Item = 0; Pos < EndOfString; Item++) { while (isspace ((int)*Pos)) { Pos++; } for (EndOfSubString=Pos; (*EndOfSubString != '\0') && !isspace ((int)*EndOfSubString); EndOfSubString++ ) { } if (EndOfSubString == Pos) { break; } *EndOfSubString = '\0'; AppendCopyOfStringToList (&Output, Pos); Pos = EndOfSubString + 1; } free (String); return Output; }
void Magick::Options::density(const Point &density_) { if (!density_.isValid()) _imageInfo->density=(char *) RelinquishMagickMemory(_imageInfo->density); else CloneString(&_imageInfo->density,density_); }
int main ( int argc, char **argv ) { Image *canvas = (Image *)NULL; char outfile[MaxTextExtent]; int rows, columns = 0; char size[MaxTextExtent]; ImageInfo *image_info; ExceptionInfo exception; if ( argc != 2 ) { (void) printf ( "Usage: %s filename\n", argv[0] ); exit( 1 ); } outfile[MaxTextExtent-1]='\0'; (void) strncpy( outfile, argv[1], MaxTextExtent-1 ); if (LocaleNCompare("drawtest",argv[0],7) == 0) InitializeMagick((char *) NULL); else InitializeMagick(*argv); /* * Create canvas image */ columns=596; rows=842; image_info=CloneImageInfo((ImageInfo*)NULL); GetExceptionInfo( &exception ); FormatString(size, "%dx%d", columns, rows); (void) CloneString(&image_info->size, size); (void) strcpy( image_info->filename, "xc:white"); canvas = ReadImage ( image_info, &exception ); if (exception.severity != UndefinedException) CatchException(&exception); if ( canvas == (Image *)NULL ) { (void) printf ( "Failed to read canvas image %s\n", image_info->filename ); exit(1); } /* * Scribble on image */ ScribbleImage( canvas ); /* * Save image to file */ canvas->filename[MaxTextExtent-1]='\0'; (void) strncpy( canvas->filename, outfile, MaxTextExtent-1); (void) WriteImage ( image_info, canvas ); DestroyExceptionInfo( &exception ); DestroyImage( canvas ); DestroyImageInfo( image_info ); DestroyMagick(); return 0; }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % M a g i c k Q u e r y M u l t i l i n e F o n t M e t r i c s % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % MagickQueryMultilineFontMetrics() returns a 13 element array representing the % following font metrics: % % Element Description % ------------------------------------------------- % 0 character width % 1 character height % 2 ascender % 3 descender % 4 text width % 5 text height % 6 maximum horizontal advance % 7 bounding box: x1 % 8 bounding box: y1 % 9 bounding box: x2 % 10 bounding box: y2 % 11 origin: x % 12 origin: y % % This method is like MagickQueryFontMetrics() but it returns the maximum text % width and height for multiple lines of text. % % The format of the MagickQueryFontMetrics method is: % % double *MagickQueryMultilineFontMetrics(MagickWand *wand, % const DrawingWand *drawing_wand,const char *text) % % A description of each parameter follows: % % o wand: the Magick wand. % % o drawing_wand: the drawing wand. % % o text: the text. % */ WandExport double *MagickQueryMultilineFontMetrics(MagickWand *wand, const DrawingWand *drawing_wand,const char *text) { double *font_metrics; DrawInfo *draw_info; MagickBooleanType status; TypeMetric metrics; assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); assert(drawing_wand != (const DrawingWand *) NULL); if (wand->images == (Image *) NULL) { (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, "ContainsNoImages","`%s'",wand->name); return((double *) NULL); } font_metrics=(double *) AcquireQuantumMemory(13UL,sizeof(*font_metrics)); if (font_metrics == (double *) NULL) return((double *) NULL); draw_info=PeekDrawingWand(drawing_wand); if (draw_info == (DrawInfo *) NULL) { font_metrics=(double *) RelinquishMagickMemory(font_metrics); return((double *) NULL); } (void) CloneString(&draw_info->text,text); (void) ResetMagickMemory(&metrics,0,sizeof(metrics)); status=GetMultilineTypeMetrics(wand->images,draw_info,&metrics, wand->exception); draw_info=DestroyDrawInfo(draw_info); if (status == MagickFalse) { font_metrics=(double *) RelinquishMagickMemory(font_metrics); return((double *) NULL); } font_metrics[0]=metrics.pixels_per_em.x; font_metrics[1]=metrics.pixels_per_em.y; font_metrics[2]=metrics.ascent; font_metrics[3]=metrics.descent; font_metrics[4]=metrics.width; font_metrics[5]=metrics.height; font_metrics[6]=metrics.max_advance; font_metrics[7]=metrics.bounds.x1; font_metrics[8]=metrics.bounds.y1; font_metrics[9]=metrics.bounds.x2; font_metrics[10]=metrics.bounds.y2; font_metrics[11]=metrics.origin.x; font_metrics[12]=metrics.origin.y; return(font_metrics); }
char * RString::GetBuffer(void) { if(RefCount() > 0) { CloneString(); return myString; } return myString; //are we sure this is safe? }
LinuxEcatHardware::LinuxEcatHardware( const char *name ) { if( !name ) name = "eth0"; fd = -1; ifname = CloneString( name ); SetRefName( "LinuxEcatHw" ); }
bool CloneIndexDef(const char* sLogName, CRdbIndexDef & oDstIndexDef, CRdbIndexDef & oSrcIndexDef) { oDstIndexDef = oSrcIndexDef; oDstIndexDef.sIndexName = CloneString(sLogName, oSrcIndexDef.sIndexName); if(!oDstIndexDef.sIndexName) { FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneIndexDef: RDB_LACK_MEMORY")); return false; } oDstIndexDef.sTableName = CloneString(sLogName, oSrcIndexDef.sTableName); if(!oDstIndexDef.sTableName) { FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneIndexDef: RDB_LACK_MEMORY")); delete[] oDstIndexDef.sIndexName; return false; } if(oSrcIndexDef.sPrimaryIndex) { oDstIndexDef.sPrimaryIndex = CloneString(sLogName, oSrcIndexDef.sPrimaryIndex); if(!oDstIndexDef.sPrimaryIndex) { FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneIndexDef: RDB_LACK_MEMORY")); delete[] oDstIndexDef.sIndexName; delete[] oDstIndexDef.sTableName; return false; } } if(oSrcIndexDef.pFieldList) { oDstIndexDef.pFieldList = CloneString(sLogName, oSrcIndexDef.pFieldList); if(!oDstIndexDef.pFieldList) { FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneIndexDef: RDB_LACK_MEMORY")); delete[] oDstIndexDef.sIndexName; delete[] oDstIndexDef.sTableName; if(oDstIndexDef.sPrimaryIndex) delete[] oDstIndexDef.sPrimaryIndex; return false; } } oDstIndexDef.nIndexNo = oSrcIndexDef.nIndexNo; oDstIndexDef.nStorageAddr = 0; return true; }
void Filesets_Restore_OnEndTask_LookupFileset (HWND hDlg, LPTASKPACKET ptp, LPSET_RESTORE_PARAMS psrp) { if (ptp) { psrp->lpi = (ptp->rc) ? TASKDATA(ptp)->lpi : NULL; } if (!psrp->lpi) { psrp->lpi = (LPIDENT)FL_GetSelectedData (GetDlgItem (hDlg, IDC_AGG_LIST)); } BOOL fCreate = (psrp->lpi && psrp->lpi->fIsFileset()) ? FALSE : TRUE; TCHAR szFileset[ cchNAME ]; GetDlgItemText (hDlg, IDC_RESTORE_SETNAME, szFileset, cchNAME); LPTSTR pszText; if (szFileset[0] == TEXT('\0')) { pszText = CloneString (TEXT("")); } else if (fCreate) { pszText = FormatString (IDS_RESTORE_CREATESET, TEXT("%s"), szFileset); } else { TCHAR szServer[ cchNAME ]; TCHAR szAggregate[ cchNAME ]; psrp->lpi->GetServerName (szServer); psrp->lpi->GetAggregateName (szAggregate); pszText = FormatString (IDS_RESTORE_OVERWRITESET, TEXT("%s%s%s"), szServer, szAggregate, szFileset); } SetDlgItemText (hDlg, IDC_RESTORE_CREATE, pszText); FreeString (pszText); EnableWindow (GetDlgItem (hDlg, IDC_RESTORE_SERVER), fCreate); EnableWindow (GetDlgItem (hDlg, IDC_AGG_LIST), fCreate); if (psrp->lpi) { LPIDENT lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_RESTORE_SERVER)); if (psrp->lpi->GetServer() != lpiServer) { CB_SetSelectedByData (GetDlgItem (hDlg, IDC_RESTORE_SERVER), (LPARAM)psrp->lpi->GetServer()); Filesets_Restore_OnSelectServer (hDlg, psrp); } else if (!psrp->lpi->fIsServer()) { FL_SetSelectedByData (GetDlgItem (hDlg, IDC_AGG_LIST), (LPARAM)psrp->lpi->GetAggregate()); } } Filesets_Restore_EnableOK (hDlg, psrp); }
/** Create an EtherCAT hardware interface which uses UDP formatted messages. This is the only type of EtherCAT interface that can be used under Windows without installing special drivers. The low level EtherCAT protocol normally does not use an IP address, however since this driver transmits EtherCAT packets over UDP/IP, the Ethernet interface used with this driver must have a valid IP address assigned. In addition, the network mask associated with the Ethernet interface should be defined in such a way that no other network interface on the same PC is a member of the same network. That is, if multiple interfaces are installed then they should be allocated to seperate networks. i.e. ( IP1 & mask1 ) != (IP2 & mask2) where IP1 and mask1 are the IP address and net mask of the first interface, and IP2 and mask2 are for the second interface. For example, the following two interfaces are on different networks: IP: 192.168.1.1 mask: 255.255.255.0 IP: 192.168.2.1 mask: 255.255.255.0 but the following two interfaces are on the same network: IP: 192.168.1.1 mask: 255.255.255.0 IP: 192.168.1.2 mask: 255.255.255.0 This is important because this drive has no direct control of which interface the packets are being sent out. This is entirely controlled by the upper layer routing algorithms in the windows network stack. The name parameter passed to this function can be used to identify which interface this object should bind to. It can take any of the following forms: - If not specified, then the first valid interface found will be used. This is useful if there's only one interface on the PC. - If of the form; eth0, eth1, eth2, etc, then the nth valid interface will be used. - For more control, the IP address of the desired interface can be passed. This should be sent as a string in dotted decimal notation. For example: "192.168.1.1" @param name Used to identify the Ethernet interface as described above. */ WinUdpEcatHardware::WinUdpEcatHardware( const char *name ) { hndl = 0; recv = 0; if( !name ) ifname = 0; else ifname = CloneString( name ); SetRefName( "UdpEcatHw" ); }
// This function allows for a sub task to be started. This does not create // a new task or redirect messages, only changes possible UI for a sub // task that is being performed as part of a larger task. When you switch // to a task, that task also becomes the active subtask bool CBackEndDialog::ActivateSubTask(const char* pszSubTaskName) { //copy the string (it could be lost on this thread by the time it gets to the other //thread) char* pszSubTask = CloneString(pszSubTaskName); PostMessage(USER_COMMAND_ACTIVATE_SUBTASK, (WPARAM)pszSubTask); return true; }
//-------------------------------------------------------------------------------------------------------------- CHintMessage::CHintMessage( const char * hintString, CUtlVector< const char * > * args, float duration ) { m_hintString = hintString; m_duration = duration; if ( args ) { for ( int i=0; i<args->Count(); ++i ) { m_args.AddToTail( CloneString( (*args)[i] ) ); } } }
//-------------------------------------------------------------------------------------------------------------- void DownloadManager::MarkMapAsDownloadedFromServer( const char *serverMapName ) { if ( !serverMapName ) return; if ( HasMapBeenDownloadedFromServer( serverMapName ) ) return; m_downloadedMaps.AddToTail( CloneString( serverMapName ) ); return; }
plKey::~plKey() { #if TRACK_REFS // FOR DEBUGGING ONLY if( IsTracked(fKeyData) ) { char msg[ 512 ]; sprintf( msg, "D: Key %s %s is being destructed", keyNameToLookFor, CloneString(fKeyData) ); //hsAssert( false, msg ); hsStatusMessageF(msg); } #endif IDecRef(); }
// return index of the (custom) bot phrase db, inserting it if needed int BotProfileManager::FindVoiceBankIndex(const char *filename) { int index = 0; for (auto phrase : m_voiceBanks) { if (!Q_stricmp(filename, phrase)) return index; index++; } m_voiceBanks.push_back(CloneString(filename)); return index; }
void RString::Clone(RString& clone_to) { /* makes shared copy */ clone_to.SafeDealloc(); if(!myString) return (void)(clone_to.myString = NULL); if(RefCount() > 250) CloneString(); SetRefCount(RefCount() == 0 ? 2 : RefCount() + 1); clone_to.myString = myString; return; }
/* <4a8916> ../game_shared/bot/bot_profile.cpp:647 */ int BotProfileManager::FindVoiceBankIndex(const char *filename) { int index = 0; for (VoiceBankList::const_iterator it = m_voiceBanks.begin(); it != m_voiceBanks.end(); ++it, ++index) { if (!Q_stricmp(filename, *it)) { return index; } } m_voiceBanks.push_back(CloneString(filename)); return index; }
void EnumeratePrincipalsRemotely (LPBROWSEDIALOGPARAMS pbdp, UINT_PTR idClient) { ULONG status; // Open the relevant cell // ASID idCell; if (asc_CellOpen (idClient, (PVOID)pbdp->hCreds, pbdp->szThreadCell, AFSADMSVR_SCOPE_USERS, &idCell, &status)) { // Obtain a list of ASIDs from the admin server, each representing // a principal which we want to show. // LPASIDLIST pAsidList; if (asc_ObjectFindMultiple (idClient, idCell, TYPE_USER, NULL, NULL, &pAsidList, &status)) { if (pAsidList) { // Obtain rudimentary properties (e.g., their names) for these ASIDs // LPASOBJPROPLIST pPropList; if (asc_ObjectPropertiesGetMultiple (idClient, GET_RUDIMENTARY_DATA, idCell, pAsidList, &pPropList, &status)) { if (pPropList) { // Use the information in {pPropList} to populate the display // for (size_t iEntry = 0; iEntry < pPropList->cEntries; ++iEntry) { LPTSTR pszName; if ((pszName = CloneString (pPropList->aEntries[ iEntry ].ObjectProperties.szName)) != NULL) { PostMessage (pbdp->hDlg, WM_FOUNDNAME, 0, (LPARAM)pszName); // pszName freed by DlgProc_Browse when it receives the message } } asc_ObjPropListFree (&pPropList); } } asc_AsidListFree (&pAsidList); } } asc_CellClose (idClient, idCell, &status); } }
EFI_STATUS AppendCopyOfStringToList ( IN OUT STRING_LIST **StringList, IN CHAR8 *String ) /*++ Routine Description: Adds String to StringList. A new copy of String is made before it is added to StringList. Returns: EFI_STATUS --*/ { STRING_LIST *OldList; STRING_LIST *NewList; CHAR8 *NewString; OldList = *StringList; NewList = AllocateStringListStruct (OldList->Count + 1); if (NewList == NULL) { return EFI_OUT_OF_RESOURCES; } NewString = CloneString (String); if (NewString == NULL) { free (NewList); return EFI_OUT_OF_RESOURCES; } memcpy ( NewList->Strings, OldList->Strings, sizeof (OldList->Strings[0]) * OldList->Count ); NewList->Count = OldList->Count + 1; NewList->Strings[OldList->Count] = NewString; *StringList = NewList; free (OldList); return EFI_SUCCESS; }
CHintMessage::CHintMessage(const char *hintString, bool isHint, CUtlVector< const char* > *args, float duration) { // m_args.m_Memory.m_pMemory = 0; // m_args.m_Memory.m_NumAllocated = 0; // m_args.m_Memory.m_GrowSize = 0; m_hintString = hintString; m_duration = duration; if (args) { for (int i = 0; i < args->Count(); ++i) { m_args.AddToTail(CloneString((*args)[i])); } } }
//----------------------------------------------------------------------------- // Purpose: Register a new timer that the system should should keep track of. // Input : iHintID - The ID of the hint message // timer_duration - the total time the timer should run for until it fires the hint message // message_duration - the duration passed into the hint message system when the hint fires // args - the arguments passed into the hint message system when the hint fires //----------------------------------------------------------------------------- void CHintMessageTimers::AddTimer( int iHintID, float timer_duration, float message_duration, CUtlVector< const char * > * args ) { if ( GetTimerIndex(iHintID) != m_Timers.InvalidIndex() ) return; // 'message' is not copied, so the pointer must remain valid forever hintmessagetime_t *newTimer = new hintmessagetime_t( timer_duration ); newTimer->iHintID = iHintID; newTimer->flMessageDuration = message_duration; if ( args ) { for ( int i=0; i<args->Count(); ++i ) { newTimer->args.AddToTail( CloneString( (*args)[i] ) ); } } m_Timers.AddToTail( newTimer ); //Warning("TIMER ADDED: %s\n", m_pszHintMessages[iHintID] ); }
void Browse_UpdateDialog (HWND hDlg) { LPBROWSE_PARAMS lpp; if ((lpp = (LPBROWSE_PARAMS)GetWindowLongPtr (hDlg, DWLP_USER)) != NULL) { lpp->fQuerying ++; // First we'll need to empty the list, and add some non-selectable thing // that says "querying" // HWND hList = GetDlgItem (hDlg, IDC_BROWSE_LIST); FastList_Begin (hList); FastList_RemoveAll (hList); TCHAR szText[ cchRESOURCE ]; GetString (szText, IDS_QUERYING_LONG); FASTLISTADDITEM flai; memset (&flai, 0x00, sizeof(flai)); flai.iFirstImage = IMAGE_NOIMAGE; flai.iSecondImage = IMAGE_NOIMAGE; flai.pszText = szText; flai.dwFlags = FLIF_DISALLOW_SELECT; FastList_AddItem (hList, &flai); FastList_End (hList); // Then start a background task to obtain the appropriate list // of stuff to show. When that task completes, we'll populate the // list. // TCHAR szPattern[ cchNAME ]; GetDlgItemText (hDlg, IDC_BROWSE_PATTERN, szPattern, cchNAME); LPTSTR pszPattern = NULL; if (szPattern[0] != TEXT('\0')) pszPattern = CloneString (szPattern); StartTask ((Browse_GetSelectedType (hDlg) == TYPE_USER) ? taskUSER_ENUM : taskGROUP_ENUM, hDlg, pszPattern); } }
bool CloneTableDef(const char* sLogName, CRdbTableDef & oDstTableDef, CRdbTableDef & oSrcTableDef) { oDstTableDef.sTableName = CloneString(sLogName, oSrcTableDef.sTableName); if(!oDstTableDef.sTableName) { FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneTableDef(%s): RDB_LACK_MEMORY", oSrcTableDef.sTableName)); return false; } if(!CloneFieldDef(sLogName, oDstTableDef.pFieldDefines, oSrcTableDef.pFieldDefines, oSrcTableDef.nFieldCount)) { FocpLogEx(sLogName, FOCP_LOG_ERROR, ("CloneTableDef(%s): RDB_LACK_MEMORY", oSrcTableDef.sTableName)); delete[] oDstTableDef.sTableName; return false; } oDstTableDef.nFieldCount = oSrcTableDef.nFieldCount; oDstTableDef.nStorage = oSrcTableDef.nStorage;//default cache none. oDstTableDef.nMaxJob = 1; oDstTableDef.nTableNo = oSrcTableDef.nTableNo; oDstTableDef.nStorageAddr = 0; return true; }
CHAR8* LookupGuidedSectionToolPath ( IN EFI_HANDLE ParsedGuidedSectionToolsHandle, IN EFI_GUID *SectionGuid ) /*++ Routine Description: This function looks up the appropriate tool to use for extracting a GUID defined FV section. Arguments: ParsedGuidedSectionToolsHandle A parsed GUID section tools handle. SectionGuid The GUID for the section. Returns: NULL - if no tool is found or there is another error Non-NULL - The tool to use to access the section contents. (The caller must free the memory associated with this string.) --*/ { GUID_SEC_TOOL_ENTRY *GuidTool; GuidTool = (GUID_SEC_TOOL_ENTRY*)ParsedGuidedSectionToolsHandle; if (GuidTool == NULL) { return NULL; } for ( ; GuidTool != NULL; GuidTool = GuidTool->Next) { if (CompareGuid (&(GuidTool->Guid), SectionGuid) == 0) { return CloneString (GuidTool->Path); } } return NULL; }
//-------------------------------------------------------------------------------------------------------------- void DownloadCache::BuildKeyNames( const char *gamePath ) { if ( !gamePath ) { m_cachefileKey[0] = 0; m_timestampKey[0] = 0; return; } char *tmpGamePath = CloneString( gamePath ); char *tmp = tmpGamePath; while ( *tmp ) { if ( *tmp == '/' || *tmp == '\\' ) { *tmp = '_'; } ++tmp; } Q_snprintf( m_cachefileKey, sizeof( m_cachefileKey ), "cachefile_%s", tmpGamePath ); Q_snprintf( m_timestampKey, sizeof( m_timestampKey ), "timestamp_%s", tmpGamePath ); delete[] tmpGamePath; }
void Magick::Options::textEncoding(const std::string &encoding_) { CloneString(&_drawInfo->encoding,encoding_.c_str()); (void) SetImageOption(imageInfo(),"encoding",encoding_.c_str()); }
// Annotation text encoding (e.g. "UTF-16") void Magick::Options::textEncoding ( const std::string &encoding_ ) { CloneString(&_drawInfo->encoding, encoding_.c_str()); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % R e a d T E X T I m a g e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % ReadTEXTImage() reads a text file and returns it as an image. It % allocates the memory necessary for the new Image structure and returns a % pointer to the new image. % % The format of the ReadTEXTImage method is: % % Image *ReadTEXTImage(const ImageInfo *image_info,Image *image, % char *text,ExceptionInfo *exception) % % A description of each parameter follows: % % o image_info: the image info. % % o image: the image. % % o text: the text storage buffer. % % o exception: return any errors or warnings in this structure. % */ static Image *ReadTEXTImage(const ImageInfo *image_info,Image *image, char *text,ExceptionInfo *exception) { char filename[MaxTextExtent], geometry[MaxTextExtent], *p; DrawInfo *draw_info; Image *texture; MagickBooleanType status; PointInfo delta; RectangleInfo page; ssize_t offset; TypeMetric metrics; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); /* Set the page geometry. */ delta.x=DefaultResolution; delta.y=DefaultResolution; if ((image->x_resolution == 0.0) || (image->y_resolution == 0.0)) { GeometryInfo geometry_info; MagickStatusType flags; flags=ParseGeometry(PSDensityGeometry,&geometry_info); image->x_resolution=geometry_info.rho; image->y_resolution=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->y_resolution=image->x_resolution; } page.width=612; page.height=792; page.x=43; page.y=43; if (image_info->page != (char *) NULL) (void) ParseAbsoluteGeometry(image_info->page,&page); /* Initialize Image structure. */ image->columns=(size_t) floor((((double) page.width*image->x_resolution)/ delta.x)+0.5); image->rows=(size_t) floor((((double) page.height*image->y_resolution)/ delta.y)+0.5); image->page.x=0; image->page.y=0; texture=(Image *) NULL; if (image_info->texture != (char *) NULL) { ImageInfo *read_info; read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); (void) CopyMagickString(read_info->filename,image_info->texture, MaxTextExtent); texture=ReadImage(read_info,exception); read_info=DestroyImageInfo(read_info); } /* Annotate the text image. */ (void) SetImageBackgroundColor(image); draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL); (void) CloneString(&draw_info->text,image_info->filename); (void) FormatLocaleString(geometry,MaxTextExtent,"0x0%+ld%+ld",(long) page.x, (long) page.y); (void) CloneString(&draw_info->geometry,geometry); status=GetTypeMetrics(image,draw_info,&metrics); if (status == MagickFalse) ThrowReaderException(TypeError,"UnableToGetTypeMetrics"); page.y=(ssize_t) ceil((double) page.y+metrics.ascent-0.5); (void) FormatLocaleString(geometry,MaxTextExtent,"0x0%+ld%+ld",(long) page.x, (long) page.y); (void) CloneString(&draw_info->geometry,geometry); (void) CopyMagickString(filename,image_info->filename,MaxTextExtent); if (*draw_info->text != '\0') *draw_info->text='\0'; p=text; for (offset=2*page.y; p != (char *) NULL; ) { /* Annotate image with text. */ (void) ConcatenateString(&draw_info->text,text); (void) ConcatenateString(&draw_info->text,"\n"); offset+=(ssize_t) (metrics.ascent-metrics.descent); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,offset,image->rows); if (status == MagickFalse) break; } p=ReadBlobString(image,text); if ((offset < (ssize_t) image->rows) && (p != (char *) NULL)) continue; if (texture != (Image *) NULL) { MagickProgressMonitor progress_monitor; progress_monitor=SetImageProgressMonitor(image, (MagickProgressMonitor) NULL,image->client_data); (void) TextureImage(image,texture); (void) SetImageProgressMonitor(image,progress_monitor, image->client_data); } (void) AnnotateImage(image,draw_info); if (p == (char *) NULL) break; /* Page is full-- allocate next image structure. */ *draw_info->text='\0'; offset=2*page.y; AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image->next->columns=image->columns; image->next->rows=image->rows; image=SyncNextImageInList(image); (void) CopyMagickString(image->filename,filename,MaxTextExtent); (void) SetImageBackgroundColor(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } if (texture != (Image *) NULL) { MagickProgressMonitor progress_monitor; progress_monitor=SetImageProgressMonitor(image, (MagickProgressMonitor) NULL,image->client_data); (void) TextureImage(image,texture); (void) SetImageProgressMonitor(image,progress_monitor,image->client_data); } (void) AnnotateImage(image,draw_info); if (texture != (Image *) NULL) texture=DestroyImage(texture); draw_info=DestroyDrawInfo(draw_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); }