Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assign.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ SEXP assign(SEXP dt, SEXP rows, SEXP cols, SEXP newcolnames, SEXP values)
// strong error message for now.
else if (TRUELENGTH(names) != oldtncol)
// Use (long long) to cast R_xlen_t to a fixed type to robustly avoid -Wformat compiler warnings, see #5768, PRId64 didnt work
error(_("Internal error: selfrefnames is ok but tl names [%ld] != tl [%d]"), TRUELENGTH(names), oldtncol); // # nocov
error(_("Internal error: selfrefnames is ok but tl names [%lld] != tl [%d]"), (long long)TRUELENGTH(names), oldtncol); // # nocov
SETLENGTH(dt, oldncol+LENGTH(newcolnames));
SETLENGTH(names, oldncol+LENGTH(newcolnames));
for (int i=0; i<LENGTH(newcolnames); ++i)
Expand Down
7 changes: 4 additions & 3 deletions src/fread.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ bool freadCleanup(void)
// may call freadCleanup(), thus resulting in an infinite loop.
#ifdef WIN32
if (!UnmapViewOfFile(mmp))
DTPRINT(_("System error %d unmapping view of file\n"), GetLastError()); // # nocov
// GetLastError is a 'DWORD', not 'int', hence '%lu'
DTPRINT(_("System error %lu unmapping view of file\n"), GetLastError()); // # nocov
#else
if (munmap(mmp, fileSize))
DTPRINT(_("System errno %d unmapping file: %s\n"), errno, strerror(errno)); // # nocov
Expand Down Expand Up @@ -1397,14 +1398,14 @@ int freadMain(freadMainArgs _args) {
attempts++;
// Looped retry to avoid ephemeral locks by system utilities as recommended here : http://support.microsoft.com/kb/316609
}
if (hFile==INVALID_HANDLE_VALUE) STOP(_("Unable to open file after %d attempts (error %d): %s"), attempts, GetLastError(), fnam);
if (hFile==INVALID_HANDLE_VALUE) STOP(_("Unable to open file after %d attempts (error %lu): %s"), attempts, GetLastError(), fnam);
LARGE_INTEGER liFileSize;
if (GetFileSizeEx(hFile,&liFileSize)==0) { CloseHandle(hFile); STOP(_("GetFileSizeEx failed (returned 0) on file: %s"), fnam); }
fileSize = (size_t)liFileSize.QuadPart;
if (fileSize<=0) { CloseHandle(hFile); STOP(_("File is empty: %s"), fnam); }
if (verbose) DTPRINT(_(" File opened, size = %s.\n"), filesize_to_str(fileSize));
HANDLE hMap=CreateFileMapping(hFile, NULL, PAGE_WRITECOPY, 0, 0, NULL);
if (hMap==NULL) { CloseHandle(hFile); STOP(_("This is Windows, CreateFileMapping returned error %d for file %s"), GetLastError(), fnam); }
if (hMap==NULL) { CloseHandle(hFile); STOP(_("This is Windows, CreateFileMapping returned error %lu for file %s"), GetLastError(), fnam); }
mmp = MapViewOfFile(hMap,FILE_MAP_COPY,0,0,fileSize); // fileSize must be <= hilo passed to CreateFileMapping above.
CloseHandle(hMap); // we don't need to keep the file open; the MapView keeps an internal reference;
CloseHandle(hFile); // see https://msdn.microsoft.com/en-us/library/windows/desktop/aa366537(v=vs.85).aspx
Expand Down