xcbosa-itx 2 жил өмнө
parent
commit
24c0b0834d

+ 3 - 3
thirdparty/sha256.hpp

@@ -11,9 +11,9 @@
 
 
 using namespace std;
 using namespace std;
 
 
-void __sha256(const unsigned char *data, size_t len, unsigned char *out) __attribute__((weak));
+static void __sha256(const unsigned char *data, size_t len, unsigned char *out);
 
 
-string sha256(string str) __attribute__((weak)) {
+static string sha256(string str) {
     unsigned char buff[32];
     unsigned char buff[32];
     ::memset(buff, 0, 32);
     ::memset(buff, 0, 32);
     const char *c_str = str.c_str();
     const char *c_str = str.c_str();
@@ -45,7 +45,7 @@ static const uint32_t k[64] = {
         0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
         0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
 };
 };
 
 
-void __sha256(const unsigned char *data, size_t len, unsigned char *out) __attribute__((weak)) {
+static void __sha256(const unsigned char *data, size_t len, unsigned char *out) {
     uint32_t h0 = 0x6a09e667;
     uint32_t h0 = 0x6a09e667;
     uint32_t h1 = 0xbb67ae85;
     uint32_t h1 = 0xbb67ae85;
     uint32_t h2 = 0x3c6ef372;
     uint32_t h2 = 0x3c6ef372;

+ 4 - 4
user.hpp

@@ -18,7 +18,7 @@ using namespace xc::utils;
 
 
 namespace user {
 namespace user {
 
 
-    inline string generateToken(string payload) __attribute__((weak)) {
+    static string generateToken(string payload) {
         ostringstream oss;
         ostringstream oss;
         oss << payload;
         oss << payload;
         oss << "/";
         oss << "/";
@@ -30,7 +30,7 @@ namespace user {
         return oss.str();
         return oss.str();
     }
     }
 
 
-    inline string tryLogin(string username, string password) __attribute__((weak)) {
+    static string tryLogin(string username, string password) {
         string userInfoFile = conf::getUserDataDir() + "/" + username;
         string userInfoFile = conf::getUserDataDir() + "/" + username;
         if (fs::existsFile(userInfoFile)) {
         if (fs::existsFile(userInfoFile)) {
             INIFile ini(userInfoFile);
             INIFile ini(userInfoFile);
@@ -42,7 +42,7 @@ namespace user {
         return "loginFailed";
         return "loginFailed";
     }
     }
 
 
-    inline string getTokenUserName(string token) __attribute__((weak)) {
+    static string getTokenUserName(string token) {
         auto list = split(token, "/");
         auto list = split(token, "/");
         if (list.size() != 3) {
         if (list.size() != 3) {
             return "";
             return "";
@@ -76,7 +76,7 @@ namespace user {
         return username;
         return username;
     }
     }
 
 
-    inline bool isLogin(string token) __attribute__((weak)) {
+    static bool isLogin(string token) {
         return !getTokenUserName(token).empty();
         return !getTokenUserName(token).empty();
     }
     }