Difference for socket/lowlevel.c from version 1.13 to 1.14


version 1.13 version 1.14
Line 1
 
Line 1
   
 /*  /*
  * static char *rcsid_sockets_c =   * static char *rcsid_sockets_c =
  *    "$Id: lowlevel.c,v 1.13 2006/03/18 15:05:37 ryo_saeba Exp $";   *    "$Id: lowlevel.c,v 1.14 2006/03/19 01:51:46 akirschbaum Exp $";
  */   */
   
 /*  /*
Line 92
 
Line 92
  * Basically does the reverse of SockList_AddInt, but on   * Basically does the reverse of SockList_AddInt, but on
  * strings instead.  Same for the GetShort, but for 16 bits.   * strings instead.  Same for the GetShort, but for 16 bits.
  */   */
 int GetInt_String(unsigned char *data)  int GetInt_String(const unsigned char *data)
 {  {
     return ((data[0]<<24) + (data[1]<<16) + (data[2]<<8) + data[3]);      return ((data[0]<<24) + (data[1]<<16) + (data[2]<<8) + data[3]);
 }  }
   
 short GetShort_String(unsigned char *data) {  short GetShort_String(const unsigned char *data) {
     return ((data[0]<<8)+data[1]);      return ((data[0]<<8)+data[1]);
 }  }
   
Line 240
 
Line 240
  * data, and len is the number of bytes to add.   * data, and len is the number of bytes to add.
  */   */
   
 static void add_to_buffer(socket_struct *ns, unsigned char *buf, int len)  static void add_to_buffer(socket_struct *ns, const unsigned char *buf, int len)
 {  {
     int avail, end;      int avail, end;
   
Line 340
 
Line 340
  * of bytes to write.  IT doesn't return anything - rather, it   * of bytes to write.  IT doesn't return anything - rather, it
  * updates the ns structure if we get an  error.   * updates the ns structure if we get an  error.
  */   */
 void Write_To_Socket(socket_struct *ns, unsigned char *buf, int len)  static void Write_To_Socket(socket_struct *ns, const unsigned char *buf, int len)
 {  {
     int amt=0;      int amt=0;
     unsigned char *pos=buf;      const unsigned char *pos=buf;
   
     if (ns->status == Ns_Dead || !buf) {      if (ns->status == Ns_Dead || !buf) {
  LOG(llevDebug,"Write_To_Socket called with dead socket\n");   LOG(llevDebug,"Write_To_Socket called with dead socket\n");
Line 422
 
Line 422
  * The only difference in this function is that we take a SockList   * The only difference in this function is that we take a SockList
  *, and we prepend the length information.   *, and we prepend the length information.
  */   */
 void Send_With_Handling(socket_struct *ns,SockList  *msg)  void Send_With_Handling(socket_struct *ns, const SockList *msg)
 {  {
     unsigned char sbuf[4];      unsigned char sbuf[4];
   
Line 448
 
Line 448
  * Takes a string of data, and writes it out to the socket. A very handy   * Takes a string of data, and writes it out to the socket. A very handy
  * shortcut function.   * shortcut function.
  */   */
 void Write_String_To_Socket(socket_struct *ns, char *buf, int len)  void Write_String_To_Socket(socket_struct *ns, const char *buf, int len)
 {  {
     SockList sl;      SockList sl;
   
     sl.len = len;      sl.len = len;
     sl.buf = (uint8*)buf;      sl.buf = (unsigned char *)buf;
     Send_With_Handling(ns, &sl);      Send_With_Handling(ns, &sl);
 }  }
   


Legend:
line(s) removed in v.1.13 
line(s) changed
 line(s) added in v.1.14

File made using version 1.98 of cvs2html by leaf at 2011-07-21 19:36