PVRTError.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /******************************************************************************
  2. @File PVRTError.cpp
  3. @Title PVRTError
  4. @Version
  5. @Copyright Copyright (C) Imagination Technologies Limited.
  6. @Platform ANSI compatible
  7. @Description
  8. ******************************************************************************/
  9. #include "PVRTError.h"
  10. #include <stdarg.h>
  11. #if defined(__BADA__)
  12. #include <FApp.h>
  13. #else
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <string.h>
  17. #if defined(_WIN32)
  18. #define vsnprintf _vsnprintf
  19. #endif
  20. #endif
  21. /*!***************************************************************************
  22. @Function PVRTErrorOutputDebug
  23. @Input format printf style format followed by arguments it requires
  24. @Description Outputs a string to the standard error.
  25. *****************************************************************************/
  26. void PVRTErrorOutputDebug(char const * const format, ...)
  27. {
  28. va_list arg;
  29. char pszString[1024];
  30. va_start(arg, format);
  31. #if defined(__SYMBIAN32__) || defined(UITRON) || defined(_UITRON_)
  32. vsprintf(pszString, format, arg);
  33. #else
  34. vsnprintf(pszString, 1024, format, arg);
  35. #endif
  36. va_end(arg);
  37. #if defined(UNICODE) && !defined(__SYMBIAN32__) && !defined(UNDER_CE)
  38. wchar_t *pswzString = (wchar_t *)malloc((strlen(pszString) + 1) * sizeof(wchar_t));
  39. int i;
  40. for(i = 0; pszString[i] != '\0'; i++)
  41. {
  42. pswzString[i] = (wchar_t)(pszString[i]);
  43. }
  44. pswzString[i] = '\0';
  45. #if defined(_WIN32)
  46. OutputDebugString(pswzString);
  47. #else
  48. fprintf(stderr, pswzString);
  49. #endif
  50. free(pswzString);
  51. #else
  52. #if defined(__SYMBIAN32__)
  53. RDebug::Printf(pszString);
  54. #elif defined(__BADA__)
  55. AppLog(pszString);
  56. #elif defined(_WIN32) && !defined(UNDER_CE)
  57. OutputDebugString(pszString);
  58. #else
  59. fprintf(stderr, "%s", pszString);
  60. #endif
  61. #endif
  62. }
  63. /*****************************************************************************
  64. End of file (PVRTError.cpp)
  65. *****************************************************************************/