[ros-bugs] [Bug 6294] PATCH: A file's size in bytes is not displayed.

ReactOS.Bugzilla at reactos.org ReactOS.Bugzilla at reactos.org
Fri Nov 25 23:07:56 UTC 2011


http://www.reactos.org/bugzilla/show_bug.cgi?id=6294





--- Comment #10 from Carlo Bramix <carlo.bramix at libero.it>  2011-11-25 23:07:55 CET ---
Created an attachment (id=7039)
 --> (http://www.reactos.org/bugzilla/attachment.cgi?id=7039)
Fix for this bug

Please do not get me wrong, but I disagree with the last patch too.
In my opinion it still looks wrong and unsafe.
I tried to do a patch myself for clearing this bug.
I implemented this function:

LPWSTR SH_FormatFileSizeWithBytes(
    PULARGE_INTEGER lpQwSize,
    LPWSTR pszBuf,
    UINT cchBuf);

which overlays the functionalities of StrFormatByteSizeW().
While working on this, I did a little inspection on the sources that I touched
and I did few changes:

- Some LARGE_INTEGER types have been changed to ULARGE_INTEGER since they are
infact unsigned types.

- GetFreeBytesShare() returns a value between 0 and 100, so there is no need to
use an ULONGLONG.

- I found a bug in function CountFolderAndFiles() into folder_options.cpp.
the following lines are wrong:

pContext->bSize.u.LowPart += FindData.nFileSizeLow;
pContext->bSize.u.HighPart += FindData.nFileSizeHigh;

because there is no carry propagation between low and high parts.
So, the size of the file must be moved to an ULARGE_INTEGER and then summed to
pContext->bSize as quadparts.

- In function OpenWithProgrammDlg() from she_ocmenu.cpp, there is a bug:
WM_GETTEXT received the size in bytes instead of the size in characters.

- I also would like to suggest to use in some points SetDlgItemTextW() and
GetDlgItemTextW() instead of using SendDlgItemMessageW() with
WM_SETTEXT/WM_GETTEXT.
It seems to me to improve code readability.


-- 
Configure bugmail: http://www.reactos.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



More information about the Ros-bugs mailing list