memcpy() static private method

static private memcpy ( byte src, int srcIndex, byte dest, int destIndex, int len ) : void
src byte
srcIndex int
dest byte
destIndex int
len int
return void
Example #1
0
        public String(char *value)
        {
            Length = wcslen(value);
            void *size = (void *)(Length * sizeof(char));

            buffer = (char *)GC.CS2X_Malloc(size);
            Buffer.memcpy(buffer, value, size);
        }
Example #2
0
 internal static unsafe void FillStringChecked(string dest, int destPos, string src)
 {
     if (src.Length > dest.Length - destPos)
     {
         throw new IndexOutOfRangeException();
         fixed(char *pDest = &dest._firstChar)
         fixed(char *pSrc = &src._firstChar)
         {
             Buffer.memcpy(pDest + destPos, pSrc, (UIntPtr)(src.Length * sizeof(char)));
         }
 }
 private static unsafe char[] GetEnvironmentCharArray()
 {
     char[] chArray = null;
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
     }
     finally
     {
         char *pSrc = null;
         try
         {
             pSrc = Win32Native.GetEnvironmentStrings();
             if (pSrc == null)
             {
                 throw new OutOfMemoryException();
             }
             char *chPtr2 = pSrc;
             while ((chPtr2[0] != '\0') || (chPtr2[1] != '\0'))
             {
                 chPtr2++;
             }
             int len = (int)(((long)((chPtr2 - pSrc) / 2)) + 1L);
             chArray = new char[len];
             try
             {
                 fixed(char *chRef = chArray)
                 {
                     Buffer.memcpy(pSrc, 0, chRef, 0, len);
                 }
             }
             finally
             {
                 chRef = null;
             }
         }
         finally
         {
             if (pSrc != null)
             {
                 Win32Native.FreeEnvironmentStrings(pSrc);
             }
         }
     }
     return(chArray);
 }