Skip to content

Commit

Permalink
#5 - x64
Browse files Browse the repository at this point in the history
  • Loading branch information
adamyg committed Feb 2, 2025
1 parent 0023180 commit 598ea17
Show file tree
Hide file tree
Showing 22 changed files with 369 additions and 62 deletions.
8 changes: 4 additions & 4 deletions libNTService/NTService.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(NTService_cpp, "$Id: NTService.cpp,v 1.15 2025/02/02 08:47:18 cvsuser Exp $")
__CIDENT_RCSID(NTService_cpp, "$Id: NTService.cpp,v 1.16 2025/02/02 17:05:39 cvsuser Exp $")

/* -*- mode: c; indent-width: 8; -*- */
/*
Expand Down Expand Up @@ -186,7 +186,7 @@ CNTService::DefaultServiceName(const char *arg0, char *buf, size_t buflen)

const char *dot, *p1 = strrchr(arg0, '\\'),
*p2 = strrchr(arg0, '/');
int t_length, length = buflen - 1 /*nul*/;
size_t t_length, length = buflen - 1 /*nul*/;

if (p1 || p2) { // last component.
arg0 = (p1 > p2 ? p1 : p2) + 1;
Expand Down Expand Up @@ -378,7 +378,7 @@ int CNTService::InstallArgumentsParse(int argc, const char * const *argv, Instal
break;
case 'A': { //-A,--arg
// TODO: allow client validation
const int needed = strlen(options.optarg());
const size_t needed = (int)strlen(options.optarg());
char *cursor = arguments.buffer,
*end = (cursor + sizeof(arguments.buffer)) - 1;

Expand Down Expand Up @@ -494,7 +494,7 @@ bool CNTService::Install(const InstallArguments &arguments)

szBinaryPathNameEx[0] = 0;
if (arguments.additional) { // Append argument
const DWORD needed = strlen(arguments.additional) + 2 /*space+nul*/;
const size_t needed = strlen(arguments.additional) + 2 /*space+nul*/;
if (needed >= (sizeof(szBinaryPathName) - pathlen)) {
::SetLastError(ERROR_FILE_TOO_LARGE);
return false;
Expand Down
25 changes: 23 additions & 2 deletions libNTService/NTServiceReg.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(NTServiceReg_cpp, "$Id: NTServiceReg.cpp,v 1.7 2025/02/02 08:47:18 cvsuser Exp $")
__CIDENT_RCSID(NTServiceReg_cpp, "$Id: NTServiceReg.cpp,v 1.8 2025/02/02 17:05:39 cvsuser Exp $")

/* -*- mode: c; indent-width: 8; -*- */
/*
Expand Down Expand Up @@ -269,6 +269,10 @@ CNTServiceReg::GetValue(HKEY key, NTService::IDiagnostics &diags,
DWORD t_dwSize, dwType, t_dwResult = 0;
LSTATUS status;

#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4267)
#endif
t_dwSize = dwSize, dwType = 0;
if ((status = ::RegQueryValueEx(key, csKey, NULL,
&dwType, (BYTE *) szBuffer, &t_dwSize)) == ERROR_SUCCESS && REG_DWORD == dwType) {
Expand All @@ -277,6 +281,9 @@ CNTServiceReg::GetValue(HKEY key, NTService::IDiagnostics &diags,
dwSize = t_dwSize;
return true;
}
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

if (ERROR_MORE_DATA == status) { // overflow
diags.fwarning("parameter <%s> too large", csKey);
Expand Down Expand Up @@ -384,6 +391,10 @@ CNTServiceReg::SetValue(HKEY key, NTService::IDiagnostics &diags,
// Note: If szKey is NULL or an empty string, "",
// the function sets the type and data for the key's unnamed or default value.
//
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4267)
#endif
dwSize = strlen(szValue) + 1 /*nul*/;
if ((dwRet = ::RegSetValueExA(key, csKey, 0,
REG_SZ, (const BYTE *)szValue, dwSize)) != ERROR_SUCCESS) {
Expand All @@ -392,6 +403,9 @@ CNTServiceReg::SetValue(HKEY key, NTService::IDiagnostics &diags,
(unsigned)dwRet, StrError(dwRet, errmsg, sizeof(errmsg)));
return false;
}
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
return true;
}

Expand All @@ -411,6 +425,10 @@ CNTServiceReg::SetValue(HKEY key, NTService::IDiagnostics &diags,

#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast"
#endif
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4312)
#endif
dwSize = sizeof(dwValue);
if ((dwRet = ::RegSetValueExA(key, csKey, 0,
Expand All @@ -420,6 +438,9 @@ CNTServiceReg::SetValue(HKEY key, NTService::IDiagnostics &diags,
(unsigned)dwRet, StrError(dwRet, errmsg, sizeof(errmsg)));
return false;
}
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
return true;
}

Expand Down Expand Up @@ -600,7 +621,7 @@ CNTServiceReg::StrError(DWORD dwError, char *buffer, size_t buflen)
DWORD len = ::FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL,
dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buffer, buflen - 1 /*nul*/, NULL);
buffer, (DWORD)(buflen - 1 /*nul*/), NULL);

if (0 == len) {
if ( !buffer || buflen < 32) {
Expand Down
4 changes: 2 additions & 2 deletions libNTService/NTString.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class CString

void assign(const char *buffer)
{
assign(buffer, strlen(buffer));
assign(buffer, (unsigned)strlen(buffer));
}

void append(const char *buffer, unsigned length)
Expand All @@ -142,7 +142,7 @@ class CString

void append(const char *buffer)
{
append(buffer, strlen(buffer));
append(buffer, (unsigned)strlen(buffer));
}

void clear()
Expand Down
4 changes: 3 additions & 1 deletion libssh2/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- mode: mak; indent-tabs-mode: t; tab-width: 8 -*-
# $Id: Makefile.in,v 1.14 2025/02/02 14:02:50 cvsuser Exp $
# $Id: Makefile.in,v 1.15 2025/02/02 16:51:54 cvsuser Exp $
# libssh2 makefile.
#
#
Expand Down Expand Up @@ -125,8 +125,10 @@ SSH2INCLUDE= $(SSH2BASE)/include

CINCLUDE+= -I$(SSH2BASE)/win32 -I$(SSH2INCLUDE)
ifneq (mingw,$(findstring mingw,"@TOOLCHAIN@"))
ifeq ("yes","@ISWIN32@"))
CINCLUDE+= -I./sdk
endif
endif
CEXTRA+= -DLIBSSH2_HAVE_ZLIB
# also see libssh2/win32/libssh2_config.h

Expand Down
6 changes: 3 additions & 3 deletions libtermemu/termemu_keymap.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(termemu_keymap_c,"$Id: termemu_keymap.c,v 1.13 2025/02/02 13:58:14 cvsuser Exp $")
__CIDENT_RCSID(termemu_keymap_c,"$Id: termemu_keymap.c,v 1.14 2025/02/02 16:52:25 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/*
Expand Down Expand Up @@ -313,9 +313,9 @@ termemu_keymap_parse(termemu_keymap_t *keymap, const char *source, size_t buflen
// other or error.
error: if (!*err) strcpy(err, "syntax error");
if (label) {
fprintf(stderr, "%s (%u): \"%.*s\" : %s\n", label, line, length, source, err);
fprintf(stderr, "%s (%u): \"%.*s\" : %s\n", label, line, (int)length, source, err);
} else {
fprintf(stderr, "line: \"%.*s\" : %s\n", length, source, err);
fprintf(stderr, "line: \"%.*s\" : %s\n", (int)length, source, err);
}
return -1;
}
Expand Down
8 changes: 4 additions & 4 deletions libtermemu/termemu_vio.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(termemu_vio_c,"$Id: termemu_vio.c,v 1.16 2025/02/02 13:58:14 cvsuser Exp $")
__CIDENT_RCSID(termemu_vio_c,"$Id: termemu_vio.c,v 1.17 2025/02/02 16:52:25 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/*
Expand Down Expand Up @@ -234,14 +234,14 @@ static void CopyIn(unsigned pos, unsigned cnt, WCHAR_INFO *image);
static void CopyOut(copyoutctx_t *ctx, unsigned offset, unsigned len, unsigned flags);
#if defined(WIN32_CONSOLEEXT)
#if defined(WIN32_CONSOLE256)
static void CopyOutEx(copyoutctx_t *ctx, unsigned pos, unsigned cnt, unsigned flags);
static void CopyOutEx(copyoutctx_t *ctx, size_t pos, size_t cnt, unsigned flags);
#define WIN32_CONSOLEVIRTUAL
#if defined(WIN32_CONSOLEVIRTUAL)
static void CopyOutEx2(copyoutctx_t *ctx, size_t pos, size_t cnt, unsigned flags);
#endif //WIN32_CONSOLEVIRTUAL
#endif //WIN32_CONSOLE256
static void UnderOutEx(copyoutctx_t *ctx, unsigned pos, unsigned cnt);
static void StrikeOutEx(copyoutctx_t *ctx, unsigned pos, unsigned cnt);
static void UnderOutEx(copyoutctx_t *ctx, size_t pos, size_t cnt);
static void StrikeOutEx(copyoutctx_t *ctx, size_t pos, size_t cnt);
#endif //WIN32_CONSOLEEXT

#if defined(WIN32_CONSOLE256)
Expand Down
7 changes: 5 additions & 2 deletions libtermemu/termemumkkeys.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ from The Open Group.
*/

static const char
mkkeys_ident[] = "$Id: termemumkkeys.c,v 1.6 2025/02/02 13:58:14 cvsuser Exp $";
mkkeys_ident[] = "$Id: termemumkkeys.c,v 1.7 2025/02/02 16:52:25 cvsuser Exp $";

#if !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -311,7 +314,7 @@ next1: ;
*/
now = time(NULL);
printf("/* This file is generated from <mkkeys> on %.24s */\n", ctime(&now));
printf("/* termemumkkeys: %.*s */\n", strlen(mkkeys_ident) - 6, mkkeys_ident + 5);
printf("/* termemumkkeys: %.*s */\n", (int)(strlen(mkkeys_ident) - 6), mkkeys_ident + 5);
printf("/* $" "Id: $ */\n");
printf("/* ------------------------ do not edit ------------------------ */\n");
printf("\n" \
Expand Down
8 changes: 4 additions & 4 deletions rlogind/Logger.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(Logger_cpp, "$Id: Logger.cpp,v 1.10 2025/02/02 14:10:46 cvsuser Exp $")
__CIDENT_RCSID(Logger_cpp, "$Id: Logger.cpp,v 1.11 2025/02/02 16:53:40 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/*
Expand Down Expand Up @@ -148,11 +148,11 @@ LOGGER_TRACE(std::cout << "LOG: purged empty volume <" << filename_ << ">\n";)
return created_;
}

unsigned size() const {
size_t size() const {
return size_;
}

unsigned blocks() const {
size_t blocks() const {
return blocks_;
}

Expand Down Expand Up @@ -300,7 +300,7 @@ LOGGER_TRACE(std::cout << "LOG: purged empty volume <" << filename_ << ">\n";)
#if defined(__WATCOMC__)
return std::fwrite(buffer, 1, buflen, fp_);
#else
return _fwrite_nolock(buffer, 1, buflen, fp_);
return (int)_fwrite_nolock(buffer, 1, (int)buflen, fp_);
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions rlogind/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ class Logger {
void assign_nl(const void *buffer, size_t buflen);
char *data()
{ return data_; }
unsigned reserved() const
size_t reserved() const
{ return reserved_; }
unsigned size() const
size_t size() const
{ return size_; }
public:
TAILQ_ENTRY(BufferCursor) __entry; // intrusive queue member; private
Expand All @@ -116,7 +116,7 @@ class Logger {
~BufferCursor() {
}
friend class LoggerImpl;
unsigned magic_, reserved_, size_;
size_t magic_, reserved_, size_;
char *data_;
void *parent_;
};
Expand Down
4 changes: 2 additions & 2 deletions rlogind/Service.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(Service_cpp,"$Id: Service.cpp,v 1.12 2025/02/02 14:10:46 cvsuser Exp $")
__CIDENT_RCSID(Service_cpp,"$Id: Service.cpp,v 1.13 2025/02/02 16:53:40 cvsuser Exp $")

/* -*- mode: c; indent-width: 8; -*- */
/*
Expand Down Expand Up @@ -384,7 +384,7 @@ Service::ResolveRelative(const char *path)

const char *d1 = strrchr(t_szAppPath, '/'), *d2 = strrchr(t_szAppPath, '\\'),
*d = (d1 > d2 ? d1 : d2); // last delimitor
len = (d ? (d - t_szAppPath) : len);
len = (d ? (int)(d - t_szAppPath) : len);

snprintf(t_szAppPath + len, sizeof(t_szAppPath) - len, "\\%s", basename);
t_szAppPath[sizeof(t_szAppPath) - 1] = 0;
Expand Down
10 changes: 5 additions & 5 deletions rlogind/Session.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(Session_cpp,"$Id: Session.cpp,v 1.18 2025/02/02 14:10:46 cvsuser Exp $")
__CIDENT_RCSID(Session_cpp,"$Id: Session.cpp,v 1.19 2025/02/02 16:53:40 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/*
Expand Down Expand Up @@ -320,7 +320,7 @@ Session::doit(struct sockaddr_storage *fromp)
continue;
// if (res->ai_addrlen != fromp->ss_len)
// continue;
if (getnameinfo(res->ai_addr, res->ai_addrlen,
if (getnameinfo(res->ai_addr, (socklen_t)res->ai_addrlen,
raddr, sizeof(raddr), NULL, 0, niflags) == 0
&& strcmp(naddr, raddr) == 0) {
hostname = res->ai_canonname
Expand Down Expand Up @@ -569,7 +569,7 @@ STDOUT_TRACE(std::cout << "read socket : " << fcc << "\n";)
fbp = fibuf;
top: for (cp = fibuf; cp < fibuf+fcc-1; cp++) {
if (cp[0] == magic[0] && cp[1] == magic[1]) {
left = fcc - (cp-fibuf);
left = (int)(fcc - (cp-fibuf));
n = ptycontrol(cp, left);
if (n) {
STDOUT_TRACE(std::cout << "read socket : ptycontrol : " << n << "\n";)
Expand Down Expand Up @@ -697,7 +697,7 @@ Session::remote_fatal(const char *msg, int syserr)
if (!confirmed_)
*bp++ = '\001'; /* error indicator */

space = ep - bp;
space = (int)(ep - bp);
if (syserr) {
len = snprintf(bp, space, "rlogind: %s: %s\r\n", msg, strerror(errno));
} else {
Expand All @@ -708,7 +708,7 @@ Session::remote_fatal(const char *msg, int syserr)
len = space;
}

(void) sockwrite(netf_, message_, (bp + len) - message_);
(void) sockwrite(netf_, message_, (int)((bp + len) - message_));

if (bp[len-1] == '\n') bp[len-2] = 0; // \r\n
throw bp + 9; // "rlogind: "
Expand Down
4 changes: 2 additions & 2 deletions rlogind/W32Poll.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(W32Poll_cpp,"$Id: W32Poll.cpp,v 1.8 2025/02/02 14:10:46 cvsuser Exp $")
__CIDENT_RCSID(W32Poll_cpp,"$Id: W32Poll.cpp,v 1.9 2025/02/02 16:53:40 cvsuser Exp $")

/* -*- mode: c; indent-width: 8; -*- */
/*
Expand Down Expand Up @@ -171,7 +171,7 @@ int W32Poll::SocketWrite(SOCKET hSocket, const char *buf, size_t cnt) {

assert(hSocket == sock.hSocket);
if (buf && cnt > 0) {
if (/*SOCKET_ERROR*/ -1 == (ret = sockwrite(sock.hSocket, buf, cnt))) {
if (/*SOCKET_ERROR*/ -1 == (ret = sockwrite((int)sock.hSocket, buf, (unsigned int)cnt))) {
// Clear FD_WRITE status ...
if (EWOULDBLOCK == errno) {
sock.fWriteable = false;
Expand Down
10 changes: 5 additions & 5 deletions rlogind/rlogind.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(rlogind_c, "$Id: rlogind.cpp,v 1.21 2025/02/02 14:10:46 cvsuser Exp $")
__CIDENT_RCSID(rlogind_c, "$Id: rlogind.cpp,v 1.22 2025/02/02 16:53:40 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/*
Expand Down Expand Up @@ -510,7 +510,7 @@ usage_print()
collen = optlen;
}
col = 4 + collen;
fprintf(stderr, " %-*.*s", collen, collen, text + 1);
fprintf(stderr, " %-*.*s", (int)collen, (int)collen, text + 1);

} else if (text[0] == '\2' || //description, right alignment.
text[0] == '\3') { //section text, right alignment.
Expand Down Expand Up @@ -550,14 +550,14 @@ usage_format(size_t lmargin, size_t rmargin, size_t col, const char *text)
const size_t wordlen = strcspn(text, " .,\t;\n") + 1;

if (col < lmargin) {
fprintf(stderr, "%*s", lmargin - col, "");
fprintf(stderr, "%*s", (int)(lmargin - col), "");
col = lmargin;
} else if (col && (wordlen + col) > rmargin) {
fprintf(stderr, "\n%*s", lmargin, "");
fprintf(stderr, "\n%*s", (int)lmargin, "");
col = lmargin;
}

fprintf(stderr, "%.*s", wordlen, text);
fprintf(stderr, "%.*s", (int)wordlen, text);
col += wordlen;

if (text[wordlen-1] == '\n') { // <br>
Expand Down
4 changes: 2 additions & 2 deletions rlogind/syslog.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <edidentifier.h>
__CIDENT_RCSID(syslog_c,"$Id: syslog.c,v 1.9 2025/02/02 14:10:46 cvsuser Exp $")
__CIDENT_RCSID(syslog_c,"$Id: syslog.c,v 1.10 2025/02/02 16:53:40 cvsuser Exp $")

/* -*- mode: c; indent-width: 8; -*- */
/*
Expand Down Expand Up @@ -236,7 +236,7 @@ vsyslog(int pri, const char *fmt, va_list ap)
// syslog( "%s", buffer )
const char *buffer = va_arg(ap, const char *);
if (buffer && *buffer) { // formatting optimization
if ((len2 = strlen(buffer)) > space) len2 = space;
if ((len2 = (int)strlen(buffer)) > space) len2 = space;
memcpy(message + len, buffer, len2);
len += len2;
}
Expand Down
Loading

0 comments on commit 598ea17

Please sign in to comment.