- ULONG is always >= 0
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Thu, 1 Feb 2007 23:05:32 +0000 (23:05 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Thu, 1 Feb 2007 23:05:32 +0000 (23:05 +0000)
- Include limits.h to use ULONG_MAX instead of doing a cast

svn path=/trunk/; revision=25676

reactos/drivers/base/beep/beep.c

index dc5872e..53062ca 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <ntddk.h>
 #include <ntddbeep.h>
+#include <limits.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -183,7 +184,7 @@ BeepDeviceControl(PDEVICE_OBJECT DeviceObject,
   DPRINT("Beep:\n  Freq: %lu Hz\n  Dur: %lu ms\n",
         BeepParam->Frequency,
         BeepParam->Duration);
-  if (BeepParam->Duration >= 0)
+  if (BeepParam->Duration > 0)
     {
       DueTime.QuadPart = (LONGLONG)BeepParam->Duration * -10000;
 
@@ -199,7 +200,7 @@ BeepDeviceControl(PDEVICE_OBJECT DeviceObject,
                            FALSE,
                            NULL);
     }
-  else if (BeepParam->Duration == (ULONG)-1)
+  else if (BeepParam->Duration == ULONG_MAX)
     {
       if (DeviceExtension->BeepOn == TRUE)
        {