X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fresourcemgr.cpp;h=a6f4a5c08ffea17c281bd8ba8ee557bf2779d91c;hb=14adf159fc9eb1212b2e61ea78e94c135abde0fe;hp=c6db5d392af420a6400e8365759a37413a78cedd;hpb=cfd886868fa8595b045007a2ad673c18c5f222b3;p=platform%2Fupstream%2Fdoxygen.git diff --git a/src/resourcemgr.cpp b/src/resourcemgr.cpp index c6db5d3..a6f4a5c 100644 --- a/src/resourcemgr.cpp +++ b/src/resourcemgr.cpp @@ -15,13 +15,14 @@ #include #include -#include +#include #include "resourcemgr.h" #include "util.h" #include "version.h" #include "message.h" #include "config.h" +#include "portable.h" class ResourceMgr::Private { @@ -53,13 +54,12 @@ void ResourceMgr::registerResources(std::initializer_list resources) bool ResourceMgr::writeCategory(const QCString &categoryName,const QCString &targetDir) const { - for (auto &kv : p->resources) + for (auto &[name,res] : p->resources) { - Resource &res = kv.second; if (res.category==categoryName) { - std::string pathName = targetDir.str()+"/"+res.name; - std::ofstream f(pathName,std::ofstream::out | std::ofstream::binary); + QCString pathName = targetDir+"/"+res.name; + std::ofstream f = Portable::openOutputStream(pathName); bool ok=false; if (f.is_open()) { @@ -78,9 +78,7 @@ bool ResourceMgr::writeCategory(const QCString &categoryName,const QCString &tar bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir,const QCString &targetName,bool append) const { - std::string pathName = targetDir.str()+"/"+targetName.str(); - std::ios_base::openmode mode = std::ofstream::out | std::ofstream::binary; - if (append) mode |= std::ofstream::app; + QCString pathName = targetDir+"/"+targetName; const Resource *res = get(name); if (res) { @@ -88,7 +86,7 @@ bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir, { case Resource::Verbatim: { - std::ofstream f(pathName,mode); + std::ofstream f = Portable::openOutputStream(pathName,append); bool ok=false; if (f.is_open()) { @@ -105,9 +103,9 @@ bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir, { QCString n = name; n = n.left(n.length()-4)+".png"; // replace .lum by .png - const uchar *data = res->data; - ushort width = (data[0]<<8)+data[1]; - ushort height = (data[2]<<8)+data[3]; + const uint8_t *data = res->data; + uint16_t width = (data[0]<<8)+data[1]; + uint16_t height = (data[2]<<8)+data[3]; ColoredImgDataItem images[2]; images[0].name = n.data(); images[0].width = width; @@ -123,9 +121,9 @@ bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir, { QCString n = name; n = n.left(n.length()-5)+".png"; // replace .luma by .png - const uchar *data = res->data; - ushort width = (data[0]<<8)+data[1]; - ushort height = (data[2]<<8)+data[3]; + const uint8_t *data = res->data; + uint16_t width = (data[0]<<8)+data[1]; + uint16_t height = (data[2]<<8)+data[3]; ColoredImgDataItem images[2]; images[0].name = n.data(); images[0].width = width; @@ -139,7 +137,7 @@ bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir, break; case Resource::CSS: { - std::ofstream t(pathName,mode); + std::ofstream t = Portable::openOutputStream(pathName,append); if (t.is_open()) { QCString buf(res->size+1); @@ -159,7 +157,7 @@ bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir, break; case Resource::SVG: { - std::ofstream t(pathName,mode); + std::ofstream t = Portable::openOutputStream(pathName,append); if (t.is_open()) { QCString buf(res->size+1);