From a804f28c49a0ebe094c7c34fbe7fc36c5797415d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Mar 2013 22:15:02 +0100 Subject: [PATCH] - Fixing Linux index compile errors modified: storage/connect/xindex.cpp --- storage/connect/xindex.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index 9b26fb203ad..78c8e6115ef 100644 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -2389,7 +2389,6 @@ void *XFILE::FileView(PGLOBAL g, char *fn, int loff, int hoff, int size) /***********************************************************************/ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) { - DWORD drc, rc; IOFF noff[MAX_INDX]; if (Hfile != INVALID_HANDLE_VALUE) { @@ -2403,8 +2402,8 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) #if defined(WIN32) LONG high = 0; - DWORD access, share, creation; - + DWORD rc, drc, access, share, creation; + /*********************************************************************/ /* Create the file object according to access mode */ /*********************************************************************/ @@ -2534,7 +2533,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) /*******************************************************************/ /* Position the cursor at end of file so ftell returns file size. */ /*******************************************************************/ - if (!(Offset.Val = (longlong)lseek64(Hfile, 0LL, SEEK_END))) { + if (!(NewOff.Val = (longlong)lseek64(Hfile, 0LL, SEEK_END))) { sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Seek"); return true; } // endif @@ -2543,8 +2542,7 @@ bool XHUGE::Open(PGLOBAL g, char *filename, int id, MODE mode) if (id >= 0) { // New not sep index file. Write the header. memset(noff, 0, sizeof(noff)); - Write(g, noff, sizeof(IOFF), MAX_INDX, rc); - Offset.Val = (longlong)(sizeof(IOFF) * MAX_INDX); + NewOff.Low = write(Hfile, &noff, sizeof(noff)); } // endif id } else if (mode == MODE_READ && id >= 0) { @@ -2733,21 +2731,22 @@ void XHUGE::Close(char *fn, int id) CloseFileHandle(Hfile); Hfile = CreateFile(fn, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (Hfile != INVALID_HANDLE_VALUE) if (SetFilePointer(Hfile, id * sizeof(IOFF), NULL, FILE_BEGIN) != INVALID_SET_FILE_POINTER) { DWORD nbw; - WriteFile(Hfile, &NewOff, sizeof(longlong), &nbw, NULL); -// WriteFile(Hfile, &Newhigh, sizeof(int), &nbw, NULL); + WriteFile(Hfile, &NewOff, sizeof(IOFF), &nbw, NULL); } // endif SetFilePointer } // endif id #else // !WIN32 if (id >= 0 && fn) { - fnctl(Hfile, F_SETFD, O_WRONLY); + fcntl(Hfile, F_SETFD, O_WRONLY); + if (lseek(Hfile, id * sizeof(IOFF), SEEK_SET)) - write(Hfile, &noff[id], sizeof(IOFF)); + write(Hfile, &NewOff, sizeof(IOFF)); } // endif id #endif // !WIN32