lucabaldini / xpedaq

Data acquisition software for the X-ray polarimetry explorers
GNU General Public License v2.0
0 stars 0 forks source link

QuickUsb does not compile under Windows 32 bit #96

Closed lucabaldini closed 8 years ago

lucabaldini commented 8 years ago

..\quickusb-2.15.2\CQuickUsb.cpp: In constructor 'CQuickUsb::CQuickUsb(const cha
r*)':
..\quickusb-2.15.2\CQuickUsb.cpp:55:38: error: 'strcpy_s' was not declared in th
is scope
     strcpy_s(m_devName, size, devName);
                                      ^
..\quickusb-2.15.2\CQuickUsb.cpp: In member function 'void CQuickUsb::SetName(co
nst char*)':
..\quickusb-2.15.2\CQuickUsb.cpp:102:35: error: 'strcpy_s' was not declared in t
his scope
     strcpy_s(m_devName, size, name);
                                   ^
..\quickusb-2.15.2\CQuickUsb.cpp: In member function 'void CQuickUsb::SetDeviceN
ame(const char*)':
..\quickusb-2.15.2\CQuickUsb.cpp:120:35: error: 'strcpy_s' was not declared in t
his scope
     strcpy_s(m_devName, size, name);
                                   ^
Makefile:971: recipe for target 'build/CQuickUsb.o' failed
mingw32-make[1]: *** [build/CQuickUsb.o] Error 1
mingw32-make[1]: Leaving directory 'C:/Users/GPD/DAQ/xpedaq-0.8.3/xpedaq'
Makefile:41: recipe for target 'sub-xpedaq-make_default' failed
mingw32-make: *** [sub-xpedaq-make_default] Error 2 
lucabaldini commented 8 years ago

And a cursory look indicates that this might be fixed by changing a couple of strcpy_s in CQuickUsb.cpp

#if defined(_WIN32)
    size_t size = strlen(devName) + 1;
    m_devName = new QCHAR[size];
    strcpy_s(m_devName, size, devName);
#else
    int size = strlen(devName) + 1;
    m_devName = new QCHAR[size];
    strcpy(m_devName, devName);
#endif
lucabaldini commented 8 years ago

Trying to push this diff:

diff --git a/quickusb-2.15.2/CQuickUsb.cpp b/quickusb-2.15.2/CQuickUsb.cpp
index ab1b723..b391a3b 100644
--- a/quickusb-2.15.2/CQuickUsb.cpp
+++ b/quickusb-2.15.2/CQuickUsb.cpp
@@ -49,15 +49,15 @@ CQuickUsb::CQuickUsb(PCQCHAR devName) :
     m_lastError(QUICKUSB_ERROR_NO_ERROR),
     m_lastDriverError(QUICKUSB_ERROR_NO_ERROR) {

-#if defined(_WIN32)
-    size_t size = strlen(devName) + 1;
-    m_devName = new QCHAR[size];
-    strcpy_s(m_devName, size, devName);
-#else
+    //#if defined(_WIN32)
+    //size_t size = strlen(devName) + 1;
+    //m_devName = new QCHAR[size];
+    //strcpy_s(m_devName, size, devName);
+    //#else
     int size = strlen(devName) + 1;
     m_devName = new QCHAR[size];
     strcpy(m_devName, devName);
-#endif
+    //#endif
 }

@@ -96,15 +96,15 @@ void CQuickUsb::SetName(PCQCHAR name) {
         delete [] m_devName;
     }

-#if defined(_WIN32)
-    size_t size = strlen(name) + 1;
-    m_devName = new QCHAR[size];
-    strcpy_s(m_devName, size, name);
-#else
+    //#if defined(_WIN32)
+    //size_t size = strlen(name) + 1;
+    //m_devName = new QCHAR[size];
+    //strcpy_s(m_devName, size, name);
+    //#else
     int size = strlen(name) + 1;
     m_devName = new QCHAR[size];
     strcpy(m_devName, name);
-#endif
+    //#endif
 }

@@ -114,15 +114,15 @@ void CQuickUsb::SetDeviceName(PCQCHAR name) {
         delete [] m_devName;
     }

-#if defined(_WIN32)
-    size_t size = strlen(name) + 1;
-    m_devName = new QCHAR[size];
-    strcpy_s(m_devName, size, name);
-#else
+    //#if defined(_WIN32)
+    //size_t size = strlen(name) + 1;
+    //m_devName = new QCHAR[size];
+    //strcpy_s(m_devName, size, name);
+    //#else
     int size = strlen(name) + 1;
     m_devName = new QCHAR[size];
     strcpy(m_devName, name);
-#endif
+    //#endif
 }
lucabaldini commented 8 years ago

This is of course transparent to Linux and seems to be working under Windows 64 bit as well.

Still need to be tested under Windows 32 bit.

lucabaldini commented 8 years ago

Tested, we're up and running.