]> git.stg.codes - stg.git/blobdiff - include/stg/user_ips.h
Unused variable removed
[stg.git] / include / stg / user_ips.h
index 17bb59be1bc9f1e09cb7cf3727d2fec1db7eae76..a29e28128c07f5a651df94e839128fe4bf2df70e 100644 (file)
@@ -134,6 +134,14 @@ return ips.size();
 }
 //-----------------------------------------------------------------------------
 inline
+uint32_t USER_IPS::CalcMask(unsigned int msk) const
+{
+if (msk > 32)
+    return 0;
+return htonl(0xFFffFFff << (32 - msk));
+}
+//-----------------------------------------------------------------------------
+inline
 bool USER_IPS::IsIPInIPS(uint32_t ip) const
 {
 if (ips.empty())
@@ -163,14 +171,6 @@ return false;
 }
 //-----------------------------------------------------------------------------
 inline
-uint32_t USER_IPS::CalcMask(unsigned int msk) const
-{
-if (msk > 32)
-    return 0;
-return htonl(0xFFffFFff << (32 - msk));
-}
-//-----------------------------------------------------------------------------
-inline
 void USER_IPS::Add(const IP_MASK &im)
 {
 ips.push_back(im);
@@ -202,7 +202,6 @@ USER_IPS ips;
 char * paddr;
 IP_MASK im;
 std::vector<std::string> ipMask;
-std::string err;
 if (ipsStr.empty())
     {
     return ips;
@@ -236,7 +235,6 @@ for (unsigned int i = 0; i < ipMask.size(); i++)
     strIp = strtok(str, "/");
     if (strIp == NULL)
         {
-        err = "Incorrect IP address " + ipsStr;
         return ips;
         }
     strMask = strtok(NULL, "/");
@@ -244,7 +242,6 @@ for (unsigned int i = 0; i < ipMask.size(); i++)
     im.ip = inet_addr(strIp);
     if (im.ip == INADDR_NONE)
         {
-        err = "Incorrect IP address: " + std::string(strIp);
         return ips;
         }
 
@@ -254,20 +251,17 @@ for (unsigned int i = 0; i < ipMask.size(); i++)
         int m = 0;
         if (str2x(strMask, m) != 0)
             {
-            err = "Incorrect mask: " + std::string(strMask);
             return ips;
             }
         im.mask = m;
 
         if (im.mask > 32)
             {
-            err = "Incorrect mask: " + std::string(strMask);
             return ips;
             }
 
         if ((im.ip & ips.CalcMask(im.mask)) != im.ip)
             {
-            err = "Address does'n match mask: " + std::string(strIp) + "/" + std::string(strMask);
             return ips;
             }
         }