comparison src/audio/windib/SDL_dibaudio.c @ 5092:327f181542f1

Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share. I think this also fixes the bug relating to non-latin characters in filenames, since UNICODE wasn't defined in SDL_rwops.c
author Sam Lantinga <slouken@libsdl.org>
date Mon, 24 Jan 2011 21:20:30 -0800
parents 4160ba33b597
children b530ef003506
comparison
equal deleted inserted replaced
5091:79bd1e289005 5092:327f181542f1
21 */ 21 */
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 23
24 /* Allow access to a raw mixing buffer */ 24 /* Allow access to a raw mixing buffer */
25 25
26 #define WIN32_LEAN_AND_MEAN 26 #include "../../core/windows/SDL_windows.h"
27 #include <windows.h>
28 #include <mmsystem.h> 27 #include <mmsystem.h>
29 28
30 #include "SDL_timer.h" 29 #include "SDL_timer.h"
31 #include "SDL_audio.h" 30 #include "SDL_audio.h"
32 #include "../SDL_audio_c.h" 31 #include "../SDL_audio_c.h"
65 static void 64 static void
66 SetMMerror(char *function, MMRESULT code) 65 SetMMerror(char *function, MMRESULT code)
67 { 66 {
68 size_t len; 67 size_t len;
69 char errbuf[MAXERRORLENGTH]; 68 char errbuf[MAXERRORLENGTH];
70 #ifdef _WIN32_WCE
71 wchar_t werrbuf[MAXERRORLENGTH]; 69 wchar_t werrbuf[MAXERRORLENGTH];
72 #endif
73 70
74 SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function); 71 SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function);
75 len = SDL_strlen(errbuf); 72 len = SDL_strlen(errbuf);
76 73
77 #ifdef _WIN32_WCE
78 /* UNICODE version */
79 waveOutGetErrorText(code, werrbuf, MAXERRORLENGTH - len); 74 waveOutGetErrorText(code, werrbuf, MAXERRORLENGTH - len);
80 WideCharToMultiByte(CP_ACP, 0, werrbuf, -1, errbuf + len, 75 WideCharToMultiByte(CP_ACP, 0, werrbuf, -1, errbuf + len,
81 MAXERRORLENGTH - len, NULL, NULL); 76 MAXERRORLENGTH - len, NULL, NULL);
82 #else
83 waveOutGetErrorText(code, errbuf + len, (UINT) (MAXERRORLENGTH - len));
84 #endif
85 77
86 SDL_SetError("%s", errbuf); 78 SDL_SetError("%s", errbuf);
87 } 79 }
88 80
89 /* Set high priority for the audio thread */ 81 /* Set high priority for the audio thread */