mirror of https://github.com/kiwix/libkiwix.git
+ try to fix the problem with corrupted resources on arm kiwix-serve
This commit is contained in:
parent
f29a845682
commit
2cd537fd02
|
@ -2,9 +2,9 @@
|
|||
#include <iostream>
|
||||
|
||||
std::string getResourceAsString(const std::string &name) {
|
||||
std::map<std::string, const char*>::iterator it = resourceMap.find(name);
|
||||
std::map<std::string, std::pair<const unsigned char*, unsigned int> >::iterator it = resourceMap.find(name);
|
||||
if (it != resourceMap.end()) {
|
||||
return std::string(strdup(resourceMap[name]));
|
||||
return std::string(strdup((const char*)resourceMap[name].first), resourceMap[name].second);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -21206,20 +21206,20 @@ const unsigned char server_taskbar_html_part[]={
|
|||
0x3a,0x20,0x34,0x30,0x70,0x78,0x3b,0x22,0x3e,0x3c,0x2f,0x64,0x69,0x76,0x3e,0x0a
|
||||
};
|
||||
|
||||
static std::map<std::string, const char*> createResourceMap() {
|
||||
std::map<std::string, const char*> m;
|
||||
m["results.tmpl"] = (const char*)results_tmpl;
|
||||
m["jqueryui/include.html.part"] = (const char*)jqueryui_include_html_part;
|
||||
m["jqueryui/css/smoothness/jquery-ui.custom.css"] = (const char*)jqueryui_css_smoothness_jquery_ui_custom_css;
|
||||
m["jqueryui/js/jquery-ui.custom.min.js"] = (const char*)jqueryui_js_jquery_ui_custom_min_js;
|
||||
m["jqueryui/js/jquery.min.js"] = (const char*)jqueryui_js_jquery_min_js;
|
||||
m["server/taskbar.css"] = (const char*)server_taskbar_css;
|
||||
m["server/home.html.tmpl"] = (const char*)server_home_html_tmpl;
|
||||
m["server/taskbar.html.part"] = (const char*)server_taskbar_html_part;
|
||||
static std::map<std::string, std::pair<const unsigned char*, unsigned int> > createResourceMap() {
|
||||
std::map<std::string, std::pair<const unsigned char*, unsigned int> > m;
|
||||
m["results.tmpl"] = std::pair <const unsigned char*, unsigned int>(results_tmpl, sizeof results_tmpl);
|
||||
m["jqueryui/include.html.part"] = std::pair <const unsigned char*, unsigned int>(jqueryui_include_html_part, sizeof jqueryui_include_html_part);
|
||||
m["jqueryui/css/smoothness/jquery-ui.custom.css"] = std::pair <const unsigned char*, unsigned int>(jqueryui_css_smoothness_jquery_ui_custom_css, sizeof jqueryui_css_smoothness_jquery_ui_custom_css);
|
||||
m["jqueryui/js/jquery-ui.custom.min.js"] = std::pair <const unsigned char*, unsigned int>(jqueryui_js_jquery_ui_custom_min_js, sizeof jqueryui_js_jquery_ui_custom_min_js);
|
||||
m["jqueryui/js/jquery.min.js"] = std::pair <const unsigned char*, unsigned int>(jqueryui_js_jquery_min_js, sizeof jqueryui_js_jquery_min_js);
|
||||
m["server/taskbar.css"] = std::pair <const unsigned char*, unsigned int>(server_taskbar_css, sizeof server_taskbar_css);
|
||||
m["server/home.html.tmpl"] = std::pair <const unsigned char*, unsigned int>(server_home_html_tmpl, sizeof server_home_html_tmpl);
|
||||
m["server/taskbar.html.part"] = std::pair <const unsigned char*, unsigned int>(server_taskbar_html_part, sizeof server_taskbar_html_part);
|
||||
return m;
|
||||
}
|
||||
|
||||
static std::map<std::string, const char*> resourceMap = createResourceMap();
|
||||
static std::map<std::string, std::pair<const unsigned char*, unsigned int> > resourceMap = createResourceMap();
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
SCRIPT_DIR=$(dirname $0)
|
||||
RESOURCE_FILE=$SCRIPT_DIR/../src/common/resourceTools.h
|
||||
MAP="static std::map<std::string, const char*> createResourceMap() { \n"
|
||||
MAP=$MAP"\tstd::map<std::string, const char*> m; \n"
|
||||
MAP="static std::map<std::string, std::pair<const unsigned char*, unsigned int> > createResourceMap() { \n"
|
||||
MAP=$MAP"\tstd::map<std::string, std::pair<const unsigned char*, unsigned int> > m; \n"
|
||||
|
||||
# Delete old version of the file
|
||||
rm -f "$RESOURCE_FILE"
|
||||
|
@ -26,11 +26,11 @@ do
|
|||
FILE_ID=`echo "$FILE" | sed "s/\//_/g" | sed "s/\./_/g" | sed "s/\-/_/g"`
|
||||
echo "Inserting $FILE... [$FILE_ID]"
|
||||
reswrap -s -x -oa $RESOURCE_FILE -r $FILE_ID $FILE
|
||||
MAP=$MAP"\tm[\""$FILE"\"] = (const char*)"$FILE_ID"; \n";
|
||||
MAP=$MAP"\tm[\""$FILE"\"] = std::pair <const unsigned char*, unsigned int>("$FILE_ID", sizeof "$FILE_ID"); \n";
|
||||
done;
|
||||
MAP=$MAP"\treturn m; \n";
|
||||
MAP=$MAP"} \n\n"
|
||||
MAP=$MAP"static std::map<std::string, const char*> resourceMap = createResourceMap(); \n\n"
|
||||
MAP=$MAP"static std::map<std::string, std::pair<const unsigned char*, unsigned int> > resourceMap = createResourceMap(); \n\n"
|
||||
|
||||
# Create the map table
|
||||
# map<int, int> m = map_list_of (1,2) (3,4) (5,6) (7,8);
|
||||
|
|
|
@ -16,6 +16,5 @@ $( "#accordion" ).accordion();
|
|||
<div id="accordion">
|
||||
__BOOKS__
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue