aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2020-06-27 13:20:16 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2020-06-27 13:20:16 +0200
commit7a95629aff3fac96067fba8cddd9743289dcca2d (patch)
tree4641ec8fe70262e880fab18d905b2d6e6989d7b3 /common
parent901ad4e91782575e2121b5122c68445c02ded879 (diff)
downloadnextpnr-7a95629aff3fac96067fba8cddd9743289dcca2d.tar.gz
nextpnr-7a95629aff3fac96067fba8cddd9743289dcca2d.tar.bz2
nextpnr-7a95629aff3fac96067fba8cddd9743289dcca2d.zip
Fix clangformat and execute it
Diffstat (limited to 'common')
-rw-r--r--common/embed.cc13
-rw-r--r--common/embed.h3
2 files changed, 9 insertions, 7 deletions
diff --git a/common/embed.cc b/common/embed.cc
index f8f439b5..70bbc6fb 100644
--- a/common/embed.cc
+++ b/common/embed.cc
@@ -1,16 +1,17 @@
#if defined(WIN32)
#include <windows.h>
#endif
-#include <boost/iostreams/device/mapped_file.hpp>
#include <boost/filesystem.hpp>
-#include "nextpnr.h"
+#include <boost/iostreams/device/mapped_file.hpp>
#include "embed.h"
+#include "nextpnr.h"
NEXTPNR_NAMESPACE_BEGIN
#if defined(EXTERNAL_CHIPDB_ROOT)
-const void *get_chipdb(const std::string &filename) {
+const void *get_chipdb(const std::string &filename)
+{
static std::map<std::string, boost::iostreams::mapped_file> files;
if (!files.count(filename)) {
std::string full_filename = EXTERNAL_CHIPDB_ROOT "/" + filename;
@@ -24,7 +25,8 @@ const void *get_chipdb(const std::string &filename) {
#elif defined(WIN32)
-const void *get_chipdb(const std::string &filename) {
+const void *get_chipdb(const std::string &filename)
+{
HRSRC rc = ::FindResource(nullptr, filename.c_str(), RT_RCDATA);
HGLOBAL rcData = ::LoadResource(nullptr, rc);
return ::LockResource(rcData);
@@ -34,7 +36,8 @@ const void *get_chipdb(const std::string &filename) {
EmbeddedFile *EmbeddedFile::head = nullptr;
-const void *get_chipdb(const std::string &filename) {
+const void *get_chipdb(const std::string &filename)
+{
for (EmbeddedFile *file = EmbeddedFile::head; file; file = file->next)
if (file->filename == filename)
return file->content;
diff --git a/common/embed.h b/common/embed.h
index 6111bf1f..5f2754f8 100644
--- a/common/embed.h
+++ b/common/embed.h
@@ -33,8 +33,7 @@ struct EmbeddedFile
const void *content;
EmbeddedFile *next = nullptr;
- EmbeddedFile(const std::string &filename, const void *content)
- : filename(filename), content(content)
+ EmbeddedFile(const std::string &filename, const void *content) : filename(filename), content(content)
{
next = head;
head = this;