The MinGW.OSDN Installation Manager Tool
Revision | d713d9c13b5976fd05843c087fd16353969b395d (tree) |
---|---|
Zeit | 2012-12-14 23:27:16 |
Autor | Keith Marshall <keithmarshall@user...> |
Commiter | Keith Marshall |
Insert a missing snprintf format effector.
@@ -1,5 +1,15 @@ | ||
1 | 1 | 2012-12-14 Keith Marshall <keithmarshall@users.sourceforge.net> |
2 | 2 | |
3 | + Insert a missing snprintf format effector. | |
4 | + | |
5 | + * src/pkgnget.cpp (pkgDownloadMeterGUI::Update): Add omitted '%' | |
6 | + format specifier, in "%%", for formatting percentage-complete value. | |
7 | + Rename "size_buf" automatic variable as "buf"; this results in shorter | |
8 | + source lines, and consequently a tidier source code layout. | |
9 | + (pkgDownloadMeterGUI::ResetGUI): Likewise s/size_buf/buf/ | |
10 | + | |
11 | +2012-12-14 Keith Marshall <keithmarshall@users.sourceforge.net> | |
12 | + | |
3 | 13 | Add a missing header reference. |
4 | 14 | |
5 | 15 | * src/approot.h: Include stdint.h; this ensures that wchar_t is |
@@ -73,11 +73,11 @@ void pkgDownloadMeterGUI::ResetGUI( const char *filename, unsigned long size ) | ||
73 | 73 | * download of a new archive file; the name of this file, and its |
74 | 74 | * anticipated size are preset, as specified by the arguments. |
75 | 75 | */ |
76 | - char size_buf[12]; SizeFormat( size_buf, 0 ); | |
76 | + char buf[12]; SizeFormat( buf, 0 ); | |
77 | 77 | SendMessage( file_name, WM_SETTEXT, 0, (LPARAM)(filename) ); |
78 | - SendMessage( copy_size, WM_SETTEXT, 0, (LPARAM)(size_buf) ); | |
79 | - SizeFormat( size_buf, content_length = size ); | |
80 | - SendMessage( file_size, WM_SETTEXT, 0, (LPARAM)(size_buf) ); | |
78 | + SendMessage( copy_size, WM_SETTEXT, 0, (LPARAM)(buf) ); | |
79 | + SizeFormat( buf, content_length = size ); | |
80 | + SendMessage( file_size, WM_SETTEXT, 0, (LPARAM)(buf) ); | |
81 | 81 | SendMessage( copy_frac, WM_SETTEXT, 0, (LPARAM)("0 %") ); |
82 | 82 | SendMessage( progress_bar, PBM_SETRANGE, 0, MAKELPARAM( 0, 100 ) ); |
83 | 83 | SendMessage( progress_bar, PBM_SETPOS, 0, 0 ); |
@@ -90,21 +90,21 @@ int pkgDownloadMeterGUI::Update( unsigned long count ) | ||
90 | 90 | * received from the repository host, so that this method may |
91 | 91 | * refresh the progress counters in the dialogue box. |
92 | 92 | */ |
93 | - char size_buf[12]; | |
93 | + char buf[12]; | |
94 | 94 | |
95 | 95 | /* First, we update the display of the actual byte count... |
96 | 96 | */ |
97 | - SizeFormat( size_buf, count ); | |
98 | - SendMessage( copy_size, WM_SETTEXT, 0, (LPARAM)(size_buf) ); | |
97 | + SizeFormat( buf, count ); | |
98 | + SendMessage( copy_size, WM_SETTEXT, 0, (LPARAM)(buf) ); | |
99 | 99 | |
100 | 100 | /* ...then we convert that byte count to a percentage of |
101 | 101 | * the anticipated file size, using the result to update |
102 | 102 | * the percentage completed, and the progress bar. |
103 | 103 | */ |
104 | 104 | count = (count * 100) / content_length; |
105 | - if( snprintf( size_buf, sizeof( size_buf ), "%d %", count ) >= sizeof( size_buf ) ) | |
106 | - strcpy( size_buf, "*** %" ); | |
107 | - SendMessage( copy_frac, WM_SETTEXT, 0, (LPARAM)(size_buf) ); | |
105 | + if( snprintf( buf, sizeof( buf ), "%d %%", count ) >= sizeof( buf ) ) | |
106 | + strcpy( buf, "*** %" ); | |
107 | + SendMessage( copy_frac, WM_SETTEXT, 0, (LPARAM)(buf) ); | |
108 | 108 | SendMessage( progress_bar, PBM_SETPOS, count, 0 ); |
109 | 109 | } |
110 | 110 |