/[winpt]/trunk/Src/wptGPGMEData.cpp
ViewVC logotype

Diff of /trunk/Src/wptGPGMEData.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 270 by twoaday, Fri Jul 21 08:19:24 2006 UTC revision 271 by twoaday, Sun Nov 5 08:57:45 2006 UTC
# Line 29  Line 29 
29    
30  #include "wptUtil.h"  #include "wptUtil.h"
31  #include "wptGPG.h"  #include "wptGPG.h"
32    #include "wptTypes.h"
33    
34    /* Default buffer size */
35    #define BUFSIZE 128
36    
37    
38  /* Implement a word based line break. @inp is the input buffer  /* Implement a word based line break. @inp is the input buffer
# Line 129  gpgme_error_t Line 133  gpgme_error_t
133  gpg_data_mail_quote (gpgme_data_t *r_dh)  gpg_data_mail_quote (gpgme_data_t *r_dh)
134  {  {
135      gpgme_data_t dh;      gpgme_data_t dh;
136      char buf[128];      char buf[BUFSIZE+1];
137    
138      if (!*r_dh)      if (!*r_dh)
139          return gpg_error (GPG_ERR_INV_ARG);          return gpg_error (GPG_ERR_INV_ARG);
140      gpgme_data_new (&dh);      gpgme_data_new (&dh);
141      while (gpg_data_readline (*r_dh, buf, sizeof (buf)-1)) {      while (gpg_data_readline (*r_dh, buf, DIM (buf)-1)) {
142          gpgme_data_write (dh, "> ", 2);          gpgme_data_write (dh, "> ", 2);
143          gpgme_data_write (dh, buf, strlen (buf));          gpgme_data_write (dh, buf, strlen (buf));
144      }      }
# Line 173  gpg_data_extract_plaintext (gpgme_data_t Line 177  gpg_data_extract_plaintext (gpgme_data_t
177  {  {
178      gpgme_data_t plain;      gpgme_data_t plain;
179      gpgme_error_t err;      gpgme_error_t err;
180      char line[128+32];      char line[BUFSIZE+32];
181      int pos = 0;      int pos = 0;
182            
183      if (r_plain)      if (r_plain)
# Line 182  gpg_data_extract_plaintext (gpgme_data_t Line 186  gpg_data_extract_plaintext (gpgme_data_t
186      if (err)      if (err)
187          return err;          return err;
188            
189      while (gpg_data_readline (sig, line, 128) > 0) {      while (gpg_data_readline (sig, line, BUFSIZE) > 0) {
190          if (!strncmp (line, "-----BEGIN PGP SIGNED MESSAGE", 29) ||          if (!strncmp (line, "-----BEGIN PGP SIGNED MESSAGE", 29) ||
191              is_armor_header (line))              is_armor_header (line))
192              continue;              continue;
# Line 191  gpg_data_extract_plaintext (gpgme_data_t Line 195  gpg_data_extract_plaintext (gpgme_data_t
195      }      }
196    
197      /* We just support 1 nesting level. */      /* We just support 1 nesting level. */
198      while (gpg_data_readline (sig, line, 128) > 0 ) {      while (gpg_data_readline (sig, line, BUFSIZE) > 0 ) {
199          if (!strncmp (line, "-----BEGIN PGP SIGNATURE", 24))          if (!strncmp (line, "-----BEGIN PGP SIGNATURE", 24))
200              break; /* end of plaintext */              break; /* end of plaintext */
201          if (!strncmp (line, "- -", 3))          if (!strncmp (line, "- -", 3))

Legend:
Removed from v.270  
changed lines
  Added in v.271

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26