From 8a7c0a633b9a9416a6e6d032e80f705a5d1e6aed Mon Sep 17 00:00:00 2001 From: Pavel A Date: Fri, 16 Jan 2015 11:02:58 +0200 Subject: [PATCH] GUI demo: fixes, added VS2013 config, x64 --- .gitattributes | 1 + windows-vs/.gitignore | 4 ++++ windows-vs/VS_GUI_demo/GUIapp.cpp | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 windows-vs/.gitignore diff --git a/.gitattributes b/.gitattributes index 186bca1..7dcd312 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,4 +12,5 @@ *.bat eol=crlf *.txt eol=crlf *.c eol=lf +*.cpp eol=lf *.h eol=lf diff --git a/windows-vs/.gitignore b/windows-vs/.gitignore new file mode 100644 index 0000000..64db12f --- /dev/null +++ b/windows-vs/.gitignore @@ -0,0 +1,4 @@ +**/Debug/ +**/Release/ +**/x64/ +**/*.cache diff --git a/windows-vs/VS_GUI_demo/GUIapp.cpp b/windows-vs/VS_GUI_demo/GUIapp.cpp index 1497ed6..7fa6c10 100644 --- a/windows-vs/VS_GUI_demo/GUIapp.cpp +++ b/windows-vs/VS_GUI_demo/GUIapp.cpp @@ -85,7 +85,11 @@ System::Void Form1::buttonOpen_Click(System::Object^ sender, System::EventArgs^ // Get and show state: //BUGBUG g_dev is not usb_relay_device_info* in the orig library! use my new f() ?? use only info in the list? struct usb_relay_device_info* di = (struct usb_relay_device_info*)g_dev; - int numChannels = (int)di->type; + int numChannels = (unsigned char)di->type; + if ( numChannels > MaxRelaysNum || numChannels == 0) { + // oops? + numChannels = MaxRelaysNum; + } g_chanNum = numChannels; unsigned st = 0; int r = usb_relay_device_get_status( g_dev, &st); -- 2.25.1