mirror of
https://github.com/Dushistov/sdcv.git
synced 2025-12-15 17:31:56 +00:00
clang-format for mapfile
This commit is contained in:
committed by
Evgeniy Dushistov
parent
6ab8b51e6c
commit
823ec3d840
@@ -15,7 +15,7 @@ BreakBeforeBinaryOperators: true
|
|||||||
BreakBeforeTernaryOperators: true
|
BreakBeforeTernaryOperators: true
|
||||||
BreakConstructorInitializersBeforeComma: true
|
BreakConstructorInitializersBeforeComma: true
|
||||||
BinPackParameters: true
|
BinPackParameters: true
|
||||||
ColumnLimit: 0
|
ColumnLimit: 120
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
DerivePointerAlignment: false
|
DerivePointerAlignment: false
|
||||||
ExperimentalAutoDetectBinPacking: false
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
|||||||
@@ -40,20 +40,18 @@ inline bool MapFile::open(const char *file_name, unsigned long file_size)
|
|||||||
size = file_size;
|
size = file_size;
|
||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
if ((mmap_fd = ::open(file_name, O_RDONLY)) < 0) {
|
if ((mmap_fd = ::open(file_name, O_RDONLY)) < 0) {
|
||||||
//g_print("Open file %s failed!\n",fullfilename);
|
// g_print("Open file %s failed!\n",fullfilename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
data = (gchar *)mmap(nullptr, file_size, PROT_READ, MAP_SHARED, mmap_fd, 0);
|
data = (gchar *)mmap(nullptr, file_size, PROT_READ, MAP_SHARED, mmap_fd, 0);
|
||||||
if ((void *)data == (void *)(-1)) {
|
if ((void *)data == (void *)(-1)) {
|
||||||
//g_print("mmap file %s failed!\n",idxfilename);
|
// g_print("mmap file %s failed!\n",idxfilename);
|
||||||
data = nullptr;
|
data = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
hFile = CreateFile(file_name, GENERIC_READ, 0, nullptr, OPEN_ALWAYS,
|
hFile = CreateFile(file_name, GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
|
||||||
FILE_ATTRIBUTE_NORMAL, 0);
|
hFileMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0, file_size, nullptr);
|
||||||
hFileMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0,
|
|
||||||
file_size, nullptr);
|
|
||||||
data = (gchar *)MapViewOfFile(hFileMap, FILE_MAP_READ, 0, 0, file_size);
|
data = (gchar *)MapViewOfFile(hFileMap, FILE_MAP_READ, 0, 0, file_size);
|
||||||
#else
|
#else
|
||||||
gsize read_len;
|
gsize read_len;
|
||||||
|
|||||||
Reference in New Issue
Block a user