[misc] prefer strtol/strtoull over atol/atoll

* This means we don't need to worry about conversion issues regarding signedess. In addition,
  the behavior will no longer be undefined if for some reason the conversion cannot happen.
* Closes #2104.
This commit is contained in:
Rose 2022-12-05 16:57:41 +00:00 committed by Pete Batard
parent 2bc1428975
commit fab095c043
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
3 changed files with 8 additions and 8 deletions

View File

@ -428,7 +428,7 @@ uint64_t DownloadToFileOrBuffer(const char* url, const char* file, BYTE** buffer
uprintf("Unable to retrieve file length: %s", WinInetErrorString());
goto out;
}
total_size = (uint64_t)atoll(strsize);
total_size = strtoull(strsize, NULL, 10);
if (hProgressDialog != NULL) {
char msg[128];
uprintf("File length: %s", SizeToHumanReadable(total_size, FALSE, FALSE));

View File

@ -2479,7 +2479,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break;
}
GetWindowTextA(GetDlgItem(hDlg, IDC_PERSISTENCE_SIZE), tmp, sizeof(tmp));
lPos = atol(tmp);
lPos = strtol(tmp, NULL, 10);
persistence_unit_selection = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS));
persistence_size = lPos * MB;
for (i = 0; i < persistence_unit_selection; i++)
@ -2521,7 +2521,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if (ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS)) == persistence_unit_selection)
break;
GetWindowTextA(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp, sizeof(tmp));
persistence_size = atol(tmp) * MB;
persistence_size = strtol(tmp, NULL, 10) * MB;
for (i = 0; i < persistence_unit_selection; i++)
persistence_size *= 1024;
persistence_unit_selection = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_PERSISTENCE_UNITS));

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.22.1951"
CAPTION "Rufus 3.22.1952"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -396,8 +396,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,22,1951,0
PRODUCTVERSION 3,22,1951,0
FILEVERSION 3,22,1952,0
PRODUCTVERSION 3,22,1952,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -415,13 +415,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.22.1951"
VALUE "FileVersion", "3.22.1952"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.22.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.22.1951"
VALUE "ProductVersion", "3.22.1952"
END
END
BLOCK "VarFileInfo"