Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. vststparser.cxx
  5. Abstract:
  6. Implementation of CVsTstParser class
  7. Brian Berkowitz [brianb] 06/07/2000
  8. TBD:
  9. Revision History:
  10. Name Date Comments
  11. brianb 06/07/2000 Created
  12. --*/
  13. #include <stdafx.h>
  14. #include <bsstring.hxx>
  15. #include <vststparser.hxx>
  16. LPCWSTR CVsTstParser::SplitOptions(CBsString &bss)
  17. {
  18. bss.CopyBeforeWrite();
  19. LPCWSTR wsz = bss;
  20. LPCWSTR wszTop = bss;
  21. bool bMoreToDo = *wsz != L'\0';
  22. bool bLeadingSpacesFound = false;
  23. while(bMoreToDo)
  24. {
  25. while(*wsz == L' ')
  26. {
  27. bLeadingSpacesFound = true;
  28. wsz++;
  29. }
  30. LPCWSTR pwc = wsz;
  31. while(*pwc != L'\0' && *pwc != L',')
  32. pwc++;
  33. if (*pwc == L'\0')
  34. bMoreToDo = false;
  35. else
  36. bss.SetAt((UINT) (pwc - wszTop), L'\0');
  37. wsz = pwc + 1;
  38. }
  39. if (!bLeadingSpacesFound)
  40. return wsz;
  41. LPCWSTR wszEnd = wsz;
  42. wsz = bss;
  43. UINT iwc = 0;
  44. // remove leading spaces from options
  45. while(wsz < wszEnd)
  46. {
  47. while(*wsz == ' ')
  48. wsz++;
  49. while(*wsz != L'\0')
  50. bss.SetAt(iwc++, *wsz++);
  51. bss.SetAt(iwc++, *wsz++);
  52. }
  53. return wszEnd;
  54. }