gsocks5proxy, gsocks4aproxy: simplify some error messages
authorDan Winship <danw@gnome.org>
Sun, 18 Sep 2011 14:49:58 +0000 (10:49 -0400)
committerDan Winship <danw@gnome.org>
Sun, 18 Sep 2011 14:49:58 +0000 (10:49 -0400)
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
gio/gsocks5proxy.c

index 91ca29d..ff84151 100644 (file)
@@ -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;
        }
 
index b4c49a0..f8bad1f 100644 (file)
@@ -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;
        }