From 75ce10539fd509650ecfb62fbfeab49839bb2a3e Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Mon, 22 Jun 2015 14:35:47 -0400 Subject: [PATCH] introduced Template::writeUniversalTemplate --- openbr/openbr_plugin.cpp | 7 +++++++ openbr/openbr_plugin.h | 1 + 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index 9919cb9..f7b9c78 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -451,6 +451,13 @@ br_utemplate Template::readUniversalTemplate(QFile &file) return t; } +void Template::writeUniversalTemplate(QFile &file, br_const_utemplate t) +{ + const qint64 size = sizeof(br_universal_template) + t->mdSize + t->fvSize; + if (file.write((const char *) t, size) != size) + qFatal("Failed to write universal template!"); +} + void Template::freeUniversalTemplate(br_const_utemplate t) { free((void*) t); diff --git a/openbr/openbr_plugin.h b/openbr/openbr_plugin.h index 9bc036e..828227f 100644 --- a/openbr/openbr_plugin.h +++ b/openbr/openbr_plugin.h @@ -297,6 +297,7 @@ struct Template : public QList static br_utemplate toUniversalTemplate(const Template &t); static Template fromUniversalTemplate(br_const_utemplate ut); static br_utemplate readUniversalTemplate(QFile &file); + static void writeUniversalTemplate(QFile &file, br_const_utemplate t); static void freeUniversalTemplate(br_const_utemplate t); }; -- libgit2 0.21.4