Skip to content

Commit

Permalink
Patch by Jürgen Fischer: don-t-use-file-locking-on-windows and add CM…
Browse files Browse the repository at this point in the history
…ake build
  • Loading branch information
ninsbl committed Sep 6, 2014
1 parent b201195 commit b10e932
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PROJECT(openfyba)

ADD_SUBDIRECTORY(src/GM)
ADD_SUBDIRECTORY(src/UT)
ADD_SUBDIRECTORY(src/FYBA)
ADD_SUBDIRECTORY(doc)
2 changes: 2 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# docdir = $(datadir)/doc/@PACKAGE@
# doc_DATA = en_EN/translators_needed no_NB/fyba.html no_NB/fyba1.html no_NB/fyba2.html
30 changes: 30 additions & 0 deletions src/FYBA/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
INCLUDE_DIRECTORIES(../GM ../UT)

IF(UNIX)
ADD_DEFINITIONS(-pedantic -Wno-long-long -Wall -O2 -D_FILE_OFFSET_BITS=64 -DUNIX -DLINUX -fPIC -Wno-write-strings)
ENDIF(UNIX)

ADD_LIBRARY(fyba STATIC
Fyba_Callback.cpp
FYBA_DLL.cpp
FYHO.cpp
FYLD.cpp
FYLH.cpp
fyln.cpp
FYLP.cpp
FYLS.cpp
FYLX.cpp
stdafx.cpp
FYBA.cpp
Fyba_melding.cpp
FYLB.cpp
FYLE.cpp
FYLI.cpp
FYLO.cpp
FYLR.cpp
FYLU.cpp
FYTA.cpp
)

INSTALL(FILES fyba.h DESTINATION include/fyba)
INSTALL(TARGETS fyba ARCHIVE DESTINATION lib)
1 change: 1 addition & 0 deletions src/FYBA/FYBA_DLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "stdafx.h"
#include "fyba.h"
#include <Windows.h>

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
Expand Down
2 changes: 1 addition & 1 deletion src/FYBA/Fyba_Callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "stdafx.h"

#include <fyba.h>
#include "fyba.h"

#ifdef WIN32
# include <windows.h>
Expand Down
2 changes: 1 addition & 1 deletion src/FYBA/Fyba_melding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <windows.h>
#endif

#include <fyba.h>
#include "fyba.h"

//static short sProsent;

Expand Down
8 changes: 8 additions & 0 deletions src/GM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
IF(UNIX)
ADD_DEFINITIONS(-pedantic -Wno-long-long -Wall -O2 -D_FILE_OFFSET_BITS=64 -DUNIX -DLINUX -fPIC -Wno-write-strings)
ENDIF(UNIX)

ADD_LIBRARY(gm STATIC GM.cpp stdafx.cpp)

INSTALL(FILES fygm.h DESTINATION include/fyba)
INSTALL(TARGETS gm ARCHIVE DESTINATION lib)
29 changes: 29 additions & 0 deletions src/UT/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
IF(UNIX)
ADD_DEFINITIONS(-pedantic -Wno-long-long -Wall -O2 -D_FILE_OFFSET_BITS=64 -DUNIX -DLINUX -fPIC -Wno-write-strings)
ENDIF(UNIX)

ADD_LIBRARY(ut STATIC
ANFORSEL.cpp
DELDIR.cpp
FILNACMP.cpp
INQTID.cpp
UT1.cpp
UT4.cpp
CopyFile.cpp
DELFILE.cpp
MAKEPATH.cpp
stdafx.cpp
UT2.cpp
CREDIR.cpp
DISKINFO.cpp
INQSIZE.cpp
SETSIZE.cpp
StrtPros.cpp
UT3.cpp
stdafx.h
FULLPATH.cpp
SPLITPTH.cpp
)

INSTALL(FILES fyut.h DESTINATION include/fyba)
INSTALL(TARGETS ut ARCHIVE DESTINATION lib)
23 changes: 12 additions & 11 deletions src/UT/UT1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CD Eier.......: STATENS KARTVERK / FYSAK-prosjektet
CD
CD #include...: fyut.h
CD ==================================================================
*/
*/

#include "stdafx.h"

Expand All @@ -45,7 +45,7 @@ CD ==================================================================

#ifdef LINUX /*This is just a quick fix. The two parameter versions of these are just not portable.*/
# define strcpy_s strcpy
# define strcat_s strcat
# define strcat_s strcat
#endif

#ifdef WIN32
Expand Down Expand Up @@ -368,16 +368,17 @@ _SH_DENYNO : Permits read and write access
_SH_SECURE : Sets secure mode (shared read, exclusive write access).
*/


// ----- Selve filåpningen
if (mode[0] != '\0') {
#ifdef UNIX
fp = fopen(path,mode);
#else
fp = fopen(path,mode);
#if 0
// TODO: File locking on windows
// FIXME: LI_OpenIdxFil always opens in UT_UPDATE mode
if (mode[0] == 'w' || mode[2] == '+')
{
fp = _fsopen(path,mode,_SH_DENYWR); // Sperrer mot at andre åpner filen for skriving, godtar lesing
}
}
else
{
fp = _fsopen(path,mode,_SH_DENYNO);
Expand Down Expand Up @@ -415,14 +416,14 @@ _SH_SECURE : Sets secure mode (shared read, exclusive write access).
/* UT_FPRINTF(stderr,strerror(*ierr)); */
}

else
else
{
*ierr = UT_ERROR;
return (NULL);
}

if (*ierr != UT_OK) fp=NULL;

return fp;
}

Expand Down Expand Up @@ -553,7 +554,7 @@ SK_EntPnt_UT short UT_ReadLine(FILE *pfil,short llin, char *clin)
ierr = UT_ERROR;
}
break;

} else if (c == '\n') {
*cp = c;
cp++;
Expand Down Expand Up @@ -706,7 +707,7 @@ CD pfil FILE i Peker til filstruktur (def i stdio.h)
SK_EntPnt_UT short UT_Save (FILE *pfil)
{
if (fflush(pfil) == EOF) return (UT_ERROR);

return(UT_OK);
}

Expand Down

0 comments on commit b10e932

Please sign in to comment.