diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2014-03-02 03:54:53 +0400 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2014-03-02 04:01:08 +0400 |
commit | 879fe91e5dc6777c06fe675d167af0b822e0d347 (patch) | |
tree | 4f0a81a805cb03ab48f892049ab5770df6b9e258 /common | |
parent | 454d3607d14f2d5e00e529bb37b3b0661ccc5214 (diff) |
Allow the timer macros to be used in release builds
Diffstat (limited to 'common')
-rw-r--r-- | common/DSUtilLite/DShowUtil.cpp | 22 | ||||
-rw-r--r-- | common/DSUtilLite/DShowUtil.h | 1 | ||||
-rw-r--r-- | common/DSUtilLite/timer.h | 4 |
3 files changed, 25 insertions, 2 deletions
diff --git a/common/DSUtilLite/DShowUtil.cpp b/common/DSUtilLite/DShowUtil.cpp index a8f69d54..cd855c6a 100644 --- a/common/DSUtilLite/DShowUtil.cpp +++ b/common/DSUtilLite/DShowUtil.cpp @@ -638,3 +638,25 @@ BOOL IsVistaOrNewer() return (os.dwMajorVersion >= 6); } + +void __cdecl debugprintf(LPCWSTR format, ...) +{ + WCHAR buf[4096], *p = buf; + va_list args; + int n; + + va_start(args, format); + n = _vsnwprintf_s(p, 4096, 4096 - 3, format, args); // buf-3 is room for CR/LF/NUL + va_end(args); + + p += (n < 0) ? (4096 - 3) : n; + + while (p > buf && isspace(p[-1])) + *--p = L'\0'; + + *p++ = L'\r'; + *p++ = L'\n'; + *p = L'\0'; + + OutputDebugString(buf); +} diff --git a/common/DSUtilLite/DShowUtil.h b/common/DSUtilLite/DShowUtil.h index ef9f543e..f9008fbc 100644 --- a/common/DSUtilLite/DShowUtil.h +++ b/common/DSUtilLite/DShowUtil.h @@ -126,3 +126,4 @@ void getExtraData(const AM_MEDIA_TYPE &mt, BYTE *extra, size_t *extralen); void getExtraData(const BYTE *format, const GUID *formattype, const size_t formatlen, BYTE *extra, size_t *extralen); BOOL IsVistaOrNewer(); +void __cdecl debugprintf(LPCWSTR format, ...); diff --git a/common/DSUtilLite/timer.h b/common/DSUtilLite/timer.h index 7a64aa6d..1c49a0e0 100644 --- a/common/DSUtilLite/timer.h +++ b/common/DSUtilLite/timer.h @@ -37,8 +37,8 @@ } else \ tskip_count++; \ if (((tcount + tskip_count) & (tcount + tskip_count - 1)) == 0) { \ - DbgLog((LOG_TRACE, 10, \ + debugprintf( \ L"%I64u decicycles in %S, %d runs, %d skips", \ - tsum * 10 / tcount, id, tcount, tskip_count)); \ + tsum * 10 / tcount, id, tcount, tskip_count); \ } \ } |