1
1
Fork 0
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:
Pete Batard 2016-06-04 17:10:33 +01:00
parent 2e530d5ce7
commit 39d6b90447
13 changed files with 34 additions and 26 deletions

View file

@ -50,8 +50,8 @@
#include "file.h"
FILE* log_fd = NULL;
static const char* abort_msg = "Too many bad blocks, aborting test\n";
static const char* bb_prefix = "Bad Blocks: ";
static const char abort_msg[] = "Too many bad blocks, aborting test\n";
static const char bb_prefix[] = "Bad Blocks: ";
/*
*From e2fsprogs/lib/ext2fs/badblocks.c

View file

@ -68,7 +68,7 @@ char sum_str[CHECKSUM_MAX][65];
uint32_t bufnum, sum_count[CHECKSUM_MAX] = { 16, 20, 32 };
HANDLE data_ready[CHECKSUM_MAX], thread_ready[CHECKSUM_MAX];
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.
@ -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 r = FALSE;
SUM_CONTEXT sum_ctx = { 0 };
SUM_CONTEXT sum_ctx = { {0} };
HANDLE h = INVALID_HANDLE_VALUE;
DWORD rs = 0;
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 r = FALSE;
SUM_CONTEXT sum_ctx = { 0 };
SUM_CONTEXT sum_ctx = { {0} };
if ((type >= CHECKSUM_MAX) || (sum == NULL))
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
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;
sum_init[i](&sum_ctx);

View file

@ -71,10 +71,6 @@ typedef struct _TIME_FIELDS {
#define ARGUMENT_PRESENT(ArgumentPointer) \
((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
static const int YearLengths[2] =
{
DAYSPERNORMALYEAR, DAYSPERLEAPYEAR
};
static const UCHAR MonthLengths[2][MONSPERYEAR] =
{
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },

View file

@ -1720,7 +1720,14 @@ DWORD WINAPI FormatThread(void* param)
if (report.bb_count) {
bb_msg = lmprintf(MSG_011, report.bb_count, report.num_read_errors, report.num_write_errors,
report.num_corruption_errors);
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
#endif
fprintf(log_fd, bb_msg);
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
GetLocalTime(&lt);
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);

View file

@ -88,7 +88,7 @@ static inline int _stati64_utf8(const char *path, struct _stati64 *buffer) {
#define _STRINGIFY(a) #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)
@ -283,7 +283,8 @@ cdio_stdio_new(const char pathname[])
return new_obj;
}
/*
* Local variables:
* c-file-style: "gnu"

View file

@ -41,7 +41,7 @@
#include <cdio/util.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
@ -212,7 +212,8 @@ cdio_stream_stat(CdioDataSource_t *p_obj)
return p_obj->op.stat(p_obj->user_data);
}
/*
* Local variables:
* c-file-style: "gnu"

View file

@ -33,7 +33,7 @@
#include <cdio/types.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
{
@ -243,7 +243,8 @@ _cdio_list_node_data (CdioListNode_t *p_node)
/* eof */
/*
* Local variables:
* c-file-style: "gnu"

View file

@ -36,7 +36,7 @@
#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
Mode 2 sector. */

View file

@ -119,7 +119,7 @@ localtime_r(const time_t *timer, struct tm *result)
}
#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 */
enum iso_enum1_s iso_enums1;

View file

@ -46,7 +46,7 @@
* We account for these built-in calls doing nothing if the
* 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)
#elif defined(_MSC_VER)
#define PREFETCH64(m) do { _m_prefetch(m); _m_prefetch(m+32); } while(0)
@ -55,9 +55,11 @@
/* Read/write with endianness swap */
#if defined (_MSC_VER) && (_MSC_VER >= 1300)
#include <stdlib.h>
#if !defined(__clang__)
#pragma intrinsic(_byteswap_ushort)
#pragma intrinsic(_byteswap_ulong)
#pragma intrinsic(_byteswap_uint64)
#endif
#define bswap_uint64 _byteswap_uint64
#define bswap_uint32 _byteswap_ulong
#define bswap_uint16 _byteswap_ushort

View file

@ -2781,7 +2781,7 @@ static BOOL IsCurrentProcessElevated(void)
DWORD size;
HANDLE token = INVALID_HANDLE_VALUE;
TOKEN_ELEVATION te;
SID_IDENTIFIER_AUTHORITY auth = SECURITY_NT_AUTHORITY;
SID_IDENTIFIER_AUTHORITY auth = { SECURITY_NT_AUTHORITY };
PSID psid;
if (ReadRegistryKey32(REGKEY_HKLM, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\EnableLUA") == 1) {

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.10.947"
CAPTION "Rufus 2.10.948"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -320,8 +320,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,10,947,0
PRODUCTVERSION 2,10,947,0
FILEVERSION 2,10,948,0
PRODUCTVERSION 2,10,948,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -338,13 +338,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.10.947"
VALUE "FileVersion", "2.10.948"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.10.947"
VALUE "ProductVersion", "2.10.948"
END
END
BLOCK "VarFileInfo"

View file

@ -527,7 +527,7 @@ enum WIMMessage {
WIM_MSG_WARNING, // Sent when a warning message is available.
WIM_MSG_CHK_PROCESS,
WIM_MSG_SUCCESS = 0x00000000,
WIM_MSG_ABORT_IMAGE = 0xFFFFFFFF
WIM_MSG_ABORT_IMAGE = -1
};
#define INVALID_CALLBACK_VALUE 0xFFFFFFFF