]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - raw.c
Giant const-correctness patch of doom!
[PuTTY.git] / raw.c
diff --git a/raw.c b/raw.c
index 698d7e4f813f83103418da57dd89cd1198b1d918..b083d09d59a572c885470b13911b26438b85722b 100644 (file)
--- a/raw.c
+++ b/raw.c
@@ -50,6 +50,7 @@ static void raw_log(Plug plug, int type, SockAddr addr, int port,
        msg = dupprintf("Failed to connect to %s: %s", addrbuf, error_msg);
 
     logevent(raw->frontend, msg);
+    sfree(msg);
 }
 
 static void raw_check_close(Raw raw)
@@ -124,8 +125,8 @@ static void raw_sent(Plug plug, int bufsize)
  */
 static const char *raw_init(void *frontend_handle, void **backend_handle,
                            Conf *conf,
-                           char *host, int port, char **realhost, int nodelay,
-                           int keepalive)
+                           const char *host, int port, char **realhost,
+                            int nodelay, int keepalive)
 {
     static const struct plug_function_table fn_table = {
        raw_log,
@@ -145,6 +146,7 @@ static const char *raw_init(void *frontend_handle, void **backend_handle,
     raw->closed_on_socket_error = FALSE;
     *backend_handle = raw;
     raw->sent_console_eof = raw->sent_socket_eof = FALSE;
+    raw->bufsize = 0;
 
     raw->frontend = frontend_handle;
 
@@ -184,15 +186,10 @@ static const char *raw_init(void *frontend_handle, void **backend_handle,
 
        sfree(*realhost);
        *realhost = dupstr(loghost);
-       colon = strrchr(*realhost, ':');
-       if (colon) {
-           /*
-            * FIXME: if we ever update this aspect of ssh.c for
-            * IPv6 literal management, this should change in line
-            * with it.
-            */
+
+       colon = host_strrchr(*realhost, ':');
+       if (colon)
            *colon++ = '\0';
-       }
     }
 
     return NULL;
@@ -217,7 +214,7 @@ static void raw_reconfig(void *handle, Conf *conf)
 /*
  * Called to send data down the raw connection.
  */
-static int raw_send(void *handle, char *buf, int len)
+static int raw_send(void *handle, const char *buf, int len)
 {
     Raw raw = (Raw) handle;