Use gpgrt_asprintf
authorAndre Heinecke <aheinecke@intevation.de>
Fri, 13 Nov 2015 16:18:28 +0000 (17:18 +0100)
committerAndre Heinecke <aheinecke@intevation.de>
Fri, 13 Nov 2015 16:18:28 +0000 (17:18 +0100)
* src/attachment.cpp (do_crypt), src/gpgoladdin.cpp (GetCustomUI):
  Use gpgrt_asprintf.

--
We link libgpg-error anyway so let's make use of it. Fixes
the build on debian wheezy

src/attachment.cpp
src/gpgoladdin.cpp

index 66588d5..2043658 100644 (file)
@@ -27,6 +27,7 @@
 #include "mapihelp.h"
 
 #include <objidlbase.h>
+#include <gpg-error.h>
 
 #define COPYBUFFERSIZE 4096
 
@@ -280,7 +281,7 @@ do_crypt (LPDISPATCH mailitem, bool protect)
       LPATTACH mapi_attachment;
       attachtype_t att_type;
 
-      if (asprintf (&item_str, "Item(%i)", i) == -1)
+      if (gpgrt_asprintf (&item_str, "Item(%i)", i) == -1)
         {
           log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
           goto done;
index 8b03782..269c2af 100644 (file)
@@ -50,6 +50,8 @@
 #include "windowmessages.h"
 #include "mail.h"
 
+#include <gpg-error.h>
+
 #define ICON_SIZE_LARGE  32
 #define ICON_SIZE_NORMAL 16
 
@@ -598,7 +600,7 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
 
   if (!wcscmp (RibbonID, L"Microsoft.Outlook.Mail.Compose"))
     {
-      asprintf (&buffer,
+      gpgrt_asprintf (&buffer,
         "<customUI xmlns=\"http://schemas.microsoft.com/office/2009/07/customui\">"
         " <ribbon>"
         "   <tabs>"
@@ -712,7 +714,7 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
   if (!wcscmp (RibbonID, L"Microsoft.Outlook.Mail.Compose"))
     {
       TRACEPOINT
-      asprintf (&buffer,
+      gpgrt_asprintf (&buffer,
         "<customUI xmlns=\"http://schemas.microsoft.com/office/2009/07/customui\">"
         " <ribbon>"
         "   <tabs>"
@@ -805,7 +807,7 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
   else if (!wcscmp (RibbonID, L"Microsoft.Outlook.Mail.Read"))
     {
       TRACEPOINT
-      asprintf (&buffer,
+      gpgrt_asprintf (&buffer,
         "<customUI xmlns=\"http://schemas.microsoft.com/office/2009/07/customui\">"
         " <ribbon>"
         "   <tabs>"
@@ -879,7 +881,7 @@ GpgolRibbonExtender::GetCustomUI (BSTR RibbonID, BSTR * RibbonXml)
   else if (!wcscmp (RibbonID, L"Microsoft.Outlook.Explorer"))
     {
       TRACEPOINT
-      asprintf (&buffer,
+      gpgrt_asprintf (&buffer,
         "<customUI xmlns=\"http://schemas.microsoft.com/office/2009/07/customui\">"
         " <ribbon>"
         "   <tabs>"