engine: Work around VAPI binding change causing GMime API break

See https://github.com/jstedfast/gmime/pull/101
This commit is contained in:
Michael Gratton 2021-04-21 09:11:59 +10:00 committed by Michael James Gratton
parent d17554d30f
commit 7f155f87ac
2 changed files with 16 additions and 4 deletions

View file

@ -60,15 +60,23 @@ namespace Geary.Stream {
return this.written;
}
#if GMIME_STREAM_WRITE_STRING
public override ssize_t write(string buf, size_t len) {
ssize_t ret = -1;
try {
ret = this.dest.write(buf.data[0:len]);
this.written += len;
} catch (IOError err) {
// Oh well
var ret = this.dest.write(buf.data[0:len]);
#else
public override ssize_t write(uint8[] buf) {
try {
var ret = this.dest.write(buf);
#endif
if (ret > 0) {
this.written += ret;
}
return ret;
} catch (IOError err) {
// Oh well
return -1;
}
}
public override int close() {

View file

@ -39,6 +39,10 @@ if get_option('ref_tracking').enabled()
vala_defines += [ '--define=REF_TRACKING' ]
endif
if gmime.version().version_compare('<=3.2.7')
vala_defines += [ '--define=GMIME_STREAM_WRITE_STRING' ]
endif
geary_vala_args += vala_defines
# Common cc options