[glib] gsocks5proxy, gsocks4aproxy: simplify some error messages



commit eb45a590fa1c41d5c04cae98313d82146d03051a
Author: Dan Winship <danw gnome org>
Date:   Sun Sep 18 10:49:58 2011 -0400

    gsocks5proxy, gsocks4aproxy: simplify some error messages
    
    There's no need to include the exact max length in the error messages,
    and it makes it look like the strings need to use ngettext() if you do.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=658206

 gio/gsocks4aproxy.c |    9 ++++-----
 gio/gsocks5proxy.c  |   12 +++++-------
 2 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/gio/gsocks4aproxy.c b/gio/gsocks4aproxy.c
index 91ca29d..ff84151 100644
--- a/gio/gsocks4aproxy.c
+++ b/gio/gsocks4aproxy.c
@@ -135,9 +135,8 @@ set_connect_msg (guint8      *msg,
 
       if (user_len > SOCKS4_MAX_LEN)
 	{
-	  g_set_error (error, G_IO_ERROR, G_IO_ERROR_PROXY_FAILED,
-		       _("SOCKSv4 implementation limits username to %i characters"),
-		       SOCKS4_MAX_LEN);
+	  g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_PROXY_FAILED,
+			       _("Username is too long for SOCKSv4 protocol"));
 	  return -1;
 	}
 
@@ -154,8 +153,8 @@ set_connect_msg (guint8      *msg,
       if (host_len > SOCKS4_MAX_LEN)
 	{
 	  g_set_error (error, G_IO_ERROR, G_IO_ERROR_PROXY_FAILED,
-		       _("SOCKSv4a implementation limits hostname to %i characters"),
-		       SOCKS4_MAX_LEN);
+		       _("Hostname '%s' is too long for SOCKSv4 protocol"),
+		       hostname);
 	  return -1;
 	}
 
diff --git a/gio/gsocks5proxy.c b/gio/gsocks5proxy.c
index b4c49a0..f8bad1f 100644
--- a/gio/gsocks5proxy.c
+++ b/gio/gsocks5proxy.c
@@ -204,10 +204,9 @@ set_auth_msg (guint8	  *msg,
 
   if (ulen > SOCKS5_MAX_LEN || plen > SOCKS5_MAX_LEN)
     {
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_PROXY_FAILED,
-		   _("Username or password is too long for SOCKSv5 "
-		     "protocol (max. is %i)."),
-		   SOCKS5_MAX_LEN);
+      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_PROXY_FAILED,
+			   _("Username or password is too long for SOCKSv5 "
+			     "protocol)."));
       return FALSE;
     }
 
@@ -286,9 +285,8 @@ set_connect_msg (guint8       *msg,
       if (host_len > SOCKS5_MAX_LEN)
 	{
 	  g_set_error (error, G_IO_ERROR, G_IO_ERROR_PROXY_FAILED,
-		       _("Hostname '%s' too long for SOCKSv5 protocol "
-			 "(maximum is %i bytes)"),
-		       hostname, SOCKS5_MAX_LEN);
+		       _("Hostname '%s' is too long for SOCKSv5 protocol"),
+		       hostname);
 	  return -1;
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]