From 8b851d504875906afe3b40dd87f642fd7d5a93f1 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 19 Dec 2015 14:30:32 +0000 Subject: Added HTTPS links wherever they are supported. --- src/Bindings/LuaFunctions.h | 2 +- src/Blocks/BlockFarmland.h | 8 ++---- src/CheckBasicStyle.lua | 64 +++++++++++++++++++++----------------------- src/Generating/IntGen.h | 16 +++++------ src/Noise/Noise.h | 33 +++++++++-------------- src/OSSupport/IsThread.cpp | 6 +---- src/OSSupport/StackTrace.cpp | 6 +---- src/Protocol/MojangAPI.cpp | 50 ++++++++++++++++------------------ src/Root.cpp | 8 +++--- src/StringUtils.cpp | 22 +++++++-------- 10 files changed, 89 insertions(+), 126 deletions(-) (limited to 'src') diff --git a/src/Bindings/LuaFunctions.h b/src/Bindings/LuaFunctions.h index 929794893..98341a131 100644 --- a/src/Bindings/LuaFunctions.h +++ b/src/Bindings/LuaFunctions.h @@ -7,7 +7,7 @@ inline unsigned int GetTime() { - // NB: For caveats, please see http://stackoverflow.com/a/14505248 + // NB: For caveats, please see https://stackoverflow.com/a/14505248 return static_cast(std::chrono::seconds(time(0)).count()); } diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h index e6c7f16f6..412eb1d2c 100644 --- a/src/Blocks/BlockFarmland.h +++ b/src/Blocks/BlockFarmland.h @@ -19,7 +19,7 @@ class cBlockFarmlandHandler : public cBlockHandler { - + public: cBlockFarmlandHandler(BLOCKTYPE a_BlockType) : cBlockHandler(a_BlockType) @@ -104,7 +104,7 @@ public: } // Search for water in a close proximity: - // Ref.: http://www.minecraftwiki.net/wiki/Farmland#Hydrated_Farmland_Tiles + // Ref.: http://minecraft.gamepedia.com/Farmland#Hydrated_Farmland_Tiles // TODO: Rewrite this to use the chunk and its neighbors directly cBlockArea Area; int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width; @@ -139,7 +139,3 @@ public: ); } } ; - - - - diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua index a3d21106a..3f0d2bd45 100755 --- a/src/CheckBasicStyle.lua +++ b/src/CheckBasicStyle.lua @@ -16,10 +16,10 @@ Checks that all source files (*.cpp, *.h) use the basic style requirements of th - (TODO) Hex numbers with even digit length - (TODO) Hex numbers in lowercase - (TODO) Not using "* "-style doxy comment continuation lines - + Violations that cannot be checked easily: - Spaces around "+" (there are things like "a++", "++a", "a += 1", "X+", "stack +1" and ascii-drawn tables) - + Reports all violations on stdout in a form that is readable by Visual Studio's parser, so that dblclicking the line brings the editor directly to the violation. @@ -114,38 +114,38 @@ local g_ViolationPatterns = -- Check against indenting using spaces: {"^\t* +", "Indenting with a space"}, - + -- Check against alignment using tabs: {"[^%s]\t+[^%s]", "Aligning with a tab"}, - + -- Check against trailing whitespace: {"[^%s]%s+\n", "Trailing whitespace"}, - + -- Check that all "//"-style comments have at least two spaces in front (unless alone on line): {"[^%s] //", "Needs at least two spaces in front of a \"//\"-style comment"}, - + -- Check that all "//"-style comments have at least one spaces after: {"%s//[^%s/*<]", "Needs a space after a \"//\"-style comment"}, - + -- Check that doxy-comments are used only in the double-asterisk form: {"/// ", "Use doxycomments in the form /** Comment */"}, - + -- Check that /* */ comments have whitespace around the insides: {"%*%*/", "Wrong comment termination, use */"}, {"/%*[^%s*/\"]", "Needs a space after /*"}, -- Need to take care of the special "//*/" comment ends {"/%*%*[^%s*<]", "Needs a space after /**"}, {"[^%s/*]%*/", "Needs a space before */"}, - + -- Check against MS XML doxycomments: {"/%*%* <", "Remove the MS XML markers from comment"}, -- Check that all commas have spaces after them and not in front of them: {" ,", "Extra space before a \",\""}, {",[^%s\"%%\']", "Needs a space after a \",\""}, -- Report all except >> "," << needed for splitting and >>,%s<< needed for formatting - + -- Check that opening braces are not at the end of a code line: {"[^%s].-{\n?$", "Brace should be on a separate line"}, - + -- Space after keywords: {"[^_]if%(", "Needs a space after \"if\""}, {"%sfor%(", "Needs a space after \"for\""}, @@ -153,16 +153,16 @@ local g_ViolationPatterns = {"%sswitch%(", "Needs a space after \"switch\""}, {"%scatch%(", "Needs a space after \"catch\""}, {"%stemplate<", "Needs a space after \"template\""}, - + -- No space after keyword's parenthesis: {"[^%a#]if %( ", "Remove the space after \"(\""}, {"for %( ", "Remove the space after \"(\""}, {"while %( ", "Remove the space after \"(\""}, {"catch %( ", "Remove the space after \"(\""}, - + -- No space before a closing parenthesis: {" %)", "Remove the space before \")\""}, - + -- Check spaces around "+": {"^[a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"}, {"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"}, @@ -173,7 +173,7 @@ local g_ViolationPatterns = {"^[a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"}, {"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"}, --]] - + -- Cannot check spaces around "-", because the minus is sometimes used as a hyphen between-words -- Check spaces around "*": @@ -191,7 +191,7 @@ local g_ViolationPatterns = {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around &"}, {"^[a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"}, {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"}, - + -- Check spaces around "==", "<=" and ">=": {"==[a-zA-Z0-9]+", "Add space after =="}, {"[a-zA-Z0-9]+==", "Add space before =="}, @@ -212,7 +212,7 @@ local g_ViolationPatterns = --- Processes one file local function ProcessFile(a_FileName) assert(type(a_FileName) == "string") - + -- Read the whole file: local f, err = io.open(a_FileName, "r") if (f == nil) then @@ -222,7 +222,7 @@ local function ProcessFile(a_FileName) end local all = f:read("*all") f:close() - + -- Check that the last line is empty - otherwise processing won't work properly: local lastChar = string.byte(all, string.len(all)) if ((lastChar ~= 13) and (lastChar ~= 10)) then @@ -231,9 +231,9 @@ local function ProcessFile(a_FileName) ReportViolation(a_FileName, numLines, 1, 1, "Missing empty line at file end") return end - + -- Process each line separately: - -- Ref.: http://stackoverflow.com/questions/10416869/iterate-over-possibly-empty-lines-in-a-way-that-matches-the-expectations-of-exis + -- Ref.: https://stackoverflow.com/questions/10416869/iterate-over-possibly-empty-lines-in-a-way-that-matches-the-expectations-of-exis local lineCounter = 1 local lastIndentLevel = 0 local isLastLineControl = false @@ -244,7 +244,7 @@ local function ProcessFile(a_FileName) for _, pat in ipairs(g_ViolationPatterns) do ReportViolationIfFound(a_Line, a_FileName, lineCounter, pat[1], pat[2]) end - + -- Check that divider comments are well formed - 80 slashes plus optional indent: local dividerStart, dividerEnd = a_Line:find("/////*") if (dividerStart) then @@ -260,7 +260,7 @@ local function ProcessFile(a_FileName) end end end - + -- Check the indent level change from the last line, if it's too much, report: local indentStart, indentEnd = a_Line:find("\t+") local indentLevel = 0 @@ -273,7 +273,7 @@ local function ProcessFile(a_FileName) end lastIndentLevel = indentLevel end - + -- Check that control statements have braces on separate lines after them: -- Note that if statements can be broken into multiple lines, in which case this test is not taken if (isLastLineControl) then @@ -304,12 +304,12 @@ end --- Processes one item - a file or a folder local function ProcessItem(a_ItemName) assert(type(a_ItemName) == "string") - + -- Skip files / folders that should be ignored if (g_ShouldIgnoreFile[a_ItemName]) then return end - + local ext = a_ItemName:match("%.([^/%.]-)$") if (g_ShouldProcessExt[ext]) then ProcessFile(a_ItemName) @@ -340,7 +340,7 @@ local CmdLineHandlers = table.insert(ToProcess, fnam) return a_Idx + 2 -- skip the filename in param parsing end, - + -- "-g" checks files reported by git as being committed. ["-g"] = function (a_Args, a_Idx) local f = io.popen("git diff --cached --name-only --diff-filter=ACMR") @@ -348,7 +348,7 @@ local CmdLineHandlers = table.insert(ToProcess, fnam) end end, - + -- "-h" prints help and exits ["-h"] = function (a_Args, a_Idx) print([[ @@ -368,7 +368,7 @@ Only .cpp and .h files are ever checked. ]]) os.exit(0) end, - + -- "-l listfile" loads the list of files to check from the specified listfile ["-l"] = function (a_Args, a_Idx) local listFile = a_Args[a_Idx + 1] @@ -380,7 +380,7 @@ Only .cpp and .h files are ever checked. end return a_Idx + 2 -- Skip the listfile in param parsing end, - + -- "--" reads the list of files from stdin ["--"] = function (a_Args, a_Idx) for fnam in io.lines() do @@ -425,7 +425,7 @@ for _, fnam in ipairs(ToProcess) do if (fnam:sub(1, 2) == "./") then fnam = fnam:sub(3) end - + ProcessItem(fnam) end @@ -440,7 +440,3 @@ if (g_NumViolations > 0) then else os.exit(0) end - - - - diff --git a/src/Generating/IntGen.h b/src/Generating/IntGen.h index 3f94ec3d0..708dc0550 100644 --- a/src/Generating/IntGen.h +++ b/src/Generating/IntGen.h @@ -67,10 +67,10 @@ public: /** Generates the array of templated size into a_Values, based on given min coords. */ virtual void GetInts(int a_MinX, int a_MinZ, Values & a_Values) = 0; - + }; -// Code adapted from http://stackoverflow.com/questions/7858817/unpacking-a-tuple-to-call-a-matching-function-pointer +// Code adapted from https://stackoverflow.com/questions/7858817/unpacking-a-tuple-to-call-a-matching-function-pointer template struct sSeq @@ -92,7 +92,7 @@ struct sGens<0, S...> template class cIntGenFactory { - + public: typedef Gen Generator; @@ -101,7 +101,7 @@ public: m_args(std::make_tuple(std::forward(a_args)...)) { } - + template std::shared_ptr construct(LhsGen&& a_Lhs) { @@ -111,13 +111,13 @@ public: private: std::tuple m_args; - + template std::shared_ptr construct_impl(LhsGen&& a_Lhs, sSeq) { return std::make_shared(std::get(m_args)..., std::forward(a_Lhs)); } - + }; template @@ -1466,7 +1466,3 @@ protected: Underlying m_Underlying; Underlying m_Alteration; }; - - - - diff --git a/src/Noise/Noise.h b/src/Noise/Noise.h index 4c99cee5b..03f61643d 100644 --- a/src/Noise/Noise.h +++ b/src/Noise/Noise.h @@ -68,12 +68,12 @@ class cCubicNoise public: /** Maximum size of each dimension of the query arrays. */ static const int MAX_SIZE = 512; - - + + /** Creates a new instance with the specified seed. */ cCubicNoise(int a_Seed); - - + + /** Fills a 2D array with the values of the noise. */ void Generate2D( NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y] @@ -81,8 +81,8 @@ public: NOISE_DATATYPE a_StartX, NOISE_DATATYPE a_EndX, ///< Noise-space coords of the array in the X direction NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY ///< Noise-space coords of the array in the Y direction ) const; - - + + /** Fills a 3D array with the values of the noise. */ void Generate3D( NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y + a_SizeX * a_SizeY * z] @@ -91,9 +91,9 @@ public: NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY, ///< Noise-space coords of the array in the Y direction NOISE_DATATYPE a_StartZ, NOISE_DATATYPE a_EndZ ///< Noise-space coords of the array in the Z direction ) const; - + protected: - + /** Noise used for integral random values. */ cNoise m_Noise; @@ -115,8 +115,8 @@ protected: -/** Improved noise, as described by Ken Perlin: http://mrl.nyu.edu/~perlin/paper445.pdf -Implementation adapted from Perlin's Java implementation: http://mrl.nyu.edu/~perlin/noise/ */ +/** Improved noise, as described by Ken Perlin: https://mrl.nyu.edu/~perlin/paper445.pdf +Implementation adapted from Perlin's Java implementation: https://mrl.nyu.edu/~perlin/noise/ */ class cImprovedNoise { public: @@ -132,8 +132,8 @@ public: NOISE_DATATYPE a_StartX, NOISE_DATATYPE a_EndX, ///< Noise-space coords of the array in the X direction NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY ///< Noise-space coords of the array in the Y direction ) const; - - + + /** Fills a 3D array with the values of the noise. */ void Generate3D( NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y + a_SizeX * a_SizeY * z] @@ -324,12 +324,3 @@ inline NOISE_DATATYPE ClampedLerp(NOISE_DATATYPE a_Val1, NOISE_DATATYPE a_Val2, } return Lerp(a_Val1, a_Val2, a_Ratio); } - - - - - - - - - diff --git a/src/OSSupport/IsThread.cpp b/src/OSSupport/IsThread.cpp index e295d5f25..3f75951ba 100644 --- a/src/OSSupport/IsThread.cpp +++ b/src/OSSupport/IsThread.cpp @@ -12,7 +12,7 @@ #if defined(_MSC_VER) && defined(_DEBUG) - // Code adapted from MSDN: http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx + // Code adapted from MSDN: https://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx const DWORD MS_VC_EXCEPTION = 0x406D1388; #pragma pack(push, 8) @@ -144,7 +144,3 @@ bool cIsThread::Wait(void) LOGD("Thread %s finished", m_ThreadName.c_str()); return true; } - - - - diff --git a/src/OSSupport/StackTrace.cpp b/src/OSSupport/StackTrace.cpp index 3534bc03d..030566065 100644 --- a/src/OSSupport/StackTrace.cpp +++ b/src/OSSupport/StackTrace.cpp @@ -35,14 +35,10 @@ void PrintStackTrace(void) #else #ifdef __GLIBC__ // Use the backtrace() function to get and output the stackTrace: - // Code adapted from http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes + // Code adapted from https://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes void * stackTrace[30]; auto numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace)); backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO); #endif #endif } - - - - diff --git a/src/Protocol/MojangAPI.cpp b/src/Protocol/MojangAPI.cpp index 9eb8122d3..4747ace72 100644 --- a/src/Protocol/MojangAPI.cpp +++ b/src/Protocol/MojangAPI.cpp @@ -67,7 +67,7 @@ static const AString & GetCACerts(void) // Starfield G2 cert // This is the data of the root certs for Starfield Technologies, the CA that used to sign sessionserver.mojang.com's cert - // Downloaded from http://certs.starfieldtech.com/repository/ + // Downloaded from https://certs.starfieldtech.com/repository/ "-----BEGIN CERTIFICATE-----\n" "MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx\n" "EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT\n" @@ -118,7 +118,7 @@ static const AString & GetCACerts(void) "WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q=\n" "-----END CERTIFICATE-----\n" ); - + return Cert; } @@ -152,7 +152,7 @@ cMojangAPI::sProfile::sProfile( } ] */ - + // Parse the Textures and TexturesSignature from the Profile: if (!a_Properties.isArray()) { @@ -272,7 +272,7 @@ AString cMojangAPI::GetUUIDFromPlayerName(const AString & a_PlayerName, bool a_U { // Convert the playername to lowercase: AString lcPlayerName = StrToLower(a_PlayerName); - + // Request the cache to query the name if not yet cached: if (!a_UseOnlyCached) { @@ -280,7 +280,7 @@ AString cMojangAPI::GetUUIDFromPlayerName(const AString & a_PlayerName, bool a_U PlayerNames.push_back(lcPlayerName); CacheNamesToUUIDs(PlayerNames); } - + // Retrieve from cache: cCSLock Lock(m_CSNameToUUID); cProfileMap::const_iterator itr = m_NameToUUID.find(lcPlayerName); @@ -300,7 +300,7 @@ AString cMojangAPI::GetPlayerNameFromUUID(const AString & a_UUID, bool a_UseOnly { // Normalize the UUID to lowercase short format that is used as the map key: AString UUID = MakeUUIDShort(a_UUID); - + // Retrieve from caches: { cCSLock Lock(m_CSUUIDToProfile); @@ -325,7 +325,7 @@ AString cMojangAPI::GetPlayerNameFromUUID(const AString & a_UUID, bool a_UseOnly CacheUUIDToProfile(UUID); return GetPlayerNameFromUUID(a_UUID, true); } - + // No value found, none queried. Return an error: return ""; } @@ -342,13 +342,13 @@ AStringVector cMojangAPI::GetUUIDsFromPlayerNames(const AStringVector & a_Player { PlayerNames.push_back(StrToLower(*itr)); } // for itr - a_PlayerNames[] - + // Request the cache to populate any names not yet contained: if (!a_UseOnlyCached) { CacheNamesToUUIDs(PlayerNames); } - + // Retrieve from cache: size_t idx = 0; AStringVector res; @@ -367,7 +367,7 @@ AStringVector cMojangAPI::GetUUIDsFromPlayerNames(const AStringVector & a_Player - + void cMojangAPI::AddPlayerNameToUUIDMapping(const AString & a_PlayerName, const AString & a_UUID) { @@ -475,7 +475,7 @@ AString cMojangAPI::MakeUUIDShort(const AString & a_UUID) // Already is a short UUID, only lowercase return StrToLower(a_UUID); } - + case 36: { // Remove the dashes from the string by appending together the parts between them: @@ -507,7 +507,7 @@ AString cMojangAPI::MakeUUIDDashed(const AString & a_UUID) // Already is a dashed UUID, only lowercase return StrToLower(a_UUID); } - + case 32: { // Insert dashes at the proper positions: @@ -541,7 +541,7 @@ void cMojangAPI::LoadCachesFromDisk(void) SQLite::Database db("MojangAPI.sqlite", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE); db.exec("CREATE TABLE IF NOT EXISTS PlayerNameToUUID (PlayerName, UUID, DateTime)"); db.exec("CREATE TABLE IF NOT EXISTS UUIDToProfile (UUID, PlayerName, Textures, TexturesSignature, DateTime)"); - + // Retrieve all entries: { SQLite::Statement stmt(db, "SELECT PlayerName, UUID, DateTime FROM PlayerNameToUUID"); @@ -587,11 +587,11 @@ void cMojangAPI::SaveCachesToDisk(void) SQLite::Database db("MojangAPI.sqlite", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE); db.exec("CREATE TABLE IF NOT EXISTS PlayerNameToUUID (PlayerName, UUID, DateTime)"); db.exec("CREATE TABLE IF NOT EXISTS UUIDToProfile (UUID, PlayerName, Textures, TexturesSignature, DateTime)"); - + // Remove all entries: db.exec("DELETE FROM PlayerNameToUUID"); db.exec("DELETE FROM UUIDToProfile"); - + // Save all cache entries - m_PlayerNameToUUID: Int64 LimitDateTime = time(nullptr) - MAX_AGE; { @@ -658,7 +658,7 @@ void cMojangAPI::CacheNamesToUUIDs(const AStringVector & a_PlayerNames) } } // for itr - a_PlayerNames[] } // Lock(m_CSNameToUUID) - + QueryNamesToUUIDs(NamesToQuery); } @@ -720,7 +720,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery) continue; } Response.erase(0, idxHeadersEnd + 4); - + // Parse the returned string into Json: Json::Reader reader; if (!reader.parse(Response, root, false) || !root.isArray()) @@ -729,7 +729,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery) LOGD("Response body:\n%s", CreateHexDump(HexDump, Response.data(), Response.size(), 16).c_str()); continue; } - + // Store the returned results into cache: Json::Value::UInt JsonCount = root.size(); Int64 Now = time(nullptr); @@ -748,7 +748,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery) NotifyNameUUID(JsonName, JsonUUID); } // for idx - root[] } // cCSLock (m_CSNameToUUID) - + // Also cache the UUIDToName: { cCSLock Lock(m_CSUUIDToName); @@ -774,7 +774,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery) void cMojangAPI::CacheUUIDToProfile(const AString & a_UUID) { ASSERT(a_UUID.size() == 32); - + // Check if already present: { cCSLock Lock(m_CSUUIDToProfile); @@ -783,7 +783,7 @@ void cMojangAPI::CacheUUIDToProfile(const AString & a_UUID) return; } } - + QueryUUIDToProfile(a_UUID); } @@ -796,7 +796,7 @@ void cMojangAPI::QueryUUIDToProfile(const AString & a_UUID) // Create the request address: AString Address = m_UUIDToProfileAddress; ReplaceString(Address, "%UUID%", a_UUID); - + // Create the HTTP request: AString Request; Request += "GET " + Address + " HTTP/1.0\r\n"; // We need to use HTTP 1.0 because we don't handle Chunked transfer encoding @@ -832,7 +832,7 @@ void cMojangAPI::QueryUUIDToProfile(const AString & a_UUID) return; } Response.erase(0, idxHeadersEnd + 4); - + // Parse the returned string into Json: Json::Reader reader; Json::Value root; @@ -943,7 +943,3 @@ void cMojangAPI::Update(void) } } } - - - - diff --git a/src/Root.cpp b/src/Root.cpp index ed9076268..1fbbaed3c 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -767,7 +767,7 @@ int cRoot::GetVirtualRAMUsage(void) } return -1; #elif defined(__linux__) - // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process + // Code adapted from https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process std::ifstream StatFile("/proc/self/status"); if (!StatFile.good()) { @@ -785,7 +785,7 @@ int cRoot::GetVirtualRAMUsage(void) } return -1; #elif defined (__APPLE__) - // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process + // Code adapted from https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process struct task_basic_info t_info; mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT; @@ -819,7 +819,7 @@ int cRoot::GetPhysicalRAMUsage(void) } return -1; #elif defined(__linux__) - // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process + // Code adapted from https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process std::ifstream StatFile("/proc/self/status"); if (!StatFile.good()) { @@ -837,7 +837,7 @@ int cRoot::GetPhysicalRAMUsage(void) } return -1; #elif defined (__APPLE__) - // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process + // Code adapted from https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process struct task_basic_info t_info; mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT; diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index cc71e048b..76b9fdbde 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -21,7 +21,7 @@ AString & AppendVPrintf(AString & str, const char * format, va_list args) { ASSERT(format != nullptr); - + char buffer[2048]; int len; #ifdef va_copy @@ -47,7 +47,7 @@ AString & AppendVPrintf(AString & str, const char * format, va_list args) #ifdef va_copy va_end(argsCopy); #endif - + // The result did not fit into the static buffer, use a dynamic buffer: #ifdef _MSC_VER // for MS CRT, we need to calculate the result length @@ -57,7 +57,7 @@ AString & AppendVPrintf(AString & str, const char * format, va_list args) return str; } #endif // _MSC_VER - + // Allocate a buffer and printf into it: #ifdef va_copy va_copy(argsCopy, args); @@ -232,7 +232,7 @@ AString TrimString(const AString & str) { return ""; } - + size_t end = len; while (end >= start) { @@ -242,7 +242,7 @@ AString TrimString(const AString & str) } --end; } - + return str.substr(start, end - start + 1); } @@ -396,7 +396,7 @@ AString & RawBEToUTF8(const char * a_RawData, size_t a_NumShorts, AString & a_UT // UTF-8 conversion code adapted from: -// http://stackoverflow.com/questions/2867123/convert-utf-16-to-utf-8-under-windows-and-linux-in-c +// https://stackoverflow.com/questions/2867123/convert-utf-16-to-utf-8-under-windows-and-linux-in-c //////////////////////////////////////////////////////////////////////////////// // Begin of Unicode, Inc.'s code / information @@ -524,7 +524,7 @@ std::u16string UTF8ToRawBEUTF16(const AString & a_UTF8) { return UTF16; } - + // The cases all fall through. See "Note A" below. switch (extraBytesToRead) { @@ -609,7 +609,7 @@ AString & CreateHexDump(AString & a_Out, const void * a_Data, size_t a_Size, siz char line[512]; char * p; char * q; - + a_Out.reserve(a_Size / a_BytesPerLine * (18 + 6 * a_BytesPerLine)); for (size_t i = 0; i < a_Size; i += a_BytesPerLine) { @@ -953,7 +953,7 @@ bool SplitZeroTerminatedStrings(const AString & a_Strings, AStringVector & a_Out a_Output.push_back(a_Strings.substr(start, size - start)); res = true; } - + return res; } @@ -1000,7 +1000,3 @@ AString StringsConcat(const AStringVector & a_Strings, char a_Separator) } return res; } - - - - -- cgit v1.2.3