mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[misc] fixes for Clang/C2 compilation support
This commit is contained in:
		
							parent
							
								
									2e530d5ce7
								
							
						
					
					
						commit
						39d6b90447
					
				
					 13 changed files with 34 additions and 26 deletions
				
			
		|  | @ -50,8 +50,8 @@ | ||||||
| #include "file.h" | #include "file.h" | ||||||
| 
 | 
 | ||||||
| FILE* log_fd = NULL; | FILE* log_fd = NULL; | ||||||
| static const char* abort_msg = "Too many bad blocks, aborting test\n"; | static const char abort_msg[] = "Too many bad blocks, aborting test\n"; | ||||||
| static const char* bb_prefix = "Bad Blocks: "; | static const char bb_prefix[] = "Bad Blocks: "; | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  *From e2fsprogs/lib/ext2fs/badblocks.c |  *From e2fsprogs/lib/ext2fs/badblocks.c | ||||||
|  |  | ||||||
|  | @ -68,7 +68,7 @@ char sum_str[CHECKSUM_MAX][65]; | ||||||
| uint32_t bufnum, sum_count[CHECKSUM_MAX] = { 16, 20, 32 }; | uint32_t bufnum, sum_count[CHECKSUM_MAX] = { 16, 20, 32 }; | ||||||
| HANDLE data_ready[CHECKSUM_MAX], thread_ready[CHECKSUM_MAX]; | HANDLE data_ready[CHECKSUM_MAX], thread_ready[CHECKSUM_MAX]; | ||||||
| DWORD read_size[2]; | DWORD read_size[2]; | ||||||
| char ALIGNED(64) buffer[2][BUFFER_SIZE]; | unsigned char ALIGNED(64) buffer[2][BUFFER_SIZE]; | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Rotate 32 bit integers by n bytes. |  * Rotate 32 bit integers by n bytes. | ||||||
|  | @ -718,7 +718,7 @@ sum_final_t *sum_final[CHECKSUM_MAX] = { md5_final, sha1_final , sha256_final }; | ||||||
| BOOL HashFile(const unsigned type, const char* path, uint8_t* sum) | BOOL HashFile(const unsigned type, const char* path, uint8_t* sum) | ||||||
| { | { | ||||||
| 	BOOL r = FALSE; | 	BOOL r = FALSE; | ||||||
| 	SUM_CONTEXT sum_ctx = { 0 }; | 	SUM_CONTEXT sum_ctx = { {0} }; | ||||||
| 	HANDLE h = INVALID_HANDLE_VALUE; | 	HANDLE h = INVALID_HANDLE_VALUE; | ||||||
| 	DWORD rs = 0; | 	DWORD rs = 0; | ||||||
| 	uint64_t rb; | 	uint64_t rb; | ||||||
|  | @ -759,7 +759,7 @@ out: | ||||||
| BOOL HashBuffer(const unsigned type, const unsigned char* buf, const size_t len, uint8_t* sum) | BOOL HashBuffer(const unsigned type, const unsigned char* buf, const size_t len, uint8_t* sum) | ||||||
| { | { | ||||||
| 	BOOL r = FALSE; | 	BOOL r = FALSE; | ||||||
| 	SUM_CONTEXT sum_ctx = { 0 }; | 	SUM_CONTEXT sum_ctx = { {0} }; | ||||||
| 
 | 
 | ||||||
| 	if ((type >= CHECKSUM_MAX) || (sum == NULL)) | 	if ((type >= CHECKSUM_MAX) || (sum == NULL)) | ||||||
| 		goto out; | 		goto out; | ||||||
|  | @ -845,7 +845,7 @@ INT_PTR CALLBACK ChecksumCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM | ||||||
| // Individual thread that computes one of MD5, SHA1 or SHA256 in parallel
 | // Individual thread that computes one of MD5, SHA1 or SHA256 in parallel
 | ||||||
| DWORD WINAPI IndividualSumThread(void* param) | DWORD WINAPI IndividualSumThread(void* param) | ||||||
| { | { | ||||||
| 	SUM_CONTEXT sum_ctx = { 0 }; // There's a memset in sum_init, but static analyzers still bug us
 | 	SUM_CONTEXT sum_ctx = { {0} }; // There's a memset in sum_init, but static analyzers still bug us
 | ||||||
| 	uint32_t i = (uint32_t)(uintptr_t)param, j; | 	uint32_t i = (uint32_t)(uintptr_t)param, j; | ||||||
| 
 | 
 | ||||||
| 	sum_init[i](&sum_ctx); | 	sum_init[i](&sum_ctx); | ||||||
|  |  | ||||||
|  | @ -71,10 +71,6 @@ typedef struct _TIME_FIELDS { | ||||||
| #define ARGUMENT_PRESENT(ArgumentPointer) \ | #define ARGUMENT_PRESENT(ArgumentPointer) \ | ||||||
| 	((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL) | 	((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL) | ||||||
| 
 | 
 | ||||||
| static const int YearLengths[2] = |  | ||||||
| { |  | ||||||
| 	DAYSPERNORMALYEAR, DAYSPERLEAPYEAR |  | ||||||
| }; |  | ||||||
| static const UCHAR MonthLengths[2][MONSPERYEAR] = | static const UCHAR MonthLengths[2][MONSPERYEAR] = | ||||||
| { | { | ||||||
| 	{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, | 	{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, | ||||||
|  |  | ||||||
|  | @ -1720,7 +1720,14 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 			if (report.bb_count) { | 			if (report.bb_count) { | ||||||
| 				bb_msg = lmprintf(MSG_011, report.bb_count, report.num_read_errors, report.num_write_errors, | 				bb_msg = lmprintf(MSG_011, report.bb_count, report.num_read_errors, report.num_write_errors, | ||||||
| 					report.num_corruption_errors); | 					report.num_corruption_errors); | ||||||
|  | #if defined(__clang__) | ||||||
|  | #pragma clang diagnostic push | ||||||
|  | #pragma clang diagnostic ignored "-Wformat-security" | ||||||
|  | #endif | ||||||
| 				fprintf(log_fd, bb_msg); | 				fprintf(log_fd, bb_msg); | ||||||
|  | #if defined(__clang__) | ||||||
|  | #pragma clang diagnostic pop | ||||||
|  | #endif | ||||||
| 				GetLocalTime(<); | 				GetLocalTime(<); | ||||||
| 				fprintf(log_fd, APPLICATION_NAME " bad blocks check ended on: %04d.%02d.%02d %02d:%02d:%02d\n", | 				fprintf(log_fd, APPLICATION_NAME " bad blocks check ended on: %04d.%02d.%02d %02d:%02d:%02d\n", | ||||||
| 				lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond); | 				lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond); | ||||||
|  |  | ||||||
|  | @ -88,7 +88,7 @@ static inline int _stati64_utf8(const char *path, struct _stati64 *buffer) { | ||||||
| #define _STRINGIFY(a) #a | #define _STRINGIFY(a) #a | ||||||
| #define STRINGIFY(a) _STRINGIFY(a) | #define STRINGIFY(a) _STRINGIFY(a) | ||||||
| 
 | 
 | ||||||
| static const char _rcsid[] = "$Id: _cdio_stdio.c,v 1.6 2008/04/22 15:29:11 karl Exp $"; | // static const char _rcsid[] = "$Id: _cdio_stdio.c,v 1.6 2008/04/22 15:29:11 karl Exp $";
 | ||||||
| 
 | 
 | ||||||
| #define CDIO_STDIO_BUFSIZE (128*1024) | #define CDIO_STDIO_BUFSIZE (128*1024) | ||||||
| 
 | 
 | ||||||
|  | @ -283,7 +283,8 @@ cdio_stdio_new(const char pathname[]) | ||||||
|   return new_obj; |   return new_obj; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| /* 
 | /* 
 | ||||||
|  * Local variables: |  * Local variables: | ||||||
|  *  c-file-style: "gnu" |  *  c-file-style: "gnu" | ||||||
|  |  | ||||||
|  | @ -41,7 +41,7 @@ | ||||||
| #include <cdio/util.h> | #include <cdio/util.h> | ||||||
| #include "_cdio_stream.h" | #include "_cdio_stream.h" | ||||||
| 
 | 
 | ||||||
| static const char _rcsid[] = "$Id: _cdio_stream.c,v 1.9 2008/04/22 15:29:11 karl Exp $"; | // static const char _rcsid[] = "$Id: _cdio_stream.c,v 1.9 2008/04/22 15:29:11 karl Exp $";
 | ||||||
| 
 | 
 | ||||||
| /* 
 | /* 
 | ||||||
|  * DataSource implementations |  * DataSource implementations | ||||||
|  | @ -212,7 +212,8 @@ cdio_stream_stat(CdioDataSource_t *p_obj) | ||||||
|   return p_obj->op.stat(p_obj->user_data); |   return p_obj->op.stat(p_obj->user_data); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| /* 
 | /* 
 | ||||||
|  * Local variables: |  * Local variables: | ||||||
|  *  c-file-style: "gnu" |  *  c-file-style: "gnu" | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ | ||||||
| #include <cdio/types.h> | #include <cdio/types.h> | ||||||
| #include "cdio_assert.h" | #include "cdio_assert.h" | ||||||
| 
 | 
 | ||||||
| static const char _rcsid[] = "$Id: ds.c,v 1.4 2008/04/22 15:29:12 karl Exp $"; | // static const char _rcsid[] = "$Id: ds.c,v 1.4 2008/04/22 15:29:12 karl Exp $";
 | ||||||
| 
 | 
 | ||||||
| struct _CdioList | struct _CdioList | ||||||
| { | { | ||||||
|  | @ -243,7 +243,8 @@ _cdio_list_node_data (CdioListNode_t *p_node) | ||||||
| 
 | 
 | ||||||
| /* eof */ | /* eof */ | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| /* 
 | /* 
 | ||||||
|  * Local variables: |  * Local variables: | ||||||
|  *  c-file-style: "gnu" |  *  c-file-style: "gnu" | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
| 
 | 
 | ||||||
| static const char _rcsid[] = "$Id: sector.c,v 1.5 2005/02/06 04:20:25 rocky Exp $"; | // static const char _rcsid[] = "$Id: sector.c,v 1.5 2005/02/06 04:20:25 rocky Exp $";
 | ||||||
| 
 | 
 | ||||||
| /*! String of bytes used to identify the beginning of a Mode 1 or
 | /*! String of bytes used to identify the beginning of a Mode 1 or
 | ||||||
|   Mode 2 sector. */ |   Mode 2 sector. */ | ||||||
|  |  | ||||||
|  | @ -119,7 +119,7 @@ localtime_r(const time_t *timer, struct tm *result) | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| static const char _rcsid[] = "$Id: iso9660.c,v 1.41 2008/06/25 08:01:54 rocky Exp $"; | // static const char _rcsid[] = "$Id: iso9660.c,v 1.41 2008/06/25 08:01:54 rocky Exp $";
 | ||||||
| 
 | 
 | ||||||
| /* Variables to hold debugger-helping enumerations */ | /* Variables to hold debugger-helping enumerations */ | ||||||
| enum iso_enum1_s     iso_enums1; | enum iso_enum1_s     iso_enums1; | ||||||
|  |  | ||||||
|  | @ -46,7 +46,7 @@ | ||||||
|  * We account for these built-in calls doing nothing if the |  * We account for these built-in calls doing nothing if the | ||||||
|  * line has already been fetched, or if the address is invalid. |  * line has already been fetched, or if the address is invalid. | ||||||
|  */ |  */ | ||||||
| #if defined(__GNUC__) | #if defined(__GNUC__) || defined(__clang__) | ||||||
| #define PREFETCH64(m) do { __builtin_prefetch(m, 0, 0); __builtin_prefetch(m+32, 0, 0); } while(0) | #define PREFETCH64(m) do { __builtin_prefetch(m, 0, 0); __builtin_prefetch(m+32, 0, 0); } while(0) | ||||||
| #elif defined(_MSC_VER) | #elif defined(_MSC_VER) | ||||||
| #define PREFETCH64(m) do { _m_prefetch(m); _m_prefetch(m+32); } while(0) | #define PREFETCH64(m) do { _m_prefetch(m); _m_prefetch(m+32); } while(0) | ||||||
|  | @ -55,9 +55,11 @@ | ||||||
| /* Read/write with endianness swap */ | /* Read/write with endianness swap */ | ||||||
| #if defined (_MSC_VER) && (_MSC_VER >= 1300) | #if defined (_MSC_VER) && (_MSC_VER >= 1300) | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
|  | #if !defined(__clang__) | ||||||
| #pragma intrinsic(_byteswap_ushort) | #pragma intrinsic(_byteswap_ushort) | ||||||
| #pragma intrinsic(_byteswap_ulong) | #pragma intrinsic(_byteswap_ulong) | ||||||
| #pragma intrinsic(_byteswap_uint64) | #pragma intrinsic(_byteswap_uint64) | ||||||
|  | #endif | ||||||
| #define bswap_uint64 _byteswap_uint64 | #define bswap_uint64 _byteswap_uint64 | ||||||
| #define bswap_uint32 _byteswap_ulong | #define bswap_uint32 _byteswap_ulong | ||||||
| #define bswap_uint16 _byteswap_ushort | #define bswap_uint16 _byteswap_ushort | ||||||
|  |  | ||||||
|  | @ -2781,7 +2781,7 @@ static BOOL IsCurrentProcessElevated(void) | ||||||
| 	DWORD size; | 	DWORD size; | ||||||
| 	HANDLE token = INVALID_HANDLE_VALUE; | 	HANDLE token = INVALID_HANDLE_VALUE; | ||||||
| 	TOKEN_ELEVATION te; | 	TOKEN_ELEVATION te; | ||||||
| 	SID_IDENTIFIER_AUTHORITY auth = SECURITY_NT_AUTHORITY; | 	SID_IDENTIFIER_AUTHORITY auth = { SECURITY_NT_AUTHORITY }; | ||||||
| 	PSID psid; | 	PSID psid; | ||||||
| 
 | 
 | ||||||
| 	if (ReadRegistryKey32(REGKEY_HKLM, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\EnableLUA") == 1) { | 	if (ReadRegistryKey32(REGKEY_HKLM, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\EnableLUA") == 1) { | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 242, 376 | IDD_DIALOG DIALOGEX 12, 12, 242, 376 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_ACCEPTFILES | EXSTYLE WS_EX_ACCEPTFILES | ||||||
| CAPTION "Rufus 2.10.947" | CAPTION "Rufus 2.10.948" | ||||||
| FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 |     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 | ||||||
|  | @ -320,8 +320,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 2,10,947,0 |  FILEVERSION 2,10,948,0 | ||||||
|  PRODUCTVERSION 2,10,947,0 |  PRODUCTVERSION 2,10,948,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -338,13 +338,13 @@ BEGIN | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" |             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "2.10.947" |             VALUE "FileVersion", "2.10.948" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" |             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||||
|             VALUE "OriginalFilename", "rufus.exe" |             VALUE "OriginalFilename", "rufus.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "2.10.947" |             VALUE "ProductVersion", "2.10.948" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
|  | @ -527,7 +527,7 @@ enum WIMMessage { | ||||||
| 	WIM_MSG_WARNING,	// Sent when a warning message is available.
 | 	WIM_MSG_WARNING,	// Sent when a warning message is available.
 | ||||||
| 	WIM_MSG_CHK_PROCESS, | 	WIM_MSG_CHK_PROCESS, | ||||||
| 	WIM_MSG_SUCCESS = 0x00000000, | 	WIM_MSG_SUCCESS = 0x00000000, | ||||||
| 	WIM_MSG_ABORT_IMAGE = 0xFFFFFFFF | 	WIM_MSG_ABORT_IMAGE = -1 | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #define INVALID_CALLBACK_VALUE 0xFFFFFFFF | #define INVALID_CALLBACK_VALUE 0xFFFFFFFF | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue