]> git.ipfire.org Git - thirdparty/git.git/blobdiff - imap-send.c
l10n: zh_CN: Revision for git v2.32.0 l10n round 1
[thirdparty/git.git] / imap-send.c
index bb085d66d10509214eae1994e430d6058955f7cf..a0540ba5cf43e5af6c749f8c1bc7b06a7ff222ad 100644 (file)
@@ -451,6 +451,7 @@ static int buffer_gets(struct imap_buffer *b, char **s)
        /* not reached */
 }
 
+__attribute__((format (printf, 1, 2)))
 static void imap_info(const char *msg, ...)
 {
        va_list va;
@@ -463,6 +464,7 @@ static void imap_info(const char *msg, ...)
        }
 }
 
+__attribute__((format (printf, 1, 2)))
 static void imap_warn(const char *msg, ...)
 {
        va_list va;
@@ -504,6 +506,7 @@ static char *next_arg(char **s)
        return ret;
 }
 
+__attribute__((format (printf, 3, 4)))
 static int nfsnprintf(char *buf, int blen, const char *fmt, ...)
 {
        int ret;
@@ -1266,18 +1269,6 @@ static void wrap_in_html(struct strbuf *msg)
        *msg = buf;
 }
 
-#define CHUNKSIZE 0x1000
-
-static int read_message(FILE *f, struct strbuf *all_msgs)
-{
-       do {
-               if (strbuf_fread(all_msgs, CHUNKSIZE, f) <= 0)
-                       break;
-       } while (!feof(f));
-
-       return ferror(f) ? -1 : 0;
-}
-
 static int count_messages(struct strbuf *all_msgs)
 {
        int count = 0;
@@ -1582,8 +1573,8 @@ int cmd_main(int argc, const char **argv)
        }
 
        /* read the messages */
-       if (read_message(stdin, &all_msgs)) {
-               fprintf(stderr, "error reading input\n");
+       if (strbuf_read(&all_msgs, 0, 0) < 0) {
+               error_errno(_("could not read from stdin"));
                return 1;
        }