• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CloneString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CloneString函数的典型用法代码示例。如果您正苦于以下问题:C++ CloneString函数的具体用法?C++ CloneString怎么用?C++ CloneString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CloneString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CPipeResult

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();
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:12,代码来源:CPipeResult.cpp


示例2: CloneFieldDef

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;
}
开发者ID:nightstyles,项目名称:focp,代码行数:52,代码来源:RdbUtility.cpp


示例3: CloneString

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;
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:15,代码来源:CPipeResult.cpp


示例4: SplitStringByWhitespace

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;
}
开发者ID:jeppeter,项目名称:vbox,代码行数:60,代码来源:StringFuncs.c


示例5: RelinquishMagickMemory

void Magick::Options::density(const Point &density_)
{
  if (!density_.isValid())
    _imageInfo->density=(char *) RelinquishMagickMemory(_imageInfo->density);
  else
   CloneString(&_imageInfo->density,density_);
}
开发者ID:riingo,项目名称:ImageMagick,代码行数:7,代码来源:Options.cpp


示例6: main

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;
}
开发者ID:CliffsDover,项目名称:graphicsmagick,代码行数:60,代码来源:drawtest.c


示例7: MagickQueryMultilineFontMetrics

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
%   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;
//.........这里部分代码省略.........
开发者ID:saitoha,项目名称:ImageMagick-V7-SIXEL,代码行数:101,代码来源:magick-wand.c


示例8: CloneString

char * RString::GetBuffer(void)
{
	if(RefCount() > 0)
	{
		CloneString();
		return myString;
	}
	return myString; //are we sure this is safe?
}
开发者ID:rezalas,项目名称:riftshadow,代码行数:9,代码来源:strings.c


示例9: CloneString

LinuxEcatHardware::LinuxEcatHardware( const char *name )
{
   if( !name ) name = "eth0";

   fd = -1;
   ifname = CloneString( name );

   SetRefName( "LinuxEcatHw" );
}
开发者ID:DJGCrusader,项目名称:ParallelScissorManipulator,代码行数:9,代码来源:ecat_linux.cpp


示例10: CloneIndexDef

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;
}
开发者ID:nightstyles,项目名称:focp,代码行数:44,代码来源:RdbUtility.cpp


示例11: Filesets_Restore_OnEndTask_LookupFileset

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);
}
开发者ID:chanke,项目名称:openafs-osd,代码行数:56,代码来源:set_restore.cpp


示例12: CloneString

/**
   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" );
}
开发者ID:DJGCrusader,项目名称:ParallelScissorManipulator,代码行数:45,代码来源:ecat_winudp.cpp


示例13: CloneString

// 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;

}
开发者ID:Joincheng,项目名称:lithtech,代码行数:15,代码来源:BackEndDialog.cpp


示例14: CloneString

//--------------------------------------------------------------------------------------------------------------
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] ) );
		}
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:14,代码来源:hintmessage.cpp


示例15: CloneString

//--------------------------------------------------------------------------------------------------------------
void DownloadManager::MarkMapAsDownloadedFromServer( const char *serverMapName )
{
	if ( !serverMapName )
		return;

	if ( HasMapBeenDownloadedFromServer( serverMapName ) )
		return;

	m_downloadedMaps.AddToTail( CloneString( serverMapName ) );


	return;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:14,代码来源:download.cpp


示例16: sprintf

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();
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:13,代码来源:plKey.cpp


示例17: FindVoiceBankIndex

// 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;
}
开发者ID:s1lentq,项目名称:ReGameDLL_CS,代码行数:15,代码来源:bot_profile.cpp


示例18: return

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;
}
开发者ID:rezalas,项目名称:riftshadow,代码行数:14,代码来源:strings.c


示例19: EnumeratePrincipalsRemotely

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);
   }
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:47,代码来源:al_browse.cpp


示例20: AppendCopyOfStringToList

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;
}
开发者ID:jeppeter,项目名称:vbox,代码行数:47,代码来源:StringFuncs.c



注:本文中的CloneString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Close函数代码示例发布时间:2022-05-30
下一篇:
C++ CloneImageInfo函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap