ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

static void Output ( POUTPUTBUFFER  OutBuf,
PCWSTR  Text 
) [static]

Definition at line 27 of file infput.c.

{
  ULONG Length;
  PWCHAR NewBuf;
  ULONG NewSize;

  /* Skip mode? */
  if (! INF_SUCCESS(OutBuf->Status))
    {
      return;
    }

  /* Doesn't fit? */
  Length = (ULONG)strlenW(Text) * sizeof(WCHAR);
  if (OutBuf->FreeSize < Length + 1 && INF_SUCCESS(OutBuf->Status))
    {
      DPRINT("Out of free space. TotalSize %u FreeSize %u Length %u\n",
             (UINT)OutBuf->TotalSize, (UINT)OutBuf->FreeSize, (UINT)Length);
      /* Round up to next SIZE_INC */
      NewSize = OutBuf->TotalSize +
                (((Length + 1) - OutBuf->FreeSize + (SIZE_INC - 1)) /
                 SIZE_INC) * SIZE_INC;
      DPRINT("NewSize %u\n", (UINT)NewSize);
      NewBuf = MALLOC(NewSize);
      /* Abort if failed */
      if (NULL == NewBuf)
        {
          DPRINT1("MALLOC() failed\n");
          OutBuf->Status = INF_STATUS_NO_MEMORY;
          return;
        }
      
      /* Need to copy old contents? */
      if (NULL != OutBuf->Buffer)
        {
          DPRINT("Copying %u bytes from old content\n",
                 (UINT)(OutBuf->TotalSize - OutBuf->FreeSize));
          MEMCPY(NewBuf, OutBuf->Buffer, OutBuf->TotalSize - OutBuf->FreeSize);
          OutBuf->Current = NewBuf + (OutBuf->Current - OutBuf->Buffer);
          FREE(OutBuf->Buffer);
        }
      else
        {
          OutBuf->Current = NewBuf;
        }
      OutBuf->Buffer = NewBuf;
      OutBuf->FreeSize += NewSize - OutBuf->TotalSize;
      OutBuf->TotalSize = NewSize;
      DPRINT("After reallocation TotalSize %u FreeSize %u\n",
             (UINT)OutBuf->TotalSize, (UINT)OutBuf->FreeSize);
    }

  /* We're guaranteed to have enough room now. Copy char by char because of
     possible "conversion" from Unicode to Ansi */
  while (Length--)
    {
      *OutBuf->Current++ = *Text++;
      OutBuf->FreeSize--;
    }
  *OutBuf->Current = '\0';
}

Generated on Sun May 27 2012 06:04:21 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.