Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CRC32 returns negative on big files
Message
From
01/08/2011 02:46:36
 
 
To
31/07/2011 15:57:12
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01519635
Message ID:
01519770
Views:
24
>>(1) The short way is to cast the return result to UInteger, and change the return type of GetCrc32() to UInteger
>
>This line cannot be changed to UInteger:
>
>
>        Dim lnCRC32Result As Integer = &HFFFFFFFF
>
>
>It would give an error: "Constant expression not representable in type 'UInteger"

That seems odd (although I agree it is true).
The equivalent in C# is fine ( UInt32 lcCRC33Result = 0xFFFFFFFF) and you can achieve the requred result in VB using ' Dim lnCRC32Result = UInt32.MaxValue'

But VB.NET isn't my first language so there may be some VB related quirk I'm not aware of. IAC, AFAICS, we've established that an unsigned int isn't a good choice since it offers no benefits and may, in some circumstances, be less useful in that (a) it's not CLS compliant and (b) it may not be storable in some databases.

Best,
Viv
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform