Fix jimsh0.c so that it compiles using MSVC: "cl jimsh0.c"

FossilOrigin-Name: f531825d4e16502ac8fa496fba51ea735232e2988aa9ddd0f232825f6ec2a9a2
This commit is contained in:
drh 2024-10-24 12:18:53 +00:00
parent 2ba8b9566f
commit 936fa83402
3 changed files with 42 additions and 14 deletions

View File

@ -109,11 +109,7 @@ char *dlerror(void);
#define strtoull _strtoui64
#include <io.h>
struct timeval {
long tv_sec;
long tv_usec;
};
#include <winsock.h>
int gettimeofday(struct timeval *tv, void *unused);
@ -1243,7 +1239,7 @@ int Jim_OpenForRead(const char *filename);
#endif
#endif
#ifndef O_TEXT
#if !defined(O_TEXT) && !defined(_WIN32)
#define O_TEXT 0
#endif
@ -6721,9 +6717,11 @@ int Jim_arrayInit(Jim_Interp *interp)
}
#include <sys/types.h>
#ifndef _WIN32
#include <sys/time.h>
#include <sys/wait.h>
#include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
@ -23568,6 +23566,36 @@ void Jim_SetResultErrno(Jim_Interp *interp, const char *msg)
Jim_SetResultFormatted(interp, "%s: %s", msg, strerror(Jim_Errno()));
}
#if defined(_WIN32)
#include <windows.h>
int Jim_Errno(void){ return 0; }
int Jim_MakeTempFile(Jim_Interp *interp, const char *filename_template, int unlink_file)
{
char name[MAX_PATH];
HANDLE handle;
if (!GetTempPath(MAX_PATH, name) || !GetTempFileName(name, filename_template ? filename_template : "JIM", 0, name)) {
return -1;
}
handle = CreateFile(name, GENERIC_READ | GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY | (unlink_file ? FILE_FLAG_DELETE_ON_CLOSE : 0),
NULL);
if (handle == INVALID_HANDLE_VALUE) {
goto error;
}
Jim_SetResultString(interp, name, -1);
return _open_osfhandle((intptr_t)handle, _O_RDWR | _O_TEXT);
error:
Jim_SetResultErrno(interp, name);
DeleteFile(name);
return -1;
}
#endif
#if defined(__MINGW32__)
#include <sys/stat.h>

View File

@ -1,5 +1,5 @@
C Fix\sthe\ssqlite3(.EXE)\sbuild\sto\shonor\s--disable-amalgamation.
D 2024-10-24T12:03:02.198
C Fix\sjimsh0.c\sso\sthat\sit\scompiles\susing\sMSVC:\s\s"cl\sjimsh0.c"
D 2024-10-24T12:18:53.353
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -48,7 +48,7 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d
F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bde14
F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82
F autosetup/hwaci-common.tcl 3513a7dbe685d4776e70d23fa41d6695098627ca063245cac163f8ed3dc696f9
F autosetup/jimsh0.c 838968b1159a6061452d751a48df3646830b04b118e35790da97e998208bc5ae
F autosetup/jimsh0.c 0b29699d873c54127873b0906be501f63dacdd1abc76a209d59a6c7e30c579a0
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb
F autosetup/tmake.auto eaebc74ad538dfdd3c817c27eefc31930c20510c4f3a3704071f6cb0629ed71f
@ -2236,8 +2236,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P d0554ac46866b5ad467b88de6fae06695fd81e7fdf38157702a395f7282cbe9d
R 2faf1c48d071a03a05d748b2f0e797c7
U stephan
Z 0a7ea5c985771468eac3705a684f68b7
P bd66222721ad06e99c1b66a3a0fbde06532507aa067165f47fa5d6c41ba630e6
R ee8b54ba756da77e4f583a1e09246d8d
U drh
Z 9fb2435d714bbd037899e6ca13239e09
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
bd66222721ad06e99c1b66a3a0fbde06532507aa067165f47fa5d6c41ba630e6
f531825d4e16502ac8fa496fba51ea735232e2988aa9ddd0f232825f6ec2a9a2