• R/O
  • HTTP
  • SSH
  • HTTPS

mingw-get: 提交

The MinGW.OSDN Installation Manager Tool


Commit MetaInfo

修訂5b2d4297d3a55a55004dc78573fcd0415647f376 (tree)
時間2020-06-22 06:54:25
作者Keith Marshall <keith@user...>
CommiterKeith Marshall

Log Message

Declare functions as void when return value is immaterial.

Change Summary

差異

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
11 2020-06-21 Keith Marshall <keith@users.osdn.me>
22
3+ Declare functions as void when return value is immaterial.
4+
5+ * src/pkginet.h (pkgDownloadMeter::Update): Declare it as a pure
6+ virtual void function, rather than as pure virtual int.
7+
8+ * src/pkginet.cpp (pkgDownloadMeterTTY::Update)
9+ * src/pkgnget.cpp (pkgDownloadMeterGUI::Update): Amend derivative
10+ implementations to match; do not return anything.
11+
12+2020-06-21 Keith Marshall <keith@users.osdn.me>
13+
314 Ensure non-void functions always return explicit values.
415
516 * src/guimain.cpp (WinMain): Remove explicit EXIT_FAILURE returns from
--- a/src/pkginet.cpp
+++ b/src/pkginet.cpp
@@ -3,8 +3,8 @@
33 *
44 * $Id$
55 *
6- * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
7- * Copyright (C) 2009-2013, 2017, MinGW.org Project
6+ * Written by Keith Marshall <keith@users.osdn.me>
7+ * Copyright (C) 2009-2013, 2017, 2020, MinGW.org Project
88 *
99 *
1010 * Implementation of the package download machinery for mingw-get.
@@ -89,7 +89,7 @@ class pkgDownloadMeterTTY: public pkgDownloadMeter
8989 pkgDownloadMeterTTY( const char*, unsigned long );
9090 virtual ~pkgDownloadMeterTTY();
9191
92- virtual int Update( unsigned long );
92+ virtual void Update( unsigned long );
9393
9494 private:
9595 /* This buffer is used to store each compiled status report,
@@ -126,7 +126,7 @@ class pkgDownloadMeterTTY: public pkgDownloadMeter
126126 */
127127 public:
128128 pkgDownloadMeterTTY( const char*, unsigned long ){}
129- virtual int Update( unsigned long ){ return 0; }
129+ virtual void Update( unsigned long ){}
130130 };
131131
132132 #endif
@@ -161,7 +161,7 @@ unsigned long percentage( unsigned long x, unsigned long q )
161161
162162 #if IMPLEMENTATION_LEVEL == PACKAGE_BASE_COMPONENT
163163
164-int pkgDownloadMeterTTY::Update( unsigned long count )
164+void pkgDownloadMeterTTY::Update( unsigned long count )
165165 {
166166 /* Implementation of method to update the download progress report,
167167 * displaying the current byte count and anticipated final byte count,
@@ -193,7 +193,7 @@ int pkgDownloadMeterTTY::Update( unsigned long count )
193193 dmh_printf( "%s\n", source_url );
194194 source_url = NULL;
195195 }
196- return dmh_printf( "\r%s%%", status_report );
196+ (void)(dmh_printf( "\r%s%%", status_report ));
197197 }
198198
199199 #endif
--- a/src/pkginet.h
+++ b/src/pkginet.h
@@ -4,8 +4,8 @@
44 *
55 * $Id$
66 *
7- * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
8- * Copyright (C) 2009, 2010, 2011, 2012, MinGW.org Project
7+ * Written by Keith Marshall <keith@users.osdn.me>
8+ * Copyright (C) 2009-2012, 2020, MinGW.org Project
99 *
1010 *
1111 * Public declaration of the download metering class, and support
@@ -67,7 +67,7 @@ class pkgDownloadMeter
6767 /* The working method to refresh the download progress display;
6868 * each derived class MUST furnish an implementation for this.
6969 */
70- virtual int Update( unsigned long ) = 0;
70+ virtual void Update( unsigned long ) = 0;
7171
7272 protected:
7373 /* Reference pointer to the primary instance of the download
--- a/src/pkgnget.cpp
+++ b/src/pkgnget.cpp
@@ -3,8 +3,8 @@
33 *
44 * $Id$
55 *
6- * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
7- * Copyright (C) 2012, 2013, MinGW.org Project
6+ * Written by Keith Marshall <keith@users.osdn.me>
7+ * Copyright (C) 2012, 2013, 2020, MinGW.org Project
88 *
99 *
1010 * Implementation of the network download agent interface, through
@@ -42,7 +42,7 @@ class pkgDownloadMeterGUI: public pkgDownloadMeter
4242 pkgDownloadMeterGUI( HWND );
4343
4444 virtual void ResetGUI( const char *, unsigned long );
45- virtual int Update( unsigned long );
45+ virtual void Update( unsigned long );
4646
4747 inline ~pkgDownloadMeterGUI();
4848
@@ -202,7 +202,7 @@ void pkgDownloadMeterGUI::ResetGUI( const char *filename, unsigned long size )
202202 SendMessage( progress_bar, PBM_SETPOS, 0, 0 );
203203 }
204204
205-int pkgDownloadMeterGUI::Update( unsigned long count )
205+void pkgDownloadMeterGUI::Update( unsigned long count )
206206 {
207207 /* Method to update the download progress report; the download
208208 * agent invokes this after each block of archive data has been
Show on old repository browser