smb.c:320 warning C6297: Arithmetic overflow

2014-12-14 Thread Marc Hoersken
Hey everyone, would someone who has been working on SMB mind taking a look at the following warning for line 320 in smb.c while building for Windows 64-bit using VS2012: warning C6297: Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit value. Result may not be an expected value

RE: smb.c:320 warning C6297: Arithmetic overflow

2014-12-14 Thread Steve Holme
On Sun, 14 Dec 2014, Marc Hoersken wrote: would someone who has been working on SMB mind taking a look at the following warning for line 320 in smb.c while building for Windows 64-bit using VS2012: That was me that implemented that to fix an issue with large file transfers. warning C6297:

Re: smb.c:320 warning C6297: Arithmetic overflow

2014-12-14 Thread Marc Hoersken
On 14.12.2014 20:33 Steve Holme wrote: I don't get the warning myself on VS2012 with warning level /W3 or when extending it to /W4 or /Wall so I'm a little blind here :( Is there anything I can enable in the generated project files to see what you're seeing? I used the code analysis

RE: smb.c:320 warning C6297: Arithmetic overflow

2014-12-14 Thread Steve Holme
On Sun, 14 Dec 2014, Marc Hoersken wrote: Is there anything I can enable in the generated project files to see what you're seeing? I used the code analysis feature of Visual Studio Premium 2012 and ran it against the whole solution. Ah - I'm not using the Premium version :( I read the

Re: smb.c:320 warning C6297: Arithmetic overflow

2014-12-14 Thread Marc Hoersken
On 14.12.2014 21:00 Steve Holme wrote: I read the MSDN article for that warning and believe we have to cast to a size_t before the shift happens. As such, I have performed some testing on large files to make sure I don't break anything. I separated the length out into its own variable so I

RE: smb.c:320 warning C6297: Arithmetic overflow

2014-12-14 Thread Steve Holme
On Sun, 14 Dec 2014, Marc Hoersken wrote: Are you able to try it using the code analysis feature - please - to see if you still get the warning? Yep, just applied this small change and it looks good. The warning is gone using the code analysis. Cheers Marc - committed and pushed. Kind