The MinGW.OSDN Installation Manager Tool
Révision | 2e5e8d50c4490b32b666efc42a7ea07b6e890f82 (tree) |
---|---|
l'heure | 2020-06-21 20:31:36 |
Auteur | Keith Marshall <keith@user...> |
Commiter | Keith Marshall |
Ensure non-void functions always return explicit values.
@@ -1,3 +1,15 @@ | ||
1 | +2020-06-21 Keith Marshall <keith@users.osdn.me> | |
2 | + | |
3 | + Ensure non-void functions always return explicit values. | |
4 | + | |
5 | + * src/guimain.cpp (WinMain): Remove explicit EXIT_FAILURE returns from | |
6 | + individual exception handlers; relocate it to the default execution | |
7 | + path, to which all such handlers will fall through. | |
8 | + | |
9 | + * src/dmhguix.cpp (dmhTypeGUI::notify) [DMH_COMPILE_DIGEST]: Return | |
10 | + number of bytes added to message queue; fall through, to return zero, | |
11 | + on failure to extend the queue. | |
12 | + | |
1 | 13 | 2020-06-20 Keith Marshall <keith@users.osdn.me> |
2 | 14 | |
3 | 15 | Simplify numeric argument interpreter function. |
@@ -3,8 +3,8 @@ | ||
3 | 3 | * |
4 | 4 | * $Id$ |
5 | 5 | * |
6 | - * Written by Keith Marshall <keithmarshall@users.sourceforge.net> | |
7 | - * Copyright (C) 2009-2013, MinGW.org Project | |
6 | + * Written by Keith Marshall <keith@users.osdn.me> | |
7 | + * Copyright (C) 2009-2013, 2020, MinGW.org Project | |
8 | 8 | * |
9 | 9 | * |
10 | 10 | * Implementation of GUI specific API extensions, providing support |
@@ -395,6 +395,7 @@ int dmhTypeGUI::notify( const dmh_severity code, const char *fmt, va_list argv ) | ||
395 | 395 | * to the buffered collection. |
396 | 396 | */ |
397 | 397 | msglen += vsprintf( (msgbuf = newbuf) + msglen, fmt, argv ); |
398 | + return newlen - 1; | |
398 | 399 | } |
399 | 400 | } |
400 | 401 | else if( (msgbuf = (char *)(malloc( newlen ))) != NULL ) |
@@ -406,6 +407,10 @@ int dmhTypeGUI::notify( const dmh_severity code, const char *fmt, va_list argv ) | ||
406 | 407 | mode = code | (mode & ~DMH_SEVERITY_MASK); |
407 | 408 | return dispatch_message( vsprintf( msgbuf, fmt, argv ) ); |
408 | 409 | } |
410 | + /* If we get to here, then no message was dispatched; the | |
411 | + * effective message length should be returned as zero. | |
412 | + */ | |
413 | + return 0; | |
409 | 414 | } |
410 | 415 | |
411 | 416 | static inline HWND last_active_popup( HWND owner ) |
@@ -3,8 +3,8 @@ | ||
3 | 3 | * |
4 | 4 | * $Id$ |
5 | 5 | * |
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 | |
8 | 8 | * |
9 | 9 | * |
10 | 10 | * Implementation of the WinMain() function, providing the program |
@@ -95,7 +95,6 @@ int APIENTRY WinMain | ||
95 | 95 | * and identified by the diagnostic message handler... |
96 | 96 | */ |
97 | 97 | MessageBox( NULL, e.what(), "WinMain", MB_ICONERROR ); |
98 | - return EXIT_FAILURE; | |
99 | 98 | } |
100 | 99 | catch( runtime_error &e ) |
101 | 100 | { |
@@ -104,15 +103,14 @@ int APIENTRY WinMain | ||
104 | 103 | * processing of its message loop... |
105 | 104 | */ |
106 | 105 | MessageBox( NULL, e.what(), "WinMain", MB_ICONERROR ); |
107 | - return EXIT_FAILURE; | |
108 | 106 | } |
109 | 107 | catch(...) |
110 | 108 | { /* ...and here, we diagnose any other error which we weren't |
111 | 109 | * able to explicitly identify. |
112 | 110 | */ |
113 | 111 | MessageBox( NULL, "Unknown exception", "WinMain", MB_ICONERROR ); |
114 | - return EXIT_FAILURE; | |
115 | 112 | } |
113 | + return EXIT_FAILURE; | |
116 | 114 | } |
117 | 115 | |
118 | 116 | /* $RCSfile$: end of file */ |