Browse Source

ipc.c and ipcsockets.c, swallow type conversion warnings

rlar 15 years ago
parent
commit
828e04c9fd
  1. 7
      ChangeLog
  2. 19
      src/xspice/ipc/ipc.c
  3. 16
      src/xspice/ipc/ipcsockets.c

7
ChangeLog

@ -1,6 +1,11 @@
2011-06-25 Robert Larice
* src/xspice/ipc/ipc.c ,
* src/xspice/ipc/ipcsockets.c :
ipc.c and ipcsockets.c, swallow type conversion warnings
2011-06-25 Robert Larice 2011-06-25 Robert Larice
* src/frontend/plotting/graf.c : * src/frontend/plotting/graf.c :
graf.c, swallow type conversion warning
graf.c, swallow type conversion warnings
2011-06-25 Holger Vogt 2011-06-25 Holger Vogt
* main.c, defines.h: improved shutdown message for Windows GUI * main.c, defines.h: improved shutdown message for Windows GUI

19
src/xspice/ipc/ipc.c

@ -394,7 +394,7 @@ ipc_flush (void)
/* write the records to the .log file */ /* write the records to the .log file */
if ((end_of_record_index [i] - last) != if ((end_of_record_index [i] - last) !=
write (batch_fd, &out_buffer[last], end_of_record_index [i] - last)) {
write (batch_fd, &out_buffer[last], (size_t) (end_of_record_index [i] - last))) {
/* fprintf (stderr,"ERROR: IPC: Error writing to batch output file\n"); */ /* fprintf (stderr,"ERROR: IPC: Error writing to batch output file\n"); */
perror ("IPC"); perror ("IPC");
return IPC_STATUS_ERROR; return IPC_STATUS_ERROR;
@ -813,11 +813,10 @@ stuff_binary_v1 (
if (n > 1) { if (n > 1) {
trick.float_val[1] = (float)d2; trick.float_val[1] = (float)d2;
} }
for (i = 0, j = pos; i < n*sizeof(float); j++, i++)
for (i = 0, j = pos; i < n * (int) sizeof(float); j++, i++)
buf[j] = trick.ch[i]; buf[j] = trick.ch[i];
i = sizeof(float)*n + pos;
buf[0] = 'A' + i - 1;
return i;
buf[0] = (char) ('A' + j - 1);
return j;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -847,7 +846,7 @@ ipc_send_double (
/* If talking to Mentor tools, must force upper case for Mspice 7.0 */ /* If talking to Mentor tools, must force upper case for Mspice 7.0 */
strtoupper(fmt_buffer); strtoupper(fmt_buffer);
len = stuff_binary_v1 (value, 0.0, 1, fmt_buffer, strlen(fmt_buffer));
len = stuff_binary_v1 (value, 0.0, 1, fmt_buffer, (int) strlen(fmt_buffer));
break; break;
case IPC_PROTOCOL_V2: case IPC_PROTOCOL_V2:
break; break;
@ -883,7 +882,7 @@ ipc_send_complex (
strtoupper(fmt_buffer); strtoupper(fmt_buffer);
len = stuff_binary_v1 (value.real, value.imag, 2, fmt_buffer, len = stuff_binary_v1 (value.real, value.imag, 2, fmt_buffer,
strlen(fmt_buffer));
(int) strlen(fmt_buffer));
break; break;
case IPC_PROTOCOL_V2: case IPC_PROTOCOL_V2:
break; break;
@ -922,7 +921,7 @@ ipc_send_event (
float fvalue; float fvalue;
/* Report error if size of data is too big for IPC channel block size */ /* Report error if size of data is too big for IPC channel block size */
if((len + strlen(print_val) + 100) >= OUT_BUFFER_SIZE) {
if((len + (int) strlen(print_val) + 100) >= OUT_BUFFER_SIZE) {
printf("ERROR - Size of event-driven data too large for IPC channel\n"); printf("ERROR - Size of event-driven data too large for IPC channel\n");
return IPC_STATUS_ERROR; return IPC_STATUS_ERROR;
} }
@ -970,8 +969,8 @@ ipc_send_event (
/* Put the print value in */ /* Put the print value in */
strcpy(buff_ptr, print_val); strcpy(buff_ptr, print_val);
buff_ptr += strlen(print_val);
buff_len += strlen(print_val);
buff_ptr += strlen(print_val);
buff_len += (int) strlen(print_val);
/* Send the data to the IPC channel */ /* Send the data to the IPC channel */
return ipc_send_line_binary(buff, buff_len); return ipc_send_line_binary(buff, buff_len);

16
src/xspice/ipc/ipcsockets.c

@ -169,7 +169,7 @@ ipc_transport_initialize_server (
{ {
struct sockaddr_in server; /* Server specifications for socket*/ struct sockaddr_in server; /* Server specifications for socket*/
unsigned int server_length; /* Size of server structure */ unsigned int server_length; /* Size of server structure */
unsigned int port_num; /* Port number converted from server_name */
int port_num; /* Port number converted from server_name */
NG_IGNORE(mode); NG_IGNORE(mode);
NG_IGNORE(protocol); NG_IGNORE(protocol);
@ -296,7 +296,7 @@ bytes_to_integer (
it in the variable u. */ it in the variable u. */
index = 0; index = 0;
while (index < sizeof(u)) {
while (index < (int) sizeof(u)) {
buff[index] = str[index+start]; buff[index] = str[index+start];
index++; index++;
} }
@ -412,7 +412,7 @@ read_sock (
/* buffer[count] = 'x'; */ /* buffer[count] = 'x'; */
/* count++; */ /* count++; */
/* } */ /* } */
count = read (stream, buffer, length);
count = (int) read (stream, buffer, (size_t) length);
if (wait == IPC_NO_WAIT) { if (wait == IPC_NO_WAIT) {
fcntl (stream, F_SETFL, flags); /* Revert to blocking read */ fcntl (stream, F_SETFL, flags); /* Revert to blocking read */
} }
@ -425,7 +425,7 @@ read_sock (
buf2 = &buffer[totalcount]; buf2 = &buffer[totalcount];
length = length - count; length = length - count;
while (length > 0) { while (length > 0) {
count = read (stream, buf2, length);
count = (int) read (stream, buf2, (size_t) length);
if (count <= 0) /* EOF or read error */ if (count <= 0) /* EOF or read error */
break; break;
totalcount = totalcount + count; totalcount = totalcount + count;
@ -558,7 +558,7 @@ ipc_transport_get_line (
"ERROR: IPC: Did not find beginning of message header (%c)\n", "ERROR: IPC: Did not find beginning of message header (%c)\n",
str[0]); str[0]);
return IPC_STATUS_ERROR; return IPC_STATUS_ERROR;
} else if ((message_length = bytes_to_integer (str, 1)) == -1) {
} else if ((message_length = (int) bytes_to_integer (str, 1)) == -1) {
/* fprintf (stderr, "WARNING: IPC: Reached eof on socket\n"); */ /* fprintf (stderr, "WARNING: IPC: Reached eof on socket\n"); */
return handle_socket_eof (); return handle_socket_eof ();
} else if (message_length == 0) { } else if (message_length == 0) {
@ -660,19 +660,19 @@ ipc_transport_send_line (
/* Write message body header with length: */ /* Write message body header with length: */
hdr_buff[0] = BOL_CHAR; hdr_buff[0] = BOL_CHAR;
u = htonl (len);
u = htonl ((u_long) len);
char_ptr = (char *) &u; char_ptr = (char *) &u;
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
hdr_buff[i+1] = char_ptr[i]; hdr_buff[i+1] = char_ptr[i];
count = write (msg_stream, hdr_buff, 5);
count = (int) write (msg_stream, hdr_buff, 5);
if (count != 5) { if (count != 5) {
fprintf (stderr, "ERROR: IPC: (%d) send line error 1\n", count); fprintf (stderr, "ERROR: IPC: (%d) send line error 1\n", count);
return IPC_STATUS_ERROR; return IPC_STATUS_ERROR;
} }
/* Write message body: */ /* Write message body: */
count = write (msg_stream, str, len);
count = (int) write (msg_stream, str, (size_t) len);
if (count != len) { if (count != len) {
fprintf (stderr, "ERROR: IPC: (%d) send line error 2\n", count); fprintf (stderr, "ERROR: IPC: (%d) send line error 2\n", count);
return IPC_STATUS_ERROR; return IPC_STATUS_ERROR;

Loading…
Cancel
Save