Get rid of MSVC's __int64

Use either int64_t, uint64_t or long long and unsigned long long, defined as per C++11 standard
This commit is contained in:
void_17
2026-03-02 15:53:32 +07:00
parent d6ec138710
commit d63f79325f
308 changed files with 5371 additions and 5379 deletions

View File

@@ -610,7 +610,7 @@ struct interprocess_section_basic_information
{
void * base_address;
unsigned long section_attributes;
__int64 section_size;
int64_t section_size;
};
struct interprocess_filetime
@@ -778,9 +778,9 @@ union system_timeofday_information
{
struct data_t
{
__int64 liKeBootTime;
__int64 liKeSystemTime;
__int64 liExpTimeZoneBias;
int64_t liKeBootTime;
int64_t liKeSystemTime;
int64_t liExpTimeZoneBias;
unsigned long uCurrentTimeZoneId;
unsigned long dwReserved;
} data;
@@ -877,7 +877,7 @@ extern "C" __declspec(dllimport) int __stdcall FlushViewOfFile (void *, std::siz
extern "C" __declspec(dllimport) int __stdcall VirtualUnlock (void *, std::size_t);
extern "C" __declspec(dllimport) int __stdcall VirtualProtect (void *, std::size_t, unsigned long, unsigned long *);
extern "C" __declspec(dllimport) int __stdcall FlushFileBuffers (void *);
extern "C" __declspec(dllimport) int __stdcall GetFileSizeEx (void *, __int64 *size);
extern "C" __declspec(dllimport) int __stdcall GetFileSizeEx (void *, int64_t *size);
extern "C" __declspec(dllimport) unsigned long __stdcall FormatMessageA
(unsigned long dwFlags, const void *lpSource, unsigned long dwMessageId,
unsigned long dwLanguageId, char *lpBuffer, unsigned long nSize,
@@ -888,9 +888,9 @@ extern "C" __declspec(dllimport) int __stdcall CreateDirectoryA(const char *, in
extern "C" __declspec(dllimport) int __stdcall RemoveDirectoryA(const char *lpPathName);
extern "C" __declspec(dllimport) int __stdcall GetTempPathA(unsigned long length, char *buffer);
extern "C" __declspec(dllimport) int __stdcall CreateDirectory(const char *, interprocess_security_attributes*);
extern "C" __declspec(dllimport) int __stdcall SetFileValidData(void *, __int64 size);
extern "C" __declspec(dllimport) int __stdcall SetFileValidData(void *, int64_t size);
extern "C" __declspec(dllimport) int __stdcall SetEndOfFile(void *);
extern "C" __declspec(dllimport) int __stdcall SetFilePointerEx(void *, __int64 distance, __int64 *new_file_pointer, unsigned long move_method);
extern "C" __declspec(dllimport) int __stdcall SetFilePointerEx(void *, int64_t distance, int64_t *new_file_pointer, unsigned long move_method);
extern "C" __declspec(dllimport) int __stdcall LockFile (void *hnd, unsigned long offset_low, unsigned long offset_high, unsigned long size_low, unsigned long size_high);
extern "C" __declspec(dllimport) int __stdcall UnlockFile(void *hnd, unsigned long offset_low, unsigned long offset_high, unsigned long size_low, unsigned long size_high);
extern "C" __declspec(dllimport) int __stdcall LockFileEx(void *hnd, unsigned long flags, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped* overlapped);
@@ -908,7 +908,7 @@ extern "C" __declspec(dllimport) unsigned long __stdcall GetMappedFileNameW(void
extern "C" __declspec(dllimport) long __stdcall RegOpenKeyExA(void *, const char *, unsigned long, unsigned long, void **);
extern "C" __declspec(dllimport) long __stdcall RegQueryValueExA(void *, const char *, unsigned long*, unsigned long*, unsigned char *, unsigned long*);
extern "C" __declspec(dllimport) long __stdcall RegCloseKey(void *);
extern "C" __declspec(dllimport) int __stdcall QueryPerformanceCounter(__int64 *lpPerformanceCount);
extern "C" __declspec(dllimport) int __stdcall QueryPerformanceCounter(int64_t *lpPerformanceCount);
//COM API
extern "C" __declspec(dllimport) long __stdcall CoInitializeEx(void *pvReserved, unsigned long dwCoInit);
@@ -1091,7 +1091,7 @@ class interprocess_all_access_security
{ return &sa; }
};
inline void * create_file_mapping (void * handle, unsigned long access, unsigned __int64 file_offset, const char * name, interprocess_security_attributes *psec)
inline void * create_file_mapping (void * handle, unsigned long access, uint64_t file_offset, const char * name, interprocess_security_attributes *psec)
{
const unsigned long high_size(file_offset >> 32), low_size((boost::uint32_t)file_offset);
return CreateFileMappingA (handle, psec, access, high_size, low_size, name);
@@ -1100,9 +1100,9 @@ inline void * create_file_mapping (void * handle, unsigned long access, unsigned
inline void * open_file_mapping (unsigned long access, const char *name)
{ return OpenFileMappingA (access, 0, name); }
inline void *map_view_of_file_ex(void *handle, unsigned long file_access, unsigned __int64 offset, std::size_t numbytes, void *base_addr)
inline void *map_view_of_file_ex(void *handle, unsigned long file_access, uint64_t offset, std::size_t numbytes, void *base_addr)
{
const unsigned long offset_low = (unsigned long)(offset & ((unsigned __int64)0xFFFFFFFF));
const unsigned long offset_low = (unsigned long)(offset & ((uint64_t)0xFFFFFFFF));
const unsigned long offset_high = offset >> 32;
return MapViewOfFileEx(handle, file_access, offset_high, offset_low, numbytes, base_addr);
}
@@ -1146,7 +1146,7 @@ inline bool virtual_protect(void *base_addr, std::size_t numbytes, unsigned long
inline bool flush_file_buffers(void *handle)
{ return 0 != FlushFileBuffers(handle); }
inline bool get_file_size(void *handle, __int64 &size)
inline bool get_file_size(void *handle, int64_t &size)
{ return 0 != GetFileSizeEx(handle, &size); }
inline bool create_directory(const char *name)
@@ -1164,7 +1164,7 @@ inline unsigned long get_temp_path(unsigned long length, char *buffer)
inline int set_end_of_file(void *handle)
{ return 0 != SetEndOfFile(handle); }
inline bool set_file_pointer_ex(void *handle, __int64 distance, __int64 *new_file_pointer, unsigned long move_method)
inline bool set_file_pointer_ex(void *handle, int64_t distance, int64_t *new_file_pointer, unsigned long move_method)
{ return 0 != SetFilePointerEx(handle, distance, new_file_pointer, move_method); }
inline bool lock_file_ex(void *hnd, unsigned long flags, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped *overlapped)
@@ -1225,7 +1225,7 @@ inline long reg_query_value_ex(void *hKey, const char *lpValueName, unsigned lon
inline long reg_close_key(void *hKey)
{ return RegCloseKey(hKey); }
inline bool query_performance_counter(__int64 *lpPerformanceCount)
inline bool query_performance_counter(int64_t *lpPerformanceCount)
{
return 0 != QueryPerformanceCounter(lpPerformanceCount);
}
@@ -1812,7 +1812,7 @@ inline bool is_directory(const char *path)
(attrib & file_attribute_directory));
}
inline bool get_file_mapping_size(void *file_mapping_hnd, __int64 &size)
inline bool get_file_mapping_size(void *file_mapping_hnd, int64_t &size)
{
NtQuerySection_t pNtQuerySection =
(NtQuerySection_t)dll_func::get(dll_func::NtQuerySection);

View File

@@ -138,7 +138,7 @@ class windows_named_condition_any
class named_cond_callbacks : public windows_named_sync_interface
{
typedef __int64 sem_count_t;
typedef int64_t sem_count_t;
mutable sem_count_t sem_counts [2];
public:

View File

@@ -66,7 +66,7 @@ class windows_named_semaphore
class named_sem_callbacks : public windows_named_sync_interface
{
public:
typedef __int64 sem_count_t;
typedef int64_t sem_count_t;
named_sem_callbacks(winapi_semaphore_wrapper &sem_wrapper, sem_count_t sem_cnt)
: m_sem_wrapper(sem_wrapper), m_sem_count(sem_cnt)
{}

View File

@@ -122,12 +122,12 @@ inline void windows_named_sync::open_or_create
if(m_file_hnd != winapi::invalid_handle_value){
//Now lock the file
const std::size_t buflen = sync_interface.get_data_size();
typedef __int64 unique_id_type;
typedef int64_t unique_id_type;
const std::size_t sizeof_file_info = sizeof(unique_id_type) + buflen;
winapi::interprocess_overlapped overlapped;
if(winapi::lock_file_ex
(m_file_hnd, winapi::lockfile_exclusive_lock, 0, sizeof_file_info, 0, &overlapped)){
__int64 filesize = 0;
int64_t filesize = 0;
//Obtain the unique id to open the native semaphore.
//If file size was created
if(winapi::get_file_size(m_file_hnd, filesize)){

View File

@@ -62,7 +62,7 @@ inline bool bytes_to_str(const void *mem, const std::size_t mem_length, char *ou
class sync_id
{
public:
typedef __int64 internal_type;
typedef int64_t internal_type;
sync_id(const void *map_addr)
: map_addr_(map_addr)
{ winapi::query_performance_counter(&rand_); }