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); };