Ports
May 21, 2013, 06:16:06 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Login Register  
Welcome to the PORTS Forum. Please post your questions, answers, and comments relating to USB and other hardware interfaces in the appropriate forums below. - Jan
Pages: [1]
  Print  
Author Topic: IntPtr <-> Int32 safety  (Read 643 times)
vanweric
Member
***
Posts: 24


« on: January 10, 2012, 06:25:18 pm »

Jan -

I noticed this line in one of your demos, and was worried about the type safety:

IntPtr pDevicePathName = new IntPtr(detailDataBuffer.ToInt32() + 4);
(Generic_hid_cs -> DeviceManagement.cs)

In 64 bit environment, this will chop off the high word.  Are we guaranteed that this will be in the lower 4 gigs?

I replaced it with this to be on the safe side:
IntPtr pDevicePathName = detailDataBuffer + 4;
Logged
Jan Axelson
Administrator
Frequent Contributor
*****
Posts: 1626


WWW
« Reply #1 on: January 10, 2012, 06:28:29 pm »

Thank you for the suggestion!

Jan
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!