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