[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [2802] Fixed right shift problem in HttpDir::formatByt
From: |
Giuseppe Scrivano |
Subject: |
[myserver-commit] [2802] Fixed right shift problem in HttpDir::formatBytes. |
Date: |
Fri, 12 Sep 2008 23:09:50 +0000 |
Revision: 2802
http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2802
Author: gscrivano
Date: 2008-09-12 23:09:50 +0000 (Fri, 12 Sep 2008)
Log Message:
-----------
Fixed right shift problem in HttpDir::formatBytes.
Modified Paths:
--------------
trunk/myserver/src/http_handler/http_dir/http_dir.cpp
Modified: trunk/myserver/src/http_handler/http_dir/http_dir.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_dir/http_dir.cpp 2008-09-12
22:43:24 UTC (rev 2801)
+++ trunk/myserver/src/http_handler/http_dir/http_dir.cpp 2008-09-12
23:09:50 UTC (rev 2802)
@@ -114,7 +114,10 @@
*/
double HttpDir::formatBytes(u_long bytes, u_int power)
{
- const u_long quotient = bytes >> power;
+ /* u_long can be 32 bits. Don't do a right shift that is bigger than
+ * its size. */
+ const u_long quotient = (bytes >> (power / 2)) >> (power / 2);
+
if (quotient == 0)
return -1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [2802] Fixed right shift problem in HttpDir::formatBytes.,
Giuseppe Scrivano <=