mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[msvc] fix MSVC 64 bit conversion warnings
* use size_t in file.c * remove obsolete Hungarian notation
This commit is contained in:
parent
af3607715a
commit
08d68301cd
3 changed files with 38 additions and 38 deletions
56
file.c
56
file.c
|
@ -27,7 +27,7 @@ int write_sectors(HANDLE hDrive, size_t SectorSize,
|
|||
const void *pBuf, size_t BufSize)
|
||||
{
|
||||
LARGE_INTEGER ptr;
|
||||
DWORD dwSize;
|
||||
DWORD Size;
|
||||
|
||||
if(SectorSize * nSectors > BufSize)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ int write_sectors(HANDLE hDrive, size_t SectorSize,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if((!WriteFile(hDrive, pBuf, (DWORD)BufSize, &dwSize, NULL)) || (dwSize != BufSize))
|
||||
if((!WriteFile(hDrive, pBuf, (DWORD)BufSize, &Size, NULL)) || (Size != BufSize))
|
||||
{
|
||||
uprintf("write_sectors: Write error - %s\n", WindowsErrorString());
|
||||
return 0;
|
||||
|
@ -56,7 +56,7 @@ int read_sectors(HANDLE hDrive, size_t SectorSize,
|
|||
void *pBuf, size_t BufSize)
|
||||
{
|
||||
LARGE_INTEGER ptr;
|
||||
DWORD dwSize;
|
||||
DWORD Size;
|
||||
|
||||
if(SectorSize * nSectors > BufSize)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ int read_sectors(HANDLE hDrive, size_t SectorSize,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if((!ReadFile(hDrive, pBuf, (DWORD)BufSize, &dwSize, NULL)) || (dwSize != BufSize))
|
||||
if((!ReadFile(hDrive, pBuf, (DWORD)BufSize, &Size, NULL)) || (Size != BufSize))
|
||||
{
|
||||
uprintf("read_sectors: Read error - %s\n", WindowsErrorString());
|
||||
return 0;
|
||||
|
@ -81,62 +81,62 @@ int read_sectors(HANDLE hDrive, size_t SectorSize,
|
|||
}
|
||||
|
||||
/* Use a bastardized fp that contains a Windows handle and the sector size */
|
||||
int contains_data(FILE *fp, unsigned long ulPosition,
|
||||
const void *pData, unsigned int uiLen)
|
||||
int contains_data(FILE *fp, size_t Position,
|
||||
const void *pData, size_t Len)
|
||||
{
|
||||
unsigned char aucBuf[MAX_DATA_LEN];
|
||||
HANDLE hDrive = (HANDLE)fp->_ptr;
|
||||
unsigned long ulSectorSize = (unsigned long)fp->_bufsiz;
|
||||
unsigned long ulStartSector, ulEndSector, ulNumSectors;
|
||||
size_t SectorSize = (size_t)fp->_bufsiz;
|
||||
size_t StartSector, EndSector, NumSectors;
|
||||
|
||||
ulStartSector = ulPosition/ulSectorSize;
|
||||
ulEndSector = (ulPosition+uiLen+ulSectorSize-1)/ulSectorSize;
|
||||
ulNumSectors = ulEndSector - ulStartSector;
|
||||
StartSector = Position/SectorSize;
|
||||
EndSector = (Position+Len+SectorSize-1)/SectorSize;
|
||||
NumSectors = EndSector - StartSector;
|
||||
|
||||
if((ulNumSectors*ulSectorSize) > MAX_DATA_LEN)
|
||||
if((NumSectors*SectorSize) > MAX_DATA_LEN)
|
||||
{
|
||||
uprintf("Please increase MAX_DATA_LEN in file.h\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!read_sectors(hDrive, ulSectorSize, ulStartSector,
|
||||
ulNumSectors, aucBuf, sizeof(aucBuf)))
|
||||
if(!read_sectors(hDrive, SectorSize, StartSector,
|
||||
NumSectors, aucBuf, sizeof(aucBuf)))
|
||||
return 0;
|
||||
|
||||
if(memcmp(pData, &aucBuf[ulPosition - ulStartSector*ulSectorSize], uiLen))
|
||||
if(memcmp(pData, &aucBuf[Position - StartSector*SectorSize], Len))
|
||||
return 0;
|
||||
return 1;
|
||||
} /* contains_data */
|
||||
|
||||
/* May read/write the same sector many times, but compatible with existing ms-sys */
|
||||
int write_data(FILE *fp, unsigned long ulPosition,
|
||||
const void *pData, unsigned int uiLen)
|
||||
int write_data(FILE *fp, size_t Position,
|
||||
const void *pData, size_t Len)
|
||||
{
|
||||
unsigned char aucBuf[MAX_DATA_LEN];
|
||||
HANDLE hDrive = (HANDLE)fp->_ptr;
|
||||
unsigned long ulSectorSize = (unsigned long)fp->_bufsiz;
|
||||
unsigned long ulStartSector, ulEndSector, ulNumSectors;
|
||||
size_t SectorSize = (size_t)fp->_bufsiz;
|
||||
size_t StartSector, EndSector, NumSectors;
|
||||
|
||||
ulStartSector = ulPosition/ulSectorSize;
|
||||
ulEndSector = (ulPosition+uiLen+ulSectorSize-1)/ulSectorSize;
|
||||
ulNumSectors = ulEndSector - ulStartSector;
|
||||
StartSector = Position/SectorSize;
|
||||
EndSector = (Position+Len+SectorSize-1)/SectorSize;
|
||||
NumSectors = EndSector - StartSector;
|
||||
|
||||
if((ulNumSectors*ulSectorSize) > MAX_DATA_LEN)
|
||||
if((NumSectors*SectorSize) > MAX_DATA_LEN)
|
||||
{
|
||||
uprintf("Please increase MAX_DATA_LEN in file.h\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Data to write may not be aligned on a sector boundary => read into a sector buffer first */
|
||||
if(!read_sectors(hDrive, ulSectorSize, ulStartSector,
|
||||
ulNumSectors, aucBuf, sizeof(aucBuf)))
|
||||
if(!read_sectors(hDrive, SectorSize, StartSector,
|
||||
NumSectors, aucBuf, sizeof(aucBuf)))
|
||||
return 0;
|
||||
|
||||
if(!memcpy(&aucBuf[ulPosition - ulStartSector*ulSectorSize], pData, uiLen))
|
||||
if(!memcpy(&aucBuf[Position - StartSector*SectorSize], pData, Len))
|
||||
return 0;
|
||||
|
||||
if(!write_sectors(hDrive, ulSectorSize, ulStartSector,
|
||||
ulNumSectors, aucBuf, sizeof(aucBuf)))
|
||||
if(!write_sectors(hDrive, SectorSize, StartSector,
|
||||
NumSectors, aucBuf, sizeof(aucBuf)))
|
||||
return 0;
|
||||
return 1;
|
||||
} /* write_data */
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
/* Checks if a file contains a data pattern of length uiLen at position
|
||||
ulPositoin. The file pointer will change when calling this function! */
|
||||
int contains_data(FILE *fp, unsigned long ulPosition,
|
||||
const void *pData, unsigned int uiLen);
|
||||
int contains_data(FILE *fp, size_t ulPosition,
|
||||
const void *pData, size_t uiLen);
|
||||
|
||||
/* Writes a data pattern of length uiLen at position ulPositoin.
|
||||
The file pointer will change when calling this function! */
|
||||
int write_data(FILE *fp, unsigned long ulPosition,
|
||||
const void *pData, unsigned int uiLen);
|
||||
int write_data(FILE *fp, size_t ulPosition,
|
||||
const void *pData, size_t uiLen);
|
||||
|
||||
/* Checks if a file contains a data pattern of length uiLen at position
|
||||
ulPositoin. The file pointer will change when calling this function! */
|
||||
|
|
12
rufus.rc
12
rufus.rc
|
@ -63,7 +63,7 @@ BEGIN
|
|||
DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP
|
||||
CONTROL "<a href=""https://github.com/pbatard/rufus/wiki/Rufus"">https://github.com/pbatard/rufus</a>",IDC_ABOUT_RUFUS_URL,
|
||||
"SysLink",WS_TABSTOP,46,47,114,9
|
||||
LTEXT "Version 1.0.0 (Build 55)",IDC_STATIC,46,19,78,8
|
||||
LTEXT "Version 1.0.0 (Build 56)",IDC_STATIC,46,19,78,8
|
||||
PUSHBUTTON "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP
|
||||
EDITTEXT IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL
|
||||
LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8
|
||||
|
@ -162,8 +162,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,55
|
||||
PRODUCTVERSION 1,0,0,55
|
||||
FILEVERSION 1,0,0,56
|
||||
PRODUCTVERSION 1,0,0,56
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -180,13 +180,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "akeo.ie"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "1.0.0.55"
|
||||
VALUE "FileVersion", "1.0.0.56"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "1.0.0.55"
|
||||
VALUE "ProductVersion", "1.0.0.56"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -212,7 +212,7 @@ IDI_ICON ICON "rufus.ico"
|
|||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_VERSION "Rufus v1.0.0.55"
|
||||
IDS_VERSION "Rufus v1.0.0.56"
|
||||
END
|
||||
|
||||
#endif // English resources
|
||||
|
|
Loading…
Reference in a new issue