Compiler warning cleanup

This commit is contained in:
Mark Pizzolato 2012-12-13 13:41:57 -08:00
parent 7f6a1af5bf
commit b466bdc9c6
34 changed files with 90 additions and 82 deletions

View file

@ -398,7 +398,7 @@ static const unsigned char boot_rom[] = {
t_stat cdr_boot (int32 unitno, DEVICE *dptr) t_stat cdr_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern int32 saved_IS; extern int32 saved_IS;
for (i = 0; i < CDR_WIDTH; i++) /* clear buffer */ for (i = 0; i < CDR_WIDTH; i++) /* clear buffer */

View file

@ -348,7 +348,7 @@ return SCPE_OK;
/* Bootstrap routine */ /* Bootstrap routine */
const static uint8 boot_rom[] = { static const uint8 boot_rom[] = {
4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* NOP */ 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* NOP */
3, 6, 0, 0, 0, 3, 1, 0, 0, 3, 0, 0, /* RNPT 31 */ 3, 6, 0, 0, 0, 3, 1, 0, 0, 3, 0, 0, /* RNPT 31 */
2, 5, 0, 0, 0, 7, 1, 0, 0, 0, 0, 0, /* TD 71,loc */ 2, 5, 0, 0, 0, 7, 1, 0, 0, 0, 0, 0, /* TD 71,loc */
@ -363,7 +363,7 @@ const static uint8 boot_rom[] = {
t_stat ptr_boot (int32 unitno, DEVICE *dptr) t_stat ptr_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern uint32 saved_PC; extern uint32 saved_PC;
for (i = 0; i < BOOT_LEN; i++) for (i = 0; i < BOOT_LEN; i++)

View file

@ -183,10 +183,10 @@ uint32 com_chob_v = 0; /* valid flag */
t_uint64 com_buf[COM_BUFSIZ]; /* channel buffer */ t_uint64 com_buf[COM_BUFSIZ]; /* channel buffer */
LISTHD com_free; /* free list */ LISTHD com_free; /* free list */
uint32 com_not_ret[COM_TLINES] = { 0 }; /* chars not returned */ uint32 com_not_ret[COM_TLINES] = { 0 }; /* chars not returned */
LISTHD com_inpq[COM_TLINES] = { 0 }; /* input queues */ LISTHD com_inpq[COM_TLINES] = { {0} }; /* input queues */
LISTHD com_outq[COM_TLINES] = { 0 }; /* output queues */ LISTHD com_outq[COM_TLINES] = { {0} }; /* output queues */
LISTENT com_pkt[COM_PKTSIZ]; /* character packets */ LISTENT com_pkt[COM_PKTSIZ]; /* character packets */
TMLN com_ldsc[COM_MLINES] = { 0 }; /* line descriptors */ TMLN com_ldsc[COM_MLINES] = { {0} }; /* line descriptors */
TMXR com_desc = { COM_MLINES, 0, 0, com_ldsc }; /* mux descriptor */ TMXR com_desc = { COM_MLINES, 0, 0, com_ldsc }; /* mux descriptor */
/* Even parity truth table */ /* Even parity truth table */

View file

@ -222,7 +222,7 @@ uint32 GREG[16 * NRSETS] = { 0 }; /* general registers */
uint32 *M = NULL; /* memory */ uint32 *M = NULL; /* memory */
uint32 *R = &GREG[0]; /* working reg set */ uint32 *R = &GREG[0]; /* working reg set */
uint32 F[8] = { 0 }; /* sp fp registers */ uint32 F[8] = { 0 }; /* sp fp registers */
dpr_t D[8] = { 0 }; /* dp fp registers */ dpr_t D[8] = { {0} }; /* dp fp registers */
uint32 PSW = 0; /* processor status word */ uint32 PSW = 0; /* processor status word */
uint32 PC = 0; /* program counter */ uint32 PC = 0; /* program counter */
uint32 oPC = 0; /* PC at inst start */ uint32 oPC = 0; /* PC at inst start */

View file

@ -115,7 +115,7 @@ uint32 fd_cmd = 0; /* command */
uint32 fd_db = 0; /* data buffer */ uint32 fd_db = 0; /* data buffer */
uint32 fd_bptr = 0; /* buffer pointer */ uint32 fd_bptr = 0; /* buffer pointer */
uint8 fdxb[FD_NUMBY] = { 0 }; /* sector buffer */ uint8 fdxb[FD_NUMBY] = { 0 }; /* sector buffer */
uint8 fd_es[FD_NUMDR][ES_SIZE] = { 0 }; /* ext status */ uint8 fd_es[FD_NUMDR][ES_SIZE] = { {0} }; /* ext status */
uint32 fd_lrn = 0; /* log rec # */ uint32 fd_lrn = 0; /* log rec # */
uint32 fd_wdv = 0; /* wd valid */ uint32 fd_wdv = 0; /* wd valid */
uint32 fd_stopioe = 1; /* stop on error */ uint32 fd_stopioe = 1; /* stop on error */

View file

@ -103,7 +103,7 @@ uint8 pas_xarm[PAS_LINES]; /* xmt int armed */
uint8 pas_rchp[PAS_LINES]; /* rcvr chr pend */ uint8 pas_rchp[PAS_LINES]; /* rcvr chr pend */
uint8 pas_tplte[PAS_LINES * 2 + 1]; /* template */ uint8 pas_tplte[PAS_LINES * 2 + 1]; /* template */
TMLN pas_ldsc[PAS_LINES] = { 0 }; /* line descriptors */ TMLN pas_ldsc[PAS_LINES] = { {0} }; /* line descriptors */
TMXR pas_desc = { 8, 0, 0, pas_ldsc }; /* mux descriptor */ TMXR pas_desc = { 8, 0, 0, pas_ldsc }; /* mux descriptor */
#define PAS_ENAB pas_desc.lines #define PAS_ENAB pas_desc.lines

View file

@ -130,7 +130,7 @@ DEVICE ttp_dev = {
uint32 ttp (uint32 dev, uint32 op, uint32 dat) uint32 ttp (uint32 dev, uint32 op, uint32 dat)
{ {
int32 xmt = dev & 1; int32 xmt = dev & 1;
int32 t, old_cmd; int32 t;
switch (op) { /* case IO op */ switch (op) { /* case IO op */
@ -160,7 +160,6 @@ switch (op) { /* case IO op */
return t; return t;
case IO_OC: /* command */ case IO_OC: /* command */
old_cmd = ttp_cmd; /* old cmd */
if (dat & CMD_TYP) { /* type 1? */ if (dat & CMD_TYP) { /* type 1? */
ttp_cmd = (ttp_cmd & 0xFF) | (dat << 8); ttp_cmd = (ttp_cmd & 0xFF) | (dat << 8);
if (ttp_cmd & CMD_WRT) /* write? */ if (ttp_cmd & CMD_WRT) /* write? */

View file

@ -48,7 +48,7 @@ uint8 dcs_buf[DCS_LINES]; /* line bufffers */
extern int32 iosta, stop_inst; extern int32 iosta, stop_inst;
extern int32 tmxr_poll; extern int32 tmxr_poll;
TMLN dcs_ldsc[DCS_LINES] = { 0 }; /* line descriptors */ TMLN dcs_ldsc[DCS_LINES] = { {0} }; /* line descriptors */
TMXR dcs_desc = { DCS_LINES, 0, 0, dcs_ldsc }; /* mux descriptor */ TMXR dcs_desc = { DCS_LINES, 0, 0, dcs_ldsc }; /* mux descriptor */
t_stat dcsi_svc (UNIT *uptr); t_stat dcsi_svc (UNIT *uptr);

View file

@ -1284,7 +1284,7 @@ static const d10 boot_rom_its[] = {
t_stat rp_boot (int32 unitno, DEVICE *dptr) t_stat rp_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern a10 saved_PC; extern a10 saved_PC;
M[FE_UNIT] = unitno & CS2_M_UNIT; M[FE_UNIT] = unitno & CS2_M_UNIT;

View file

@ -1273,7 +1273,7 @@ static const d10 boot_rom_its[] = {
t_stat tu_boot (int32 unitno, DEVICE *dptr) t_stat tu_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern a10 saved_PC; extern a10 saved_PC;
M[FE_UNIT] = 0; M[FE_UNIT] = 0;

View file

@ -244,7 +244,7 @@ static const int32 boot_rom[] = {
t_stat drm_boot (int32 unitno, DEVICE *dptr) t_stat drm_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern int32 PC; extern int32 PC;
if (drm_dib.dev != DEV_DRM) /* non-std addr? */ if (drm_dib.dev != DEV_DRM) /* non-std addr? */

View file

@ -453,7 +453,6 @@ int32 clk_task_upd (t_bool clr)
{ {
uint32 delta, val, iusec10; uint32 delta, val, iusec10;
uint32 cur = sim_grtime (); uint32 cur = sim_grtime ();
uint32 old = clk_task_timer;
double usec10; double usec10;
if (cur > clk_task_last) if (cur > clk_task_last)
@ -861,7 +860,8 @@ static const int32 boot_rom[] = {
t_stat ptr_boot (int32 unitno, DEVICE *dptr) t_stat ptr_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i, mask, wd; size_t i;
int32 mask, wd;
extern int32 sim_switches; extern int32 sim_switches;
#if defined (PDP7) #if defined (PDP7)

View file

@ -57,7 +57,7 @@ uint32 ttix_done = 0; /* input flags */
uint32 ttox_done = 0; /* output flags */ uint32 ttox_done = 0; /* output flags */
uint8 ttix_buf[TTX_MAXL] = { 0 }; /* input buffers */ uint8 ttix_buf[TTX_MAXL] = { 0 }; /* input buffers */
uint8 ttox_buf[TTX_MAXL] = { 0 }; /* output buffers */ uint8 ttox_buf[TTX_MAXL] = { 0 }; /* output buffers */
TMLN ttx_ldsc[TTX_MAXL] = { 0 }; /* line descriptors */ TMLN ttx_ldsc[TTX_MAXL] = { {0} }; /* line descriptors */
TMXR ttx_desc = { 1, 0, 0, ttx_ldsc }; /* mux descriptor */ TMXR ttx_desc = { 1, 0, 0, ttx_ldsc }; /* mux descriptor */
#define ttx_lines ttx_desc.lines /* current number of lines */ #define ttx_lines ttx_desc.lines /* current number of lines */

View file

@ -334,7 +334,7 @@ static const uint16 dm4_rom[] = {
t_stat df_boot (int32 unitno, DEVICE *dptr) t_stat df_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern int32 sim_switches, saved_PC; extern int32 sim_switches, saved_PC;
if (sim_switches & SWMASK ('D')) { if (sim_switches & SWMASK ('D')) {

View file

@ -1178,7 +1178,7 @@ static const uint16 boot_rom[] = {
t_stat dt_boot (int32 unitno, DEVICE *dptr) t_stat dt_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern int32 saved_PC; extern int32 saved_PC;
if (unitno) /* only unit 0 */ if (unitno) /* only unit 0 */

View file

@ -278,7 +278,7 @@ static const uint16 boot_rom[] = {
t_stat ptr_boot (int32 unitno, DEVICE *dptr) t_stat ptr_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern int32 saved_PC; extern int32 saved_PC;
extern uint16 M[]; extern uint16 M[];

View file

@ -398,7 +398,7 @@ static const uint16 dm4_rom[] = {
t_stat rf_boot (int32 unitno, DEVICE *dptr) t_stat rf_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern int32 sim_switches, saved_PC; extern int32 sim_switches, saved_PC;
if (rf_dib.dev != DEV_RF) /* only std devno */ if (rf_dib.dev != DEV_RF) /* only std devno */

View file

@ -450,7 +450,7 @@ static const uint16 boot_rom[] = {
t_stat rk_boot (int32 unitno, DEVICE *dptr) t_stat rk_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern int32 saved_PC; extern int32 saved_PC;
if (rk_dib.dev != DEV_RK) /* only std devno */ if (rk_dib.dev != DEV_RK) /* only std devno */

View file

@ -689,7 +689,7 @@ static const uint16 boot_rom[] = {
t_stat rl_boot (int32 unitno, DEVICE *dptr) t_stat rl_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern int32 saved_PC; extern int32 saved_PC;
if (unitno) /* only unit 0 */ if (unitno) /* only unit 0 */

View file

@ -733,7 +733,7 @@ static const uint16 boot2_rom[] = {
t_stat rx_boot (int32 unitno, DEVICE *dptr) t_stat rx_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern int32 saved_PC; extern int32 saved_PC;
extern uint16 M[]; extern uint16 M[];

View file

@ -742,7 +742,7 @@ static const uint16 boot_rom[] = {
t_stat td_boot (int32 unitno, DEVICE *dptr) t_stat td_boot (int32 unitno, DEVICE *dptr)
{ {
int32 i; size_t i;
extern int32 saved_PC; extern int32 saved_PC;
if (unitno) if (unitno)

View file

@ -66,7 +66,7 @@ extern int32 tmxr_poll, sim_is_running;
uint8 ttix_buf[TTX_LINES] = { 0 }; /* input buffers */ uint8 ttix_buf[TTX_LINES] = { 0 }; /* input buffers */
uint8 ttox_buf[TTX_LINES] = { 0 }; /* output buffers */ uint8 ttox_buf[TTX_LINES] = { 0 }; /* output buffers */
int32 ttx_tps = 100; /* polls per second */ int32 ttx_tps = 100; /* polls per second */
TMLN ttx_ldsc[TTX_LINES] = { 0 }; /* line descriptors */ TMLN ttx_ldsc[TTX_LINES] = { {0} }; /* line descriptors */
TMXR ttx_desc = { TTX_LINES, 0, 0, ttx_ldsc }; /* mux descriptor */ TMXR ttx_desc = { TTX_LINES, 0, 0, ttx_ldsc }; /* mux descriptor */
DEVICE ttix_dev, ttox_dev; DEVICE ttix_dev, ttox_dev;

View file

@ -270,13 +270,12 @@ int32 fprint_sym (FILE *of, int32 addr, uint32 *val,
int32 printf_sym (FILE *of, char *strg, int32 addr, uint32 *val, int32 printf_sym (FILE *of, char *strg, int32 addr, uint32 *val,
UNIT *uptr, int32 sw) UNIT *uptr, int32 sw)
{ {
int32 cflag, c1, c2, group, len1, len2, inst, aaddr, baddr; int32 c1, c2, group, len1, len2, inst, aaddr, baddr;
int32 oplen, groupno, i, j, vpos, qbyte, da, m, n; int32 oplen, groupno, i, j, vpos, qbyte, da, m, n;
char bld[128], bldaddr[32], boperand[32], aoperand[32]; char bld[128], bldaddr[32], boperand[32], aoperand[32];
int32 blk[16], blt[16]; int32 blk[16], blt[16];
int32 blkadd; int32 blkadd;
cflag = (uptr == NULL) || (uptr == &cpu_unit);
c1 = val[0] & 0xff; c1 = val[0] & 0xff;
if (sw & SWMASK ('A')) { if (sw & SWMASK ('A')) {
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {

View file

@ -224,7 +224,7 @@ uint32 dev_map[64][NUM_CHAN];
/* dev_dsp maps device and channel numbers to dispatch routines */ /* dev_dsp maps device and channel numbers to dispatch routines */
t_stat (*dev_dsp[64][NUM_CHAN])() = { NULL }; t_stat (*dev_dsp[64][NUM_CHAN])() = { {NULL} };
/* dev3_dsp maps system device numbers to dispatch routines */ /* dev3_dsp maps system device numbers to dispatch routines */

View file

@ -112,7 +112,7 @@ uint32 mux_tps = 100; /* polls/second */
uint32 mux_scan = 0; /* scanner */ uint32 mux_scan = 0; /* scanner */
uint32 mux_slck = 0; /* scanner locked */ uint32 mux_slck = 0; /* scanner locked */
TMLN mux_ldsc[MUX_LINES] = { 0 }; /* line descriptors */ TMLN mux_ldsc[MUX_LINES] = { {0} }; /* line descriptors */
TMXR mux_desc = { MUX_LINES, 0, 0, mux_ldsc }; /* mux descriptor */ TMXR mux_desc = { MUX_LINES, 0, 0, mux_ldsc }; /* mux descriptor */
t_stat mux (uint32 fnc, uint32 inst, uint32 *dat); t_stat mux (uint32 fnc, uint32 inst, uint32 *dat);

View file

@ -98,7 +98,7 @@ t_stat mctl_wrreg (int32 val, int32 pa, int32 mode);
mctlx_reg MCTLx register list mctlx_reg MCTLx register list
*/ */
DIB mctl0_dib[] = { TR_MCTL0, 0, &mctl_rdreg, &mctl_wrreg, 0 }; DIB mctl0_dib = { TR_MCTL0, 0, &mctl_rdreg, &mctl_wrreg, 0 };
UNIT mctl0_unit = { UDATA (NULL, 0, 0) }; UNIT mctl0_unit = { UDATA (NULL, 0, 0) };
@ -117,7 +117,7 @@ MTAB mctl0_mod[] = {
{ 0 } { 0 }
}; };
DIB mctl1_dib[] = { TR_MCTL1, 0, &mctl_rdreg, &mctl_wrreg, 0 }; DIB mctl1_dib = { TR_MCTL1, 0, &mctl_rdreg, &mctl_wrreg, 0 };
UNIT mctl1_unit = { UDATA (NULL, 0, 0) }; UNIT mctl1_unit = { UDATA (NULL, 0, 0) };

View file

@ -71,8 +71,8 @@ typedef struct {
uint32 val[DSTRLNT]; uint32 val[DSTRLNT];
} DSTR; } DSTR;
static DSTR Dstr_zero = { 0, 0, 0, 0, 0 }; static DSTR Dstr_zero = { 0, {0, 0, 0, 0} };
static DSTR Dstr_one = { 0, 0x10, 0, 0, 0 }; static DSTR Dstr_one = { 0, {0x10, 0, 0, 0} };
extern int32 R[16]; extern int32 R[16];
extern int32 PSL; extern int32 PSL;

12
scp.c
View file

@ -718,6 +718,7 @@ static CTAB cmd_table[] = {
"sh{ow} <unit> {arg,...} show unit parameters\n" "sh{ow} <unit> {arg,...} show unit parameters\n"
"sh{ow} ethernet show ethernet devices\n" "sh{ow} ethernet show ethernet devices\n"
"sh{ow} serial show serial devices\n" "sh{ow} serial show serial devices\n"
"sh{ow} multiplexer show open multiplexer devices\n"
"sh{ow} on show on condition actions\n" }, "sh{ow} on show on condition actions\n" },
{ "DO", &do_cmd, 1, { "DO", &do_cmd, 1,
"do {-V} {-O} {-E} {-Q} <file> {arg,arg...}\b" "do {-V} {-O} {-E} {-Q} <file> {arg,arg...}\b"
@ -2072,7 +2073,6 @@ static SHTAB show_glob_tab[] = {
{ "ETHERNET", &eth_show_devices, 0 }, { "ETHERNET", &eth_show_devices, 0 },
{ "SERIAL", &sim_show_serial, 0 }, { "SERIAL", &sim_show_serial, 0 },
{ "MULTIPLEXER", &tmxr_show_open_devices, 0 }, { "MULTIPLEXER", &tmxr_show_open_devices, 0 },
{ "MUX", &tmxr_show_open_devices, 0 },
{ "ON", &show_on, 0 }, { "ON", &show_on, 0 },
{ NULL, NULL, 0 } { NULL, NULL, 0 }
}; };
@ -4429,8 +4429,10 @@ char *read_line_p (char *prompt, char *cptr, int32 size, FILE *stream)
char *tptr; char *tptr;
#if defined(HAVE_DLOPEN) #if defined(HAVE_DLOPEN)
static int initialized = 0; static int initialized = 0;
static char *(*p_readline)(const char *) = NULL; typedef char *(*readline_func)(const char *);
static void (*p_add_history)(const char *) = NULL; static readline_func p_readline = NULL;
typedef void (*add_history_func)(const char *);
static add_history_func p_add_history = NULL;
if (!initialized) { if (!initialized) {
initialized = 1; initialized = 1;
@ -4446,8 +4448,8 @@ if (!initialized) {
if (!handle) if (!handle)
handle = dlopen("libreadline." __STR(HAVE_DLOPEN) ".5", RTLD_NOW|RTLD_GLOBAL); handle = dlopen("libreadline." __STR(HAVE_DLOPEN) ".5", RTLD_NOW|RTLD_GLOBAL);
if (handle) { if (handle) {
p_readline = dlsym(handle, "readline"); p_readline = (readline_func)((size_t)dlsym(handle, "readline"));
p_add_history = dlsym(handle, "add_history"); p_add_history = (add_history_func)((size_t)dlsym(handle, "add_history"));
} }
} }
if (prompt) { /* interactive? */ if (prompt) { /* interactive? */

View file

@ -293,7 +293,7 @@ return 0;
void void
Usage(void) Usage(void)
{ {
int i; size_t i;
printf ("sim_BuildROMs Usage:\n"); printf ("sim_BuildROMs Usage:\n");
printf ("sim_BuildROMs\n"); printf ("sim_BuildROMs\n");
@ -324,7 +324,7 @@ exit(2);
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int i; size_t i;
int status = 0; int status = 0;
if (argc == 1) { /* invoked without any arguments */ if (argc == 1) { /* invoked without any arguments */

View file

@ -277,7 +277,7 @@ typedef uint32 t_addr;
/* String match - at least one character required */ /* String match - at least one character required */
#define MATCH_CMD(ptr,cmd) ((!(ptr)) || (!*(ptr)) || strncmp ((ptr), (cmd), strlen (ptr))) #define MATCH_CMD(ptr,cmd) ((NULL == (ptr)) || (!*(ptr)) || strncmp ((ptr), (cmd), strlen (ptr)))
/* End of Linked List/Queue value */ /* End of Linked List/Queue value */
/* Chosen for 2 reasons: */ /* Chosen for 2 reasons: */

View file

@ -887,7 +887,7 @@ if (sim_switches & SWMASK ('C')) { /* create vhd disk & cop
} }
} }
else if (sim_switches & SWMASK ('M')) { /* merge difference disk? */ else if (sim_switches & SWMASK ('M')) { /* merge difference disk? */
char gbuf[CBUFSIZE], *Parent; char gbuf[CBUFSIZE], *Parent = NULL;
FILE *vhd; FILE *vhd;
sim_switches = sim_switches & ~(SWMASK ('M')); sim_switches = sim_switches & ~(SWMASK ('M'));
@ -1672,7 +1672,6 @@ return SCPE_OK;
static FILE *sim_os_disk_open_raw (const char *rawdevicename, const char *openmode) static FILE *sim_os_disk_open_raw (const char *rawdevicename, const char *openmode)
{ {
int fd;
int mode = 0; int mode = 0;
if (strchr (openmode, 'r') && (strchr (openmode, '+') || strchr (openmode, 'w'))) if (strchr (openmode, 'r') && (strchr (openmode, '+') || strchr (openmode, 'w')))
@ -2835,7 +2834,7 @@ void *handle;
#define __STR(tok) __STR_QUOTE(tok) #define __STR(tok) __STR_QUOTE(tok)
handle = dlopen("libuuid." __STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL); handle = dlopen("libuuid." __STR(HAVE_DLOPEN), RTLD_NOW|RTLD_GLOBAL);
if (handle) if (handle)
uuid_generate_c = (void (*)(void *)) dlsym(handle, "uuid_generate"); uuid_generate_c = (void (*)(void *))((size_t)dlsym(handle, "uuid_generate"));
if (uuid_generate_c) if (uuid_generate_c)
uuid_generate_c(uuidaddr); uuid_generate_c(uuidaddr);
else else
@ -3023,6 +3022,9 @@ errno = Status;
return hVHD; return hVHD;
} }
#if defined(__CYGWIN__)
#include <unistd.h>
#endif
static void static void
ExpandToFullPath (const char *szFileSpec, ExpandToFullPath (const char *szFileSpec,
char *szFullFileSpecBuffer, char *szFullFileSpecBuffer,
@ -3109,7 +3111,7 @@ if (d) {
else else
return NULL; return NULL;
#else #else
while ((c = strchr (szHostPath, '\\'))) while ((c = strchr (d, '\\')))
*c = '/'; *c = '/';
#endif #endif
memset (szHostPath + strlen (szHostPath), 0, HostPathSize - strlen (szHostPath)); memset (szHostPath + strlen (szHostPath), 0, HostPathSize - strlen (szHostPath));

View file

@ -957,9 +957,9 @@ typedef int (*_func)();
static void load_function(char* function, _func* func_ptr) { static void load_function(char* function, _func* func_ptr) {
#ifdef _WIN32 #ifdef _WIN32
*func_ptr = (_func)GetProcAddress(hLib, function); *func_ptr = (_func)((size_t)GetProcAddress(hLib, function));
#else #else
*func_ptr = (_func)dlsym(hLib, function); *func_ptr = (_func)((size_t)dlsym(hLib, function));
#endif #endif
if (*func_ptr == 0) { if (*func_ptr == 0) {
char* msg = "Eth: Failed to find function '%s' in %s\r\n"; char* msg = "Eth: Failed to find function '%s' in %s\r\n";
@ -1416,7 +1416,7 @@ static void eth_get_nic_hw_addr(ETH_DEV* dev, char *devname)
while (p1) { while (p1) {
p2 = strchr(p1+1, ':'); p2 = strchr(p1+1, ':');
if (p2 <= p1+3) { if (p2 <= p1+3) {
int mac_bytes[6]; unsigned int mac_bytes[6];
if (6 == sscanf(p1-2, "%02x:%02x:%02x:%02x:%02x:%02x", &mac_bytes[0], &mac_bytes[1], &mac_bytes[2], &mac_bytes[3], &mac_bytes[4], &mac_bytes[5])) { if (6 == sscanf(p1-2, "%02x:%02x:%02x:%02x:%02x:%02x", &mac_bytes[0], &mac_bytes[1], &mac_bytes[2], &mac_bytes[3], &mac_bytes[4], &mac_bytes[5])) {
dev->host_nic_phy_hw_addr[0] = mac_bytes[0]; dev->host_nic_phy_hw_addr[0] = mac_bytes[0];
dev->host_nic_phy_hw_addr[1] = mac_bytes[1]; dev->host_nic_phy_hw_addr[1] = mac_bytes[1];
@ -1464,7 +1464,7 @@ HANDLE hWait = pcap_getevent ((pcap_t*)dev->handle);
#else #else
int sel_ret; int sel_ret;
int do_select = 0; int do_select = 0;
int select_fd; int select_fd = 0;
switch (dev->eth_api) { switch (dev->eth_api) {
case ETH_API_PCAP: case ETH_API_PCAP:
@ -2111,13 +2111,13 @@ if ((packet->len >= ETH_MIN_PACKET) && (packet->len <= ETH_MAX_PACKET)) {
break; break;
#ifdef USE_TAP_NETWORK #ifdef USE_TAP_NETWORK
case ETH_API_TAP: case ETH_API_TAP:
status = ((packet->len == write(dev->fd_handle, (void *)packet->msg, packet->len)) ? 0 : -1); status = (((int)packet->len == write(dev->fd_handle, (void *)packet->msg, packet->len)) ? 0 : -1);
break; break;
#endif #endif
#ifdef USE_VDE_NETWORK #ifdef USE_VDE_NETWORK
case ETH_API_VDE: case ETH_API_VDE:
status = vde_send((VDECONN*)dev->handle, (void *)packet->msg, packet->len, 0); status = vde_send((VDECONN*)dev->handle, (void *)packet->msg, packet->len, 0);
if ((status == packet->len) || (status == 0)) if ((status == (int)packet->len) || (status == 0))
status = 0; status = 0;
else else
if ((status == -1) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) if ((status == -1) && ((errno == EAGAIN) || (errno == EWOULDBLOCK)))

View file

@ -131,6 +131,7 @@
#define SER_DEV_NAME_MAX 256 /* maximum device name size */ #define SER_DEV_NAME_MAX 256 /* maximum device name size */
#define SER_DEV_DESC_MAX 256 /* maximum device description size */ #define SER_DEV_DESC_MAX 256 /* maximum device description size */
#define SER_DEV_CONFIG_MAX 64 /* maximum device config size */
#define SER_MAX_DEVICE 64 /* maximum serial devices */ #define SER_MAX_DEVICE 64 /* maximum serial devices */
typedef struct serial_list { typedef struct serial_list {
@ -155,7 +156,7 @@ static struct open_serial_device {
SERHANDLE port; SERHANDLE port;
TMLN *line; TMLN *line;
char name[SER_DEV_NAME_MAX]; char name[SER_DEV_NAME_MAX];
char desc[SER_DEV_DESC_MAX]; char config[SER_DEV_CONFIG_MAX];
} *serial_open_devices = NULL; } *serial_open_devices = NULL;
static int serial_open_device_count = 0; static int serial_open_device_count = 0;
@ -169,15 +170,15 @@ for (i=0; i<serial_open_device_count; ++i)
return NULL; return NULL;
} }
static struct open_serial_device *_serial_add_to_open_list (SERHANDLE port, TMLN *line, const char *name, const char *desc) static struct open_serial_device *_serial_add_to_open_list (SERHANDLE port, TMLN *line, const char *name, const char *config)
{ {
serial_open_devices = realloc(serial_open_devices, (++serial_open_device_count)*sizeof(*serial_open_devices)); serial_open_devices = realloc(serial_open_devices, (++serial_open_device_count)*sizeof(*serial_open_devices));
memset(&serial_open_devices[serial_open_device_count-1], 0, sizeof(serial_open_devices[serial_open_device_count-1])); memset(&serial_open_devices[serial_open_device_count-1], 0, sizeof(serial_open_devices[serial_open_device_count-1]));
serial_open_devices[serial_open_device_count-1].port = port; serial_open_devices[serial_open_device_count-1].port = port;
serial_open_devices[serial_open_device_count-1].line = line; serial_open_devices[serial_open_device_count-1].line = line;
strcpy(serial_open_devices[serial_open_device_count-1].name, name); strncpy(serial_open_devices[serial_open_device_count-1].name, name, sizeof(serial_open_devices[serial_open_device_count-1].name)-1);
if (desc) if (config)
strcpy(serial_open_devices[serial_open_device_count-1].desc, desc); strncpy(serial_open_devices[serial_open_device_count-1].config, config, sizeof(serial_open_devices[serial_open_device_count-1].config));
return &serial_open_devices[serial_open_device_count-1]; return &serial_open_devices[serial_open_device_count-1];
} }
@ -234,7 +235,7 @@ for (i=0; i<serial_open_device_count; ++i) {
if (ports >= max) if (ports >= max)
break; break;
strcpy(list[ports].name, serial_open_devices[i].name); strcpy(list[ports].name, serial_open_devices[i].name);
strcpy(list[ports].desc, serial_open_devices[i].desc); strcpy(list[ports].desc, serial_open_devices[i].config);
++ports; ++ports;
} }
if (ports) /* Order the list returned alphabetically by the port name */ if (ports) /* Order the list returned alphabetically by the port name */
@ -377,9 +378,8 @@ return SCPE_OK;
SERHANDLE sim_open_serial (char *name, TMLN *lp, t_stat *stat) SERHANDLE sim_open_serial (char *name, TMLN *lp, t_stat *stat)
{ {
char temp1[1024], temp2[1024], devname [1024]; char temp1[1024], devname [1024];
char *savname = name; char *savname = name;
char *savdesc = NULL;
SERHANDLE port = INVALID_HANDLE; SERHANDLE port = INVALID_HANDLE;
char *config; char *config;
t_stat status; t_stat status;
@ -407,7 +407,6 @@ if ((strlen(devname) <= 5)
*stat = SCPE_OPENERR; *stat = SCPE_OPENERR;
return port; return port;
} }
savdesc = sim_serial_getdesc_byname (savname, temp2);
} }
else { else {
/* are they trying to use device description? */ /* are they trying to use device description? */
@ -417,11 +416,7 @@ else {
savname = sim_serial_getname_byname(devname, temp1); savname = sim_serial_getname_byname(devname, temp1);
if (savname == NULL) /* didn't translate */ if (savname == NULL) /* didn't translate */
savname = devname; savname = devname;
else
savdesc = sim_serial_getdesc_byname(savname, temp2);
} }
else
savdesc = devname;
} }
port = sim_open_os_serial (savname); port = sim_open_os_serial (savname);
@ -525,7 +520,7 @@ if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "HARDWARE\\DEVICEMAP\\SERIALCOMM", 0, KEY_
DWORD dwDataSize = sizeof(list[ports].name); DWORD dwDataSize = sizeof(list[ports].name);
/* Enumerate all the values underneath HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM */ /* Enumerate all the values underneath HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM */
while (RegEnumValueA(hSERIALCOMM, dwIndex, list[ports].desc, &dwValueNameSize, NULL, &dwType, list[ports].name, &dwDataSize) == ERROR_SUCCESS) { while (RegEnumValueA(hSERIALCOMM, dwIndex, list[ports].desc, &dwValueNameSize, NULL, &dwType, (BYTE *)list[ports].name, &dwDataSize) == ERROR_SUCCESS) {
/* String values with non-zero size are the interesting ones */ /* String values with non-zero size are the interesting ones */
if ((dwType == REG_SZ) && (dwDataSize > 0)) if ((dwType == REG_SZ) && (dwDataSize > 0))
if (ports < max) if (ports < max)

View file

@ -52,6 +52,10 @@ extern FILE *sim_log;
#include <ws2tcpip.h> #include <ws2tcpip.h>
#endif #endif
#ifdef HAVE_DLOPEN
#include <dlfcn.h>
#endif
#ifndef WSAAPI #ifndef WSAAPI
#define WSAAPI #define WSAAPI
#endif #endif
@ -130,18 +134,17 @@ sim_close_sock (s, flg);
return INVALID_SOCKET; return INVALID_SOCKET;
} }
static void (WSAAPI *p_freeaddrinfo) (struct addrinfo *ai); typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo *ai);
static freeaddrinfo_func p_freeaddrinfo;
static int (WSAAPI *p_getaddrinfo) (const char *hostname, typedef int (WSAAPI *getaddrinfo_func) (const char *hostname,
const char *service, const char *service,
const struct addrinfo *hints, const struct addrinfo *hints,
struct addrinfo **res); struct addrinfo **res);
static getaddrinfo_func p_getaddrinfo;
static int (WSAAPI *p_getnameinfo) (const struct sockaddr *sa, socklen_t salen, typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
char *host, size_t hostlen, static getnameinfo_func p_getnameinfo;
char *serv, size_t servlen,
int flags);
static void WSAAPI s_freeaddrinfo (struct addrinfo *ai) static void WSAAPI s_freeaddrinfo (struct addrinfo *ai)
{ {
@ -199,8 +202,6 @@ if (service) {
char *c; char *c;
port = strtoul(service, &c, 10); port = strtoul(service, &c, 10);
if ((port == 0) && (*c != '\0') && (hints->ai_flags & AI_NUMERICSERV))
return EAI_NONAME;
if ((port == 0) || (*c != '\0')) { if ((port == 0) || (*c != '\0')) {
switch (hints->ai_socktype) switch (hints->ai_socktype)
{ {
@ -375,7 +376,11 @@ return 0;
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
/* Dynamic DLL load variables */ /* Dynamic DLL load variables */
#ifdef _WIN32
static HINSTANCE hLib = 0; /* handle to DLL */ static HINSTANCE hLib = 0; /* handle to DLL */
#else
static void *hLib = NULL; /* handle to Library */
#endif
static int lib_loaded = 0; /* 0=not loaded, 1=loaded, 2=library load failed, 3=Func load failed */ static int lib_loaded = 0; /* 0=not loaded, 1=loaded, 2=library load failed, 3=Func load failed */
static char* lib_name = "Ws2_32.dll"; static char* lib_name = "Ws2_32.dll";
@ -383,7 +388,11 @@ static char* lib_name = "Ws2_32.dll";
typedef int (*_func)(); typedef int (*_func)();
static void load_function(char* function, _func* func_ptr) { static void load_function(char* function, _func* func_ptr) {
#ifdef _WIN32
*func_ptr = (_func)GetProcAddress(hLib, function); *func_ptr = (_func)GetProcAddress(hLib, function);
#else
*func_ptr = (_func)dlsym(hLib, function);
#endif
if (*func_ptr == 0) { if (*func_ptr == 0) {
char* msg = "Sockets: Failed to find function '%s' in %s\r\n"; char* msg = "Sockets: Failed to find function '%s' in %s\r\n";
@ -424,9 +433,9 @@ int load_ws2(void) {
if (lib_loaded != 1) { if (lib_loaded != 1) {
/* unsuccessful load, connect stubs */ /* unsuccessful load, connect stubs */
p_getaddrinfo = s_getaddrinfo; p_getaddrinfo = (getaddrinfo_func)s_getaddrinfo;
p_getnameinfo = s_getnameinfo; p_getnameinfo = (getnameinfo_func)s_getnameinfo;
p_freeaddrinfo = s_freeaddrinfo; p_freeaddrinfo = (freeaddrinfo_func)s_freeaddrinfo;
} }
break; break;
default: /* loaded or failed */ default: /* loaded or failed */
@ -574,9 +583,9 @@ if (err != 0)
load_ws2 (); load_ws2 ();
#endif /* endif AF_INET6 */ #endif /* endif AF_INET6 */
#else /* Use native addrinfo APIs */ #else /* Use native addrinfo APIs */
p_getaddrinfo = (void *)getaddrinfo; p_getaddrinfo = (getaddrinfo_func)getaddrinfo;
p_getnameinfo = (void *)getnameinfo; p_getnameinfo = (getnameinfo_func)getnameinfo;
p_freeaddrinfo = (void *)freeaddrinfo; p_freeaddrinfo = (freeaddrinfo_func)freeaddrinfo;
#endif /* endif _WIN32 */ #endif /* endif _WIN32 */
#if defined (SIGPIPE) #if defined (SIGPIPE)
signal (SIGPIPE, SIG_IGN); /* no pipe signals */ signal (SIGPIPE, SIG_IGN); /* no pipe signals */
@ -678,10 +687,12 @@ if (newsock == INVALID_SOCKET) { /* socket error? */
p_freeaddrinfo(result); p_freeaddrinfo(result);
return newsock; return newsock;
} }
#ifdef IPV6_V6ONLY
if (result->ai_family == AF_INET6) { if (result->ai_family == AF_INET6) {
int off = FALSE; int off = FALSE;
sta = setsockopt (newsock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&off, sizeof(off)); sta = setsockopt (newsock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&off, sizeof(off));
} }
#endif
sta = bind (newsock, result->ai_addr, result->ai_addrlen); sta = bind (newsock, result->ai_addr, result->ai_addrlen);
p_freeaddrinfo(result); p_freeaddrinfo(result);
if (sta == SOCKET_ERROR) /* bind error? */ if (sta == SOCKET_ERROR) /* bind error? */