a whole lot of size_t -> ssize_t.
[apps/madmutt.git] / rfc1524.c
index 6c6d317..bc954c7 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -69,7 +69,7 @@ int rfc1524_expand_command (BODY * a, char *filename, char *_type,
   if (option (OPTMAILCAPSANITIZE))
     mutt_sanitize_filename (type, 0);
 
-  while (command[x] && x < clen && y < sizeof (buf)) {
+  while (command[x] && x < clen && y < ssizeof (buf)) {
     if (command[x] == '\\') {
       x++;
       buf[y++] = command[x++];
@@ -83,7 +83,7 @@ int rfc1524_expand_command (BODY * a, char *filename, char *_type,
         int z = 0;
 
         x++;
-        while (command[x] && command[x] != '}' && z < sizeof (param))
+        while (command[x] && command[x] != '}' && z < ssizeof (param))
           param[z++] = command[x++];
         param[z] = '\0';
 
@@ -161,7 +161,7 @@ static int rfc1524_mailcap_parse (BODY * a,
 {
   FILE *fp;
   char *buf = NULL;
-  size_t buflen;
+  ssize_t buflen;
   char *ch;
   char *field;
   int found = FALSE;
@@ -189,7 +189,7 @@ static int rfc1524_mailcap_parse (BODY * a,
   btlen = ch - type;
 
   if ((fp = fopen (filename, "r")) != NULL) {
-    while (!found && (buf = mutt_read_line (buf, &buflen, fp, &line)) != NULL) {
+    while (!found && (buf = mutt_read_line(buf, &buflen, fp, &line)) != NULL) {
       /* ignore comments */
       if (*buf == '#')
         continue;
@@ -265,7 +265,7 @@ static int rfc1524_mailcap_parse (BODY * a,
            * if this is the right entry.
            */
           char *test_command = NULL;
-          size_t len;
+          ssize_t len;
 
           if (get_field_text (field + 4, &test_command, type, filename, line)
               && test_command) {
@@ -368,7 +368,7 @@ int rfc1524_mailcap_lookup (BODY * a, char *type, rfc1524_entry * entry,
 
   while (!found && *curr) {
     x = 0;
-    while (*curr && *curr != ':' && x < sizeof (path) - 1) {
+    while (*curr && *curr != ':' && x < ssizeof (path) - 1) {
       path[x++] = *curr;
       curr++;
     }
@@ -403,15 +403,8 @@ int rfc1524_mailcap_lookup (BODY * a, char *type, rfc1524_entry * entry,
  * Returns 1 if newfile specified
  */
 
-static void strnfcpy (char *d, char *s, size_t siz, size_t len)
-{
-  if (len > siz)
-    len = siz - 1;
-  m_strcpy(d, len, s);
-}
-
 int rfc1524_expand_filename (char *nametemplate,
-                             char *oldfile, char *newfile, size_t nflen)
+                             char *oldfile, char *newfile, ssize_t nflen)
 {
   int i, j, k, ps, r;
   char *s;
@@ -494,7 +487,7 @@ int rfc1524_expand_filename (char *nametemplate,
       if (lmatch)
         *left = 0;
       else
-        strnfcpy (left, nametemplate, sizeof (left), i);
+        m_strncpy(left, sizeof(left), nametemplate, i);
 
       if (rmatch)
         *right = 0;