aboutsummaryrefslogtreecommitdiff
path: root/src/script/scripting_mainmenu.h
Commit message (Expand)AuthorAge
* C++ modernize: Pragma once (#6264)Loïc Blot2017-08-17
* C++11 patchset 6: forbid object copy using assigment/copy function deleters (...Loïc Blot2017-06-10
* Use a settings object for the main settingsShadowNinja2017-05-06
* Don't permit to copy Scripting classes (Client,Server,Mainmenu)Loïc Blot2017-04-27
* Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)Loïc Blot2017-04-20
* Fix code style of async APIShadowNinja2014-04-27
* Remove dependency on marshal and many other async changesShadowNinja2014-04-27
* Fix modstore/favourites hang by adding asynchronous lua job supportsapier2013-11-29
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
/span> #include <string> static const char hex_chars[] = "0123456789abcdef"; static inline std::string hex_encode(const char *data, unsigned int data_size) { std::string ret; char buf2[3]; buf2[2] = '\0'; for (unsigned int i = 0; i < data_size; i++) { unsigned char c = (unsigned char)data[i]; buf2[0] = hex_chars[(c & 0xf0) >> 4]; buf2[1] = hex_chars[c & 0x0f]; ret.append(buf2); } return ret; } static inline std::string hex_encode(const std::string &data) { return hex_encode(data.c_str(), data.size()); } static inline bool hex_digit_decode(char hexdigit, unsigned char &value) { if (hexdigit >= '0' && hexdigit <= '9') value = hexdigit - '0'; else if (hexdigit >= 'A' && hexdigit <= 'F') value = hexdigit - 'A' + 10; else if (hexdigit >= 'a' && hexdigit <= 'f') value = hexdigit - 'a' + 10; else return false; return true; } #endif