Ejemplo n.º 1
0
/**
 * Replace all invalid characters according to IsValidEWChar() with a
 * space.
 */
static void
CleanString(char *p)
{
  for (; *p != 0; ++p)
    if (!IsValidEWChar(*p))
      *p = ' ';
}
static void
EWMicroRecorderPrintf(Port &port, const TCHAR *fmt, ...)
{
  TCHAR EWStr[128];
  va_list ap;

  va_start(ap, fmt);
  _vstprintf(EWStr, fmt, ap);
  va_end(ap);

#ifdef _UNICODE
  char buffer[256];
  if (::WideCharToMultiByte(CP_ACP, 0, EWStr, -1, buffer, sizeof(buffer),
                            NULL, NULL) <= 0)
    return;
#else
  char *buffer = EWStr;
#endif

  char *p = strchr(buffer, ':');
  if (p != NULL)
    ++p;
  else
    p = buffer;

  for (; *p != 0; ++p)
    if (!IsValidEWChar(*p))
      *p = ' ';

  port.Write(buffer);
}