Line
Link Here
|
0 |
-- gpgme-1.8.0/lang/cpp/src/data.cpp |
0 |
++ gpgme-1.8.0-gcc4/lang/cpp/src/data.cpp |
Lines 26-31
Link Here
|
26 |
|
26 |
|
27 |
#include "data_p.h" |
27 |
#include "data_p.h" |
28 |
#include <error.h> |
28 |
#include <error.h> |
|
|
29 |
#include <stdio.h> |
29 |
#include <interfaces/dataprovider.h> |
30 |
#include <interfaces/dataprovider.h> |
30 |
|
31 |
|
31 |
#include <gpgme.h> |
32 |
#include <gpgme.h> |
Lines 66-74
GpgME::Data::Data(const char *buffer, si
Link Here
|
66 |
{ |
67 |
{ |
67 |
gpgme_data_t data; |
68 |
gpgme_data_t data; |
68 |
const gpgme_error_t e = gpgme_data_new_from_mem(&data, buffer, size, int(copy)); |
69 |
const gpgme_error_t e = gpgme_data_new_from_mem(&data, buffer, size, int(copy)); |
69 |
std::string sizestr = std::to_string(size); |
70 |
char sizestr[22]; |
|
|
71 |
snprintf(sizestr, 22, "%lu", size); |
70 |
// Ignore errors as this is optional |
72 |
// Ignore errors as this is optional |
71 |
gpgme_data_set_flag(data, "size-hint", sizestr.c_str()); |
73 |
gpgme_data_set_flag(data, "size-hint", sizestr); |
72 |
d.reset(new Private(e ? 0 : data)); |
74 |
d.reset(new Private(e ? 0 : data)); |
73 |
} |
75 |
} |
74 |
|
76 |
|
Lines 135-143
GpgME::Data::Data(DataProvider *dp)
Link Here
|
135 |
if (dp->isSupported(DataProvider::Seek)) { |
137 |
if (dp->isSupported(DataProvider::Seek)) { |
136 |
off_t size = seek(0, SEEK_END); |
138 |
off_t size = seek(0, SEEK_END); |
137 |
seek(0, SEEK_SET); |
139 |
seek(0, SEEK_SET); |
138 |
std::string sizestr = std::to_string(size); |
140 |
char sizestr[22]; |
|
|
141 |
snprintf(sizestr, 22, "%lu", size); |
139 |
// Ignore errors as this is optional |
142 |
// Ignore errors as this is optional |
140 |
gpgme_data_set_flag(d->data, "size-hint", sizestr.c_str()); |
143 |
gpgme_data_set_flag(d->data, "size-hint", sizestr); |
141 |
} |
144 |
} |
142 |
#ifndef NDEBUG |
145 |
#ifndef NDEBUG |
143 |
//std::cerr << "GpgME::Data(): DataProvider supports: " |
146 |
//std::cerr << "GpgME::Data(): DataProvider supports: " |
144 |
-- gpgme-1.8.0/lang/cpp/src/engineinfo.h |
147 |
++ gpgme-1.8.0-gcc4/lang/cpp/src/engineinfo.h |
Lines 30-35
Link Here
|
30 |
#include <algorithm> |
30 |
#include <algorithm> |
31 |
#include <string> |
31 |
#include <string> |
32 |
#include <iostream> |
32 |
#include <iostream> |
|
|
33 |
#include <stdio.h> |
33 |
|
34 |
|
34 |
namespace GpgME |
35 |
namespace GpgME |
35 |
{ |
36 |
{ |
Lines 50-56
public:
Link Here
|
50 |
Version(const std::string& version) |
51 |
Version(const std::string& version) |
51 |
{ |
52 |
{ |
52 |
if (version.empty() || |
53 |
if (version.empty() || |
53 |
std::sscanf(version.c_str(), "%d.%d.%d", &major, &minor, &patch) != 3) { |
54 |
sscanf(version.c_str(), "%d.%d.%d", &major, &minor, &patch) != 3) { |
54 |
major = 0; |
55 |
major = 0; |
55 |
minor = 0; |
56 |
minor = 0; |
56 |
patch = 0; |
57 |
patch = 0; |
Lines 60-66
public:
Link Here
|
60 |
Version(const char *version) |
61 |
Version(const char *version) |
61 |
{ |
62 |
{ |
62 |
if (!version || |
63 |
if (!version || |
63 |
std::sscanf(version, "%d.%d.%d", &major, &minor, &patch) != 3) { |
64 |
sscanf(version, "%d.%d.%d", &major, &minor, &patch) != 3) { |
64 |
major = 0; |
65 |
major = 0; |
65 |
minor = 0; |
66 |
minor = 0; |
66 |
patch = 0; |
67 |
patch = 0; |