Commit ab973ec4 authored by Francis Dupont's avatar Francis Dupont
Browse files

misc x64 VS 2015 CTP fixes [#39308]

parent f1a261ba
4105. [port] Misc fixes for Microsoft Visual Studio
2015 CTP6 in 64 bit mode. [RT #39308]
4104. [bug] Address uninitialized elements. [RT #39252]
4103. [port] Misc fixes for Microsoft Visual Studio
......
......@@ -1875,7 +1875,7 @@ process_ecs(ns_client_t *client, isc_buffer_t *buf, size_t optlen) {
client->ecs_scope = 0;
client->attributes |= NS_CLIENTATTR_HAVEECS;
isc_buffer_forward(buf, optlen);
isc_buffer_forward(buf, (unsigned int)optlen);
return (ISC_R_SUCCESS);
}
......
......@@ -10122,11 +10122,11 @@ static isc_result_t
putmem(isc_buffer_t **b, const char *str, size_t len) {
isc_result_t result;
result = isc_buffer_reserve(b, len);
result = isc_buffer_reserve(b, (unsigned int)len);
if (result != ISC_R_SUCCESS)
return (ISC_R_NOSPACE);
isc_buffer_putmem(*b, (const unsigned char *)str, len);
isc_buffer_putmem(*b, (const unsigned char *)str, (unsigned int)len);
return (ISC_R_SUCCESS);
}
......
......@@ -50,7 +50,7 @@
static char *lockfile = NULL;
static char *pidfile = NULL;
static int devnullfd = -1;
static int singletonfd = -1;
static int lockfilefd = -1;
static BOOL Initialized = FALSE;
......@@ -212,9 +212,9 @@ cleanup_pidfile(void) {
static void
cleanup_lockfile(void) {
if (singletonfd != -1) {
close(singletonfd);
singletonfd = -1;
if (lockfilefd != -1) {
close(lockfilefd);
lockfilefd = -1;
}
if (lockfile != NULL) {
......@@ -307,7 +307,7 @@ ns_os_issingleton(const char *filename) {
char strbuf[ISC_STRERRORSIZE];
OVERLAPPED o;
if (singletonfd != -1)
if (lockfilefd != -1)
return (ISC_TRUE);
if (strcasecmp(filename, "none") == 0)
......@@ -324,16 +324,16 @@ ns_os_issingleton(const char *filename) {
* ns_os_openfile() uses safeopen() which removes any existing
* files. We can't use that here.
*/
singletonfd = open(filename, O_WRONLY | O_CREAT,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (singletonfd == -1) {
lockfilefd = open(filename, O_WRONLY | O_CREAT,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (lockfilefd == -1) {
cleanup_lockfile();
return (ISC_FALSE);
}
memset(&o, 0, sizeof(o));
/* Expect ERROR_LOCK_VIOLATION if already locked */
if (!LockFileEx((HANDLE) _get_osfhandle(singletonfd),
if (!LockFileEx((HANDLE) _get_osfhandle(lockfilefd),
LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY,
0, 0, 1, &o)) {
cleanup_lockfile();
......@@ -349,11 +349,11 @@ ns_os_shutdown(void) {
closelog();
cleanup_pidfile();
if (singletonfd != -1) {
(void) UnlockFile((HANDLE) _get_osfhandle(singletonfd),
if (lockfilefd != -1) {
(void) UnlockFile((HANDLE) _get_osfhandle(lockfilefd),
0, 0, 0, 1);
close(singletonfd);
singletonfd = -1;
close(lockfilefd);
lockfilefd = -1;
}
ntservice_shutdown(); /* This MUST be the last thing done */
}
......
......@@ -1397,7 +1397,7 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target) {
if (escape)
return (DNS_R_SYNTAX);
isc_buffer_add(target, t - t0);
isc_buffer_add(target, (unsigned int)(t - t0));
} while (n != 0);
return (ISC_R_SUCCESS);
}
......
......@@ -2150,8 +2150,8 @@ dns_view_loadnta(dns_view_t *view) {
dns_fixedname_init(&fn);
ntaname = dns_fixedname_name(&fn);
isc_buffer_init(&b, name, len);
isc_buffer_add(&b, len);
isc_buffer_init(&b, name, (unsigned int)len);
isc_buffer_add(&b, (unsigned int)len);
CHECK(dns_name_fromtext(ntaname, &b, dns_rootname,
0, NULL));
}
......
......@@ -319,7 +319,12 @@ entropypool_adddata(isc_entropy_t *ent, void *p, unsigned int len,
unsigned long addr;
isc_uint8_t *buf;
/* Silly MSVC in 64 bit mode complains here... */
#ifdef _WIN64
addr = (unsigned long)((unsigned long long)p);
#else
addr = (unsigned long)p;
#endif
buf = p;
if ((addr & 0x03U) != 0U) {
......
......@@ -207,7 +207,7 @@ table_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer) {
isccc_sexpr_t *kv, *elt, *k, *v;
char *ks;
isc_result_t result;
size_t len;
unsigned int len;
for (elt = isccc_alist_first(alist);
elt != NULL;
......@@ -216,7 +216,7 @@ table_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer) {
k = ISCCC_SEXPR_CAR(kv);
ks = isccc_sexpr_tostring(k);
v = ISCCC_SEXPR_CDR(kv);
len = strlen(ks);
len = (unsigned int)strlen(ks);
INSIST(len <= 255U);
/*
* Emit the key name.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment