prepared for git bisect on the windows copying issue.

This commit is contained in:
Allen Webster 2017-11-13 15:22:49 -05:00
parent 0f73cdecdb
commit cc9a282d55
3 changed files with 11 additions and 8 deletions

View File

@ -896,7 +896,6 @@ wrap_state_consume_token(System_Functions *system, Render_Font *font, Code_Wrap_
do{ do{
for (; i < state->stream.end; ++i){ for (; i < state->stream.end; ++i){
if (!(i < end)){ if (!(i < end)){
Assert(state->tran.fill_expected == 0);
goto doublebreak; goto doublebreak;
} }

View File

@ -173,14 +173,16 @@ global Coroutine_System_Auto_Alloc coroutines;
//////////////////////////////// ////////////////////////////////
internal void internal void
win32_output_error_string(){ win32_output_error_string(b32 use_error_box = true){
DWORD error = GetLastError(); DWORD error = GetLastError();
char *str = 0; char *str = 0;
char *str_ptr = (char*)&str; char *str_ptr = (char*)&str;
if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 0, error, 0, str_ptr, 0, 0)){ if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 0, error, 0, str_ptr, 0, 0)){
LOGF("win32 error:\n%s\n", str); LOGF("win32 error:\n%s\n", str);
system_error_box(str, false); if (use_error_box){
system_error_box(str, false);
}
} }
} }
@ -284,15 +286,17 @@ Sys_Send_Exit_Signal_Sig(system_send_exit_signal){
internal internal
Sys_Post_Clipboard_Sig(system_post_clipboard){ Sys_Post_Clipboard_Sig(system_post_clipboard){
if (OpenClipboard(win32vars.window_handle)){ if (OpenClipboard(win32vars.window_handle)){
EmptyClipboard(); if (!EmptyClipboard()){
HANDLE memory_handle; win32_output_error_string(false);
memory_handle = GlobalAlloc(GMEM_MOVEABLE, str.size+1); }
HANDLE memory_handle = GlobalAlloc(GMEM_MOVEABLE, str.size + 1);
if (memory_handle){ if (memory_handle){
char *dest = (char*)GlobalLock(memory_handle); char *dest = (char*)GlobalLock(memory_handle);
copy_fast_unsafe_cs(dest, str); copy_fast_unsafe_cs(dest, str);
dest[str.size] = 0;
GlobalUnlock(memory_handle); GlobalUnlock(memory_handle);
SetClipboardData(CF_TEXT, memory_handle); SetClipboardData(CF_TEXT, memory_handle);
win32vars.next_clipboard_is_self = 1; win32vars.next_clipboard_is_self = true;
} }
CloseClipboard(); CloseClipboard();
} }

View File

@ -1,5 +1,5 @@
1 1
0 0
108 109