aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCNLohr <lohr85@gmail.com>2017-03-17 01:08:06 -0400
committerCNLohr <lohr85@gmail.com>2017-03-17 01:08:06 -0400
commit8ea24c306fdf2a141433e396307e92a227416ba5 (patch)
treee5c33347f918547acafd0770cce45bced41ef89e
parentc9be7c057aa9570d0f67109c87b74e3aab640322 (diff)
downloadlibsurvive-8ea24c306fdf2a141433e396307e92a227416ba5.tar.gz
libsurvive-8ea24c306fdf2a141433e396307e92a227416ba5.tar.bz2
Fix Warnings
-rw-r--r--redist/WinDriver.c2
-rw-r--r--redist/json_helpers.c6
-rw-r--r--redist/json_helpers.h2
-rw-r--r--redist/linmath.c16
-rw-r--r--redist/os_generic.c1
-rw-r--r--redist/symbol_enumerator.c10
-rw-r--r--src/poser_charlesslow.c8
-rw-r--r--src/poser_daveortho.c2
-rwxr-xr-xsrc/survive.c4
-rwxr-xr-xsrc/survive_cal.c6
-rw-r--r--src/survive_config.c14
-rw-r--r--src/survive_config.h4
-rw-r--r--src/survive_driverman.c2
-rwxr-xr-xsrc/survive_vive.c4
-rw-r--r--winbuild/libsurvive/libsurvive.vcxproj8
-rw-r--r--windows/hid.c22
16 files changed, 62 insertions, 49 deletions
diff --git a/redist/WinDriver.c b/redist/WinDriver.c
index a6dd1e6..3613150 100644
--- a/redist/WinDriver.c
+++ b/redist/WinDriver.c
@@ -220,7 +220,7 @@ void CNFGHandleInput()
case WM_MBUTTONUP: HandleButton( (msg.lParam & 0xFFFF), (msg.lParam>>16) & 0xFFFF, 3, 0 ); break;
case WM_KEYDOWN:
case WM_KEYUP:
- HandleKey( tolower( msg.wParam ), (msg.message==WM_KEYDOWN) );
+ HandleKey( tolower( (int)msg.wParam ), (msg.message==WM_KEYDOWN) );
break;
default:
DispatchMessage(&msg);
diff --git a/redist/json_helpers.c b/redist/json_helpers.c
index e0b86f4..1e2f43e 100644
--- a/redist/json_helpers.c
+++ b/redist/json_helpers.c
@@ -107,7 +107,7 @@ void json_write_str(FILE* f, const char* tag, const char* v) {
void (*json_begin_object)(char* tag) = NULL;
void (*json_end_object)() = NULL;
-void (*json_tag_value)(char* tag, char** values, uint16_t count) = NULL;
+void (*json_tag_value)(char* tag, char** values, uint8_t count) = NULL;
uint32_t JSON_STRING_LEN;
@@ -146,7 +146,7 @@ static uint16_t json_load_array(const char* JSON_STRING, jsmntok_t* tokens, uint
values[i] = substr(JSON_STRING, t->start, t->end, JSON_STRING_LEN);
}
- if (json_tag_value != NULL) json_tag_value(tag, values, i);
+ if (json_tag_value != NULL) json_tag_value(tag, values, (uint8_t)i);
for (i=0;i<size;++i) free(values[i]);
@@ -159,7 +159,7 @@ void json_load_file(const char* path) {
char* JSON_STRING = load_file_to_mem(path);
if (JSON_STRING==NULL) return;
- JSON_STRING_LEN = strlen(JSON_STRING);
+ JSON_STRING_LEN = (uint32_t)strlen(JSON_STRING);
jsmn_parser parser;
jsmn_init(&parser);
diff --git a/redist/json_helpers.h b/redist/json_helpers.h
index 1670058..1cccfe3 100644
--- a/redist/json_helpers.h
+++ b/redist/json_helpers.h
@@ -14,7 +14,7 @@ void json_write_str(FILE* f, const char* tag, const char* v);
void json_load_file(const char* path);
extern void (*json_begin_object)(char* tag);
extern void (*json_end_object)();
-extern void (*json_tag_value)(char* tag, char** values, uint16_t count);
+extern void (*json_tag_value)(char* tag, char** values, uint8_t count);
#endif \ No newline at end of file
diff --git a/redist/linmath.c b/redist/linmath.c
index dd6bd15..eefcd5f 100644
--- a/redist/linmath.c
+++ b/redist/linmath.c
@@ -207,28 +207,28 @@ void quattomatrix(FLT * matrix44, const FLT * qin)
void quatfrommatrix( FLT * q, const FLT * matrix44 )
{
//Algorithm from http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/
- float tr = matrix44[0] + matrix44[5] + matrix44[10];
+ FLT tr = matrix44[0] + matrix44[5] + matrix44[10];
if (tr > 0) {
- float S = sqrt(tr+1.0) * 2; // S=4*qw
- q[0] = 0.25 * S;
+ FLT S = FLT_SQRT(tr+1.0) * 2.; // S=4*qw
+ q[0] = 0.25f * S;
q[1] = (matrix44[9] - matrix44[6]) / S;
q[2] = (matrix44[2] - matrix44[8]) / S;
q[3] = (matrix44[4] - matrix44[1]) / S;
} else if ((matrix44[0] > matrix44[5])&(matrix44[0] > matrix44[10])) {
- float S = sqrt(1.0 + matrix44[0] - matrix44[5] - matrix44[10]) * 2; // S=4*qx
+ FLT S = FLT_SQRT(1.0 + matrix44[0] - matrix44[5] - matrix44[10]) * 2.; // S=4*qx
q[0] = (matrix44[9] - matrix44[6]) / S;
- q[1] = 0.25 * S;
+ q[1] = 0.25f * S;
q[2] = (matrix44[1] + matrix44[4]) / S;
q[3] = (matrix44[2] + matrix44[8]) / S;
} else if (matrix44[5] > matrix44[10]) {
- float S = sqrt(1.0 + matrix44[5] - matrix44[0] - matrix44[10]) * 2; // S=4*qy
+ FLT S = FLT_SQRT(1.0 + matrix44[5] - matrix44[0] - matrix44[10]) * 2.; // S=4*qy
q[0] = (matrix44[2] - matrix44[8]) / S;
q[1] = (matrix44[1] + matrix44[4]) / S;
- q[2] = 0.25 * S;
+ q[2] = 0.25f * S;
q[3] = (matrix44[6] + matrix44[9]) / S;
} else {
- float S = sqrt(1.0 + matrix44[10] - matrix44[0] - matrix44[5]) * 2; // S=4*qz
+ FLT S = FLT_SQRT(1.0 + matrix44[10] - matrix44[0] - matrix44[5]) * 2.; // S=4*qz
q[0] = (matrix44[4] - matrix44[1]) / S;
q[1] = (matrix44[2] + matrix44[8]) / S;
q[2] = (matrix44[6] + matrix44[9]) / S;
diff --git a/redist/os_generic.c b/redist/os_generic.c
index 0993d7a..1ab4863 100644
--- a/redist/os_generic.c
+++ b/redist/os_generic.c
@@ -55,6 +55,7 @@ void * OGJoinThread( og_thread_t ot )
{
WaitForSingleObject( ot, INFINITE );
CloseHandle( ot );
+ return 0;
}
void OGCancelThread( og_thread_t ot )
diff --git a/redist/symbol_enumerator.c b/redist/symbol_enumerator.c
index 7d33900..fcb3727 100644
--- a/redist/symbol_enumerator.c
+++ b/redist/symbol_enumerator.c
@@ -51,9 +51,13 @@ BOOL WINAPI SymEnumSymbols(
);
BOOL WINAPI SymInitialize(
- HANDLE hProcess,
- PCTSTR UserSearchPath,
- BOOL fInvadeProcess
+ HANDLE hProcess,
+ PCTSTR UserSearchPath,
+ BOOL fInvadeProcess
+);
+
+BOOL WINAPI SymCleanup(
+ HANDLE hProcess
);
BOOL CALLBACK __cdecl mycb(
diff --git a/src/poser_charlesslow.c b/src/poser_charlesslow.c
index def8323..080ad6a 100644
--- a/src/poser_charlesslow.c
+++ b/src/poser_charlesslow.c
@@ -123,9 +123,9 @@ int PoserCharlesSlow( SurviveObject * so, PoserData * pd )
ft = RunOpti(so, fs, lh, 0, LighthousePos, LighthouseQuat);
if( cycle == 0 )
{
- float sk = ft*10.;
+ FLT sk = ft*10.;
if( sk > 1 ) sk = 1;
- uint8_t cell = (1.0 - sk) * 255;
+ uint8_t cell = (uint8_t)((1.0 - sk) * 255);
FLT epsilon = 0.1;
if( dz == 0 ) { /* Why is dz special? ? */
@@ -231,7 +231,7 @@ static FLT RunOpti( SurviveObject * hmd, PoserDataFullScene * fs, int lh, int pr
if( fs->lengths[p][lh][0] < 0 || fs->lengths[p][lh][1] < 0 ) continue;
FLT me_to_dot[3];
sub3d( me_to_dot, LighthousePos, &hmd_points[p*3] );
- float dot = dot3d( &hmd_normals[p*3], me_to_dot );
+ FLT dot = dot3d( &hmd_normals[p*3], me_to_dot );
if( dot < -.01 ) { return 1000; }
}
int iters = 6;
@@ -321,7 +321,7 @@ static FLT RunOpti( SurviveObject * hmd, PoserDataFullScene * fs, int lh, int pr
}
//Step 2: Determine error.
- float errorsq = 0.0;
+ FLT errorsq = 0.0;
int count = 0;
for( p = 0; p < dpts; p++ )
{
diff --git a/src/poser_daveortho.c b/src/poser_daveortho.c
index 9f3b55a..e81e154 100644
--- a/src/poser_daveortho.c
+++ b/src/poser_daveortho.c
@@ -120,7 +120,7 @@ int PoserDaveOrtho( SurviveObject * so, PoserData * pd )
break;
}
}
-
+ return 0;
}
diff --git a/src/survive.c b/src/survive.c
index 9554d9c..f637bd8 100755
--- a/src/survive.c
+++ b/src/survive.c
@@ -165,6 +165,7 @@ int survive_add_object( SurviveContext * ctx, SurviveObject * obj )
ctx->objs = realloc( ctx->objs, sizeof( SurviveObject * ) * (oldct+1) );
ctx->objs[oldct] = obj;
ctx->objs_ct = oldct+1;
+ return 0;
}
void survive_add_driver( SurviveContext * ctx, void * payload, DeviceDriverCb poll, DeviceDriverCb close, DeviceDriverMagicCb magic )
@@ -188,7 +189,8 @@ int survive_send_magic( SurviveContext * ctx, int magic_code, void * data, int d
for( i = 0; i < oldct; i++ )
{
ctx->drivermagics[i]( ctx, ctx->drivers[i], magic_code, data, datalen );
- }
+ }
+ return 0;
}
void survive_close( SurviveContext * ctx )
diff --git a/src/survive_cal.c b/src/survive_cal.c
index 985ab24..0eb9446 100755
--- a/src/survive_cal.c
+++ b/src/survive_cal.c
@@ -18,6 +18,10 @@
#include "survive_config.h"
+#ifdef WINDOWS
+int mkdir(const char *);
+#endif
+
#define PTS_BEFORE_COMMON 32
#define NEEDED_COMMON_POINTS 10
#define MIN_SENSORS_VISIBLE_PER_LH_FOR_CAL 4
@@ -455,7 +459,7 @@ static void handle_calibration( struct SurviveCalData *cd )
stddevang += Sdiff2;
stddevlen += Ldiff2;
- int llm = Sdiff / HISTOGRAMBINANG + (HISTOGRAMSIZE/2.0);
+ int llm = (int)( Sdiff / HISTOGRAMBINANG + (HISTOGRAMSIZE/2.0) );
if( llm < 0 ) llm = 0;
if( llm >= HISTOGRAMSIZE ) llm = HISTOGRAMSIZE-1;
diff --git a/src/survive_config.c b/src/survive_config.c
index 5458ef0..0810280 100644
--- a/src/survive_config.c
+++ b/src/survive_config.c
@@ -33,7 +33,7 @@ void destroy_config_entry(config_entry* ce) {
if (ce->data!=NULL) { free(ce->data); ce->data=NULL; }
}
-void init_config_group(config_group *cg, uint16_t count) {
+void init_config_group(config_group *cg, uint8_t count) {
uint16_t i = 0;
cg->used_entries = 0;
cg->max_entries = count;
@@ -99,7 +99,7 @@ void config_set_lighthouse(config_group* lh_config, BaseStationData* bsd, uint8_
}
void sstrcpy(char** dest, const char *src) {
- uint32_t len = strlen(src)+1;
+ uint32_t len = (uint32_t)strlen(src)+1;
assert(dest!=NULL);
char* ptr = (char*)realloc(*dest, len); //acts like malloc if dest==NULL
@@ -143,7 +143,7 @@ FLT config_read_float(config_group *cg, const char *tag, const FLT def) {
return config_set_float(cg, tag, def);
}
-uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint16_t count) {
+uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint8_t count) {
config_entry *cv = find_config_entry(cg, tag);
if (cv != NULL) {
@@ -237,7 +237,7 @@ void write_config_group(FILE* f, config_group *cg, char *tag) {
for (i=0;i < cg->used_entries;++i) {
if (cg->config_entries[i].type == CONFIG_FLOAT) {
- json_write_float(f, cg->config_entries[i].tag, cg->config_entries[i].numeric.f);
+ json_write_float(f, cg->config_entries[i].tag, (float)cg->config_entries[i].numeric.f);
} else if (cg->config_entries[i].type == CONFIG_UINT32) {
json_write_uint32(f, cg->config_entries[i].tag, cg->config_entries[i].numeric.i);
} else if (cg->config_entries[i].type == CONFIG_STRING) {
@@ -295,7 +295,7 @@ void pop_config_group() {
}
-int parse_floats(char* tag, char** values, uint16_t count) {
+int parse_floats(char* tag, char** values, uint8_t count) {
uint16_t i = 0;
FLT *f;
f = alloca(sizeof(FLT) * count);
@@ -348,12 +348,12 @@ int parse_uint32(char* tag, char** values, uint16_t count) {
// if (count>1)
// config_set_uint32_array(cg, tag, f, count);
// else
- config_set_uint32(cg, tag, l[0]);
+ config_set_uint32(cg, tag, (uint32_t)l[0]);
return 1;
}
-void handle_tag_value(char* tag, char** values, uint16_t count) {
+void handle_tag_value(char* tag, char** values, uint8_t count) {
print_json_value(tag,values,count);
config_group* cg = cg_stack[cg_stack_head];
diff --git a/src/survive_config.h b/src/survive_config.h
index c8c7762..83db624 100644
--- a/src/survive_config.h
+++ b/src/survive_config.h
@@ -35,7 +35,7 @@ typedef struct config_group {
//extern config_group global_config_values;
//extern config_group lh_config[2]; //lighthouse configs
-void init_config_group(config_group *cg, uint16_t count);
+void init_config_group(config_group *cg, uint8_t count);
void destroy_config_group(config_group* cg);
//void config_init();
@@ -52,7 +52,7 @@ const uint32_t config_set_uint32(config_group *cg, const char *tag, const uint32
const char* config_set_str(config_group *cg, const char *tag, const char* value);
FLT config_read_float(config_group *cg, const char *tag, const FLT def);
-uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint16_t count);
+uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint8_t count);
uint32_t config_read_uint32(config_group *cg, const char *tag, const uint32_t def);
const char* config_read_str(config_group *cg, const char *tag, const char *def);
diff --git a/src/survive_driverman.c b/src/survive_driverman.c
index d694e64..2afaf65 100644
--- a/src/survive_driverman.c
+++ b/src/survive_driverman.c
@@ -31,7 +31,7 @@ void * GetDriver( const char * element )
const char * GetDriverNameMatching( const char * prefix, int place )
{
int i;
- int prefixlen = strlen( prefix );
+ int prefixlen = (int)strlen( prefix );
for( i = 0; i < NrDrivers; i++ )
{
diff --git a/src/survive_vive.c b/src/survive_vive.c
index 5a76d24..cdc319d 100755
--- a/src/survive_vive.c
+++ b/src/survive_vive.c
@@ -550,7 +550,7 @@ int survive_vive_send_magic(struct SurviveContext * ctx, void * drv, int magic_c
if( r != sizeof( vive_magic_power_off2 ) ) return 5;
}
}
-
+ return 0;
}
void survive_vive_usb_close( struct SurviveViveData * sv )
@@ -594,6 +594,7 @@ int survive_vive_usb_poll( struct SurviveContext * ctx, void * v )
}
return r;
#endif
+ return 0;
}
@@ -1234,6 +1235,7 @@ int survive_vive_close( SurviveContext * ctx, void * driver )
SurviveViveData * sv = driver;
survive_vive_usb_close( sv );
+ return 0;
}
diff --git a/winbuild/libsurvive/libsurvive.vcxproj b/winbuild/libsurvive/libsurvive.vcxproj
index 2a5029c..82a4e40 100644
--- a/winbuild/libsurvive/libsurvive.vcxproj
+++ b/winbuild/libsurvive/libsurvive.vcxproj
@@ -77,7 +77,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>USE_DOUBLE;RUNTIME_SYMNUM;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>USE_DOUBLE;RUNTIME_SYMNUM;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WINDOWS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@@ -91,7 +91,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>USE_DOUBLE;RUNTIME_SYMNUM;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>USE_DOUBLE;RUNTIME_SYMNUM;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WINDOWS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@@ -107,7 +107,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>USE_DOUBLE;RUNTIME_SYMNUM;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>USE_DOUBLE;RUNTIME_SYMNUM;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WINDOWS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@@ -125,7 +125,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>USE_DOUBLE;RUNTIME_SYMNUM;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>USE_DOUBLE;RUNTIME_SYMNUM;RUNTIME_SYMNUMX;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WINDOWS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\windows;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
diff --git a/windows/hid.c b/windows/hid.c
index 8f80071..6c379b5 100644
--- a/windows/hid.c
+++ b/windows/hid.c
@@ -687,7 +687,7 @@ int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *
length = dev->output_report_length;
}
- res = WriteFile(dev->device_handle, buf, length, NULL, &ol);
+ res = WriteFile(dev->device_handle, buf, (DWORD)length, NULL, &ol);
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
@@ -730,7 +730,7 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
dev->read_pending = TRUE;
memset(dev->read_buf, 0, dev->input_report_length);
ResetEvent(ev);
- res = ReadFile(dev->device_handle, dev->read_buf, dev->input_report_length, &bytes_read, &dev->ol);
+ res = ReadFile(dev->device_handle, dev->read_buf, (DWORD)dev->input_report_length, &bytes_read, &dev->ol);
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
@@ -784,7 +784,7 @@ end_of_function:
return -1;
}
- return copy_len;
+ return (int)copy_len;
}
int HID_API_EXPORT HID_API_CALL hid_read(hid_device *dev, unsigned char *data, size_t length)
@@ -800,13 +800,13 @@ int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *dev, int nonbloc
int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length)
{
- BOOL res = HidD_SetFeature(dev->device_handle, (PVOID)data, length);
+ BOOL res = HidD_SetFeature(dev->device_handle, (PVOID)data, (ULONG)length);
if (!res) {
register_error(dev, "HidD_SetFeature");
return -1;
}
- return length;
+ return (int)length;
}
@@ -828,8 +828,8 @@ int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned
res = DeviceIoControl(dev->device_handle,
IOCTL_HID_GET_FEATURE,
- data, length,
- data, length,
+ data, (DWORD)length,
+ data, (DWORD)length,
&bytes_returned, &ol);
if (!res) {
@@ -870,7 +870,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_manufacturer_string(hid_device *dev
{
BOOL res;
- res = HidD_GetManufacturerString(dev->device_handle, string, sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS));
+ res = HidD_GetManufacturerString(dev->device_handle, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS)));
if (!res) {
register_error(dev, "HidD_GetManufacturerString");
return -1;
@@ -883,7 +883,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_product_string(hid_device *dev, wch
{
BOOL res;
- res = HidD_GetProductString(dev->device_handle, string, sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS));
+ res = HidD_GetProductString(dev->device_handle, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS)));
if (!res) {
register_error(dev, "HidD_GetProductString");
return -1;
@@ -896,7 +896,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_serial_number_string(hid_device *de
{
BOOL res;
- res = HidD_GetSerialNumberString(dev->device_handle, string, sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS));
+ res = HidD_GetSerialNumberString(dev->device_handle, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS)));
if (!res) {
register_error(dev, "HidD_GetSerialNumberString");
return -1;
@@ -909,7 +909,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_indexed_string(hid_device *dev, int
{
BOOL res;
- res = HidD_GetIndexedString(dev->device_handle, string_index, string, sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS));
+ res = HidD_GetIndexedString(dev->device_handle, string_index, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS)));
if (!res) {
register_error(dev, "HidD_GetIndexedString");
return -1;