Use One-Time Initialization for glyph run caching to avoid duplicate glyph run genera...
[gdipp.git] / gdipp_lib / debug.cpp
blob73f435f4a07dd9e14cd17952c3b2c4223ad738d9
1 #include "stdafx.h"
2 #include "debug.h"
4 namespace gdipp
7 const wchar_t *debug_file_name = L"C:\\gdipp_debug.log";
9 void debug_buffer(const void *ptr, unsigned int size)
11 FILE *f;
12 _wfopen_s(&f, debug_file_name, L"a+");
14 if (f != NULL)
16 fwrite(ptr, 1, size, f);
17 fclose(f);
21 void debug_decimal(double num, bool new_line)
23 FILE *f;
24 _wfopen_s(&f, debug_file_name, L"a+");
26 if (f != NULL)
28 if (new_line)
29 fwprintf(f, L"%f\n", num);
30 else
31 fwprintf(f, L"%f, ", num);
32 fclose(f);
36 void debug_integer(size_t num, bool new_line)
38 FILE *f;
39 _wfopen_s(&f, debug_file_name, L"a+");
41 if (f != NULL)
43 if (new_line)
44 fwprintf(f, L"%u\n", num);
45 else
46 fwprintf(f, L"%u, ", num);
47 fclose(f);
51 void debug_string(const wchar_t *str, bool new_line)
53 FILE *f;
54 _wfopen_s(&f, debug_file_name, L"a+");
56 if (f != NULL)
58 if (new_line)
59 fwprintf(f, L"%s\n", str);
60 else
61 fwprintf(f, L"%s", str);
62 fclose(f);