Merge pull request #2778 from cuberite/httpschanges
Added HTTPS links wherever they are supported.
This commit is contained in:
commit
f764df1a3a
@ -34,7 +34,7 @@ You'll need the basic C++ build tools:
|
|||||||
* gcc (or clang or another C compiler)
|
* gcc (or clang or another C compiler)
|
||||||
* g++ (or clang++ or another C++ compiler)
|
* g++ (or clang++ or another C++ compiler)
|
||||||
* make
|
* make
|
||||||
|
|
||||||
You'll also need CMake to generate the makefile to build from.
|
You'll also need CMake to generate the makefile to build from.
|
||||||
|
|
||||||
**Windows:**
|
**Windows:**
|
||||||
@ -101,10 +101,10 @@ Where to Get Started
|
|||||||
|
|
||||||
Issues that should be easy to get started with are tagged as [easy](https://github.com/cuberite/cuberite/issues?q=is%3Aopen+is%3Aissue+label%3Aeasy) in GitHub issues. Other good places to get started are:
|
Issues that should be easy to get started with are tagged as [easy](https://github.com/cuberite/cuberite/issues?q=is%3Aopen+is%3Aissue+label%3Aeasy) in GitHub issues. Other good places to get started are:
|
||||||
|
|
||||||
* Cleaning up some of the compiler warnings. (Check [Travis CI](http://travis-ci.org/cuberite/cuberite) for a list of them.) With clang, there are over 10000 lines of warnings to clean up.
|
* Cleaning up some of the compiler warnings. (Check [Travis CI](https://travis-ci.org/cuberite/cuberite) for a list of them.) With clang, there are over 10000 lines of warnings to clean up.
|
||||||
* Writing some plugins: They are written in lua, with excellent API documentation available via [APIDump](http://api-docs.cuberite.org). The [Core](https://github.com/cuberite/Core) plugin should also help quite a bit here.
|
* Writing some plugins: They are written in lua, with excellent API documentation available via [APIDump](http://api-docs.cuberite.org). The [Core](https://github.com/cuberite/Core) plugin should also help quite a bit here.
|
||||||
|
|
||||||
Special Things
|
Special Things
|
||||||
---------------------
|
---------------------
|
||||||
* Make yourself familiar with the community. Visit the forums: http://forum.mc-server.org
|
* Make yourself familiar with the community. Visit the forums: http://forum.mc-server.org
|
||||||
* Ask questions as much as you like, we're here to help :smiley:
|
* Ask questions as much as you like, we're here to help :smiley:
|
||||||
|
11
README.md
11
README.md
@ -1,9 +1,9 @@
|
|||||||
Cuberite [![Build Status](http://img.shields.io/travis/cuberite/cuberite/master.svg?style=flat)](https://travis-ci.org/cuberite/cuberite) [![Coverity Scan Build Status](https://img.shields.io/coverity/scan/1930.svg)](https://scan.coverity.com/projects/1930)
|
Cuberite [![Build Status](https://img.shields.io/travis/cuberite/cuberite/master.svg?style=flat)](https://travis-ci.org/cuberite/cuberite) [![Coverity Scan Build Status](https://img.shields.io/coverity/scan/1930.svg)](https://scan.coverity.com/projects/1930)
|
||||||
========
|
========
|
||||||
|
|
||||||
Cuberite is a Minecraft-compatible multiplayer game server that is written in C++ and designed to be efficient with memory and CPU, as well as having a flexible Lua Plugin API. Cuberite is compatible with the vanilla Minecraft client.
|
Cuberite is a Minecraft-compatible multiplayer game server that is written in C++ and designed to be efficient with memory and CPU, as well as having a flexible Lua Plugin API. Cuberite is compatible with the vanilla Minecraft client.
|
||||||
|
|
||||||
Cuberite can run on Windows, *nix and Android operating systems. This includes Android phones and tablets as well as Raspberry Pis.
|
Cuberite can run on Windows, *nix and Android operating systems. This includes Android phones and tablets as well as Raspberry Pis.
|
||||||
|
|
||||||
We currently support Release 1.7 and 1.8 (not beta) Minecraft protocol versions.
|
We currently support Release 1.7 and 1.8 (not beta) Minecraft protocol versions.
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ There are several ways to obtain Cuberite.
|
|||||||
#### Binaries
|
#### Binaries
|
||||||
- The easiest method is downloading for Windows or Linux from the [Project site](http://cuberite.org/).
|
- The easiest method is downloading for Windows or Linux from the [Project site](http://cuberite.org/).
|
||||||
- You can use the EasyInstall script for Linux, which automatically downloads the correct binary. The script is described below.
|
- You can use the EasyInstall script for Linux, which automatically downloads the correct binary. The script is described below.
|
||||||
- You can also obtain a binary from the [buildserver archive](http://builds.cuberite.org).
|
- You can also obtain a binary from the [buildserver archive](https://builds.cuberite.org).
|
||||||
|
|
||||||
##### The EasyInstall script
|
##### The EasyInstall script
|
||||||
This Linux script will download the correct binary from the project site.
|
This Linux script will download the correct binary from the project site.
|
||||||
@ -28,7 +28,7 @@ This Linux script will download the correct binary from the project site.
|
|||||||
- You can compile automatically for Linux with the `compile.sh` script. The script is described below.
|
- You can compile automatically for Linux with the `compile.sh` script. The script is described below.
|
||||||
- You can also compile manually. See [COMPILING.md](https://github.com/cuberite/cuberite/blob/master/COMPILING.md).
|
- You can also compile manually. See [COMPILING.md](https://github.com/cuberite/cuberite/blob/master/COMPILING.md).
|
||||||
|
|
||||||
Compiling may provide better performance performance (1.5-3x as fast) and it supports more operating systems.
|
Compiling may provide better performance performance (1.5-3x as fast) and it supports more operating systems.
|
||||||
|
|
||||||
##### The compile.sh script
|
##### The compile.sh script
|
||||||
This script downloads the source code and compiles it. The script is smart enough to notify you of missing dependencies and instructing you on how to install them. The script doesn't work for Windows.
|
This script downloads the source code and compiles it. The script is smart enough to notify you of missing dependencies and instructing you on how to install them. The script doesn't work for Windows.
|
||||||
@ -52,5 +52,4 @@ For other stuff, including plugins and discussion, check out the [forums](http:/
|
|||||||
|
|
||||||
[Support Us on Bountysource](https://bountysource.com/teams/cuberite)
|
[Support Us on Bountysource](https://bountysource.com/teams/cuberite)
|
||||||
|
|
||||||
Travis CI: [![travis build status shield](http://img.shields.io/travis/cuberite/cuberite.svg)](https://travis-ci.org/cuberite/cuberite)
|
Travis CI: [![travis build status shield](https://img.shields.io/travis/cuberite/cuberite.svg)](https://travis-ci.org/cuberite/cuberite)
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# This covers GCC bug 40518, http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518
|
# This covers GCC bug 40518, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518
|
||||||
# "Erasing an empty string causes a global value write / race condition warning in helgrind"
|
# "Erasing an empty string causes a global value write / race condition warning in helgrind"
|
||||||
# Original suppression authored by Jonathan Wakely: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518#c20
|
# Original suppression authored by Jonathan Wakely: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518#c20
|
||||||
# Modified by Mattes to match the mangled function name used on Ubuntu
|
# Modified by Mattes to match the mangled function name used on Ubuntu
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -16,7 +16,3 @@
|
|||||||
Helgrind:Race
|
Helgrind:Race
|
||||||
fun:_ZNSs9_M_mutateEjjj
|
fun:_ZNSs9_M_mutateEjjj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@
|
|||||||
<ul class="menu bottom_links">
|
<ul class="menu bottom_links">
|
||||||
<li><a href="http://cuberite.org" target="_blank">Cuberite</a></li>
|
<li><a href="http://cuberite.org" target="_blank">Cuberite</a></li>
|
||||||
<li><a href="http://forum.mc-server.org" target="_blank">Forums</a></li>
|
<li><a href="http://forum.mc-server.org" target="_blank">Forums</a></li>
|
||||||
<li><a href="http://builds.cuberite.org" target="_blank">Buildserver</a></li>
|
<li><a href="https://builds.cuberite.org" target="_blank">Buildserver</a></li>
|
||||||
<li><a href="http://api-docs.cuberite.org" target="_blank">API Documentation</a></li>
|
<li><a href="http://api-docs.cuberite.org" target="_blank">API Documentation</a></li>
|
||||||
<li><a href="http://book.cuberite.org/" target="_blank">User's Manual</a></li>
|
<li><a href="https://book.cuberite.org/" target="_blank">User's Manual</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,7 +25,7 @@ function GetDefaultPage()
|
|||||||
|
|
||||||
local SubTitle = "Current Game"
|
local SubTitle = "Current Game"
|
||||||
local Content = ""
|
local Content = ""
|
||||||
|
|
||||||
Content = Content .. "<h4>Plugins:</h4><ul>"
|
Content = Content .. "<h4>Plugins:</h4><ul>"
|
||||||
PM:ForEachPlugin(
|
PM:ForEachPlugin(
|
||||||
function (a_CBPlugin)
|
function (a_CBPlugin)
|
||||||
@ -34,16 +34,16 @@ function GetDefaultPage()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
Content = Content .. "</ul>"
|
Content = Content .. "</ul>"
|
||||||
Content = Content .. "<h4>Players:</h4><ul>"
|
Content = Content .. "<h4>Players:</h4><ul>"
|
||||||
|
|
||||||
cRoot:Get():ForEachPlayer(
|
cRoot:Get():ForEachPlayer(
|
||||||
function(a_CBPlayer)
|
function(a_CBPlayer)
|
||||||
Content = Content .. "<li>" .. a_CBPlayer:GetName() .. "</li>"
|
Content = Content .. "<li>" .. a_CBPlayer:GetName() .. "</li>"
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
Content = Content .. "</ul><br>";
|
Content = Content .. "</ul><br>";
|
||||||
|
|
||||||
return Content, SubTitle
|
return Content, SubTitle
|
||||||
@ -69,17 +69,17 @@ function ShowPage(WebAdmin, TemplateRequest)
|
|||||||
if (PageContent == "") then
|
if (PageContent == "") then
|
||||||
PageContent, SubTitle = GetDefaultPage()
|
PageContent, SubTitle = GetDefaultPage()
|
||||||
end
|
end
|
||||||
|
|
||||||
local reqParamsClass = ""
|
local reqParamsClass = ""
|
||||||
|
|
||||||
for key,value in pairs(TemplateRequest.Request.Params) do
|
for key,value in pairs(TemplateRequest.Request.Params) do
|
||||||
reqParamsClass = reqParamsClass .. " param-" .. string.lower(string.gsub(key, "[^a-zA-Z0-9]+", "-") .. "-" .. string.gsub(value, "[^a-zA-Z0-9]+", "-"))
|
reqParamsClass = reqParamsClass .. " param-" .. string.lower(string.gsub(key, "[^a-zA-Z0-9]+", "-") .. "-" .. string.gsub(value, "[^a-zA-Z0-9]+", "-"))
|
||||||
end
|
end
|
||||||
|
|
||||||
if (string.gsub(reqParamsClass, "%s", "") == "") then
|
if (string.gsub(reqParamsClass, "%s", "") == "") then
|
||||||
reqParamsClass = " no-param"
|
reqParamsClass = " no-param"
|
||||||
end
|
end
|
||||||
|
|
||||||
Output([[
|
Output([[
|
||||||
<!-- Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 -->
|
<!-- Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 -->
|
||||||
<html>
|
<html>
|
||||||
@ -140,7 +140,7 @@ function ShowPage(WebAdmin, TemplateRequest)
|
|||||||
local TabNames = value:GetTabNames()
|
local TabNames = value:GetTabNames()
|
||||||
if (GetTableSize(TabNames) > 0) then
|
if (GetTableSize(TabNames) > 0) then
|
||||||
Output("<div><a class='usercp_nav_item usercp_nav_pmfolder' style='text-decoration:none;'><b>"..PluginWebTitle.."</b></a></div>\n");
|
Output("<div><a class='usercp_nav_item usercp_nav_pmfolder' style='text-decoration:none;'><b>"..PluginWebTitle.."</b></a></div>\n");
|
||||||
|
|
||||||
for webname,prettyname in pairs(TabNames) do
|
for webname,prettyname in pairs(TabNames) do
|
||||||
Output("<div><a href='" .. BaseURL .. PluginWebTitle .. "/" .. webname .. "' class='usercp_nav_item usercp_nav_sub_pmfolder'>" .. prettyname .. "</a></div>\n")
|
Output("<div><a href='" .. BaseURL .. PluginWebTitle .. "/" .. webname .. "' class='usercp_nav_item usercp_nav_sub_pmfolder'>" .. prettyname .. "</a></div>\n")
|
||||||
end
|
end
|
||||||
@ -149,7 +149,7 @@ function ShowPage(WebAdmin, TemplateRequest)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
Output([[
|
Output([[
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -179,9 +179,9 @@ function ShowPage(WebAdmin, TemplateRequest)
|
|||||||
<ul class="menu bottom_links">
|
<ul class="menu bottom_links">
|
||||||
<li><a href="http://cuberite.org" target="_blank">Cuberite</a></li>
|
<li><a href="http://cuberite.org" target="_blank">Cuberite</a></li>
|
||||||
<li><a href="http://forum.mc-server.org" target="_blank">Forums</a></li>
|
<li><a href="http://forum.mc-server.org" target="_blank">Forums</a></li>
|
||||||
<li><a href="http://builds.cuberite.org" target="_blank">Buildserver</a></li>
|
<li><a href="https://builds.cuberite.org" target="_blank">Buildserver</a></li>
|
||||||
<li><a href="http://api-docs.cuberite.org" target="_blank">API Documentation</a></li>
|
<li><a href="http://api-docs.cuberite.org" target="_blank">API Documentation</a></li>
|
||||||
<li><a href="http://book.cuberite.org/" target="_blank">User's Manual</a></li>
|
<li><a href="https://book.cuberite.org/" target="_blank">User's Manual</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -195,6 +195,6 @@ function ShowPage(WebAdmin, TemplateRequest)
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
]])
|
]])
|
||||||
|
|
||||||
return table.concat(SiteContent)
|
return table.concat(SiteContent)
|
||||||
end
|
end
|
||||||
|
@ -34,7 +34,7 @@ all: BlockZapper
|
|||||||
# CXX_OPTIONS ... options for the C++ code compiler
|
# CXX_OPTIONS ... options for the C++ code compiler
|
||||||
# LNK_OPTIONS ... options for the linker
|
# LNK_OPTIONS ... options for the linker
|
||||||
# LNK_LIBS ... libraries to link in
|
# LNK_LIBS ... libraries to link in
|
||||||
# -- according to http://stackoverflow.com/questions/6183899/undefined-reference-to-dlopen, libs must come after all sources
|
# -- according to https://stackoverflow.com/questions/6183899/undefined-reference-to-dlopen, libs must come after all sources
|
||||||
# BUILDDIR ... folder where the intermediate object files are built
|
# BUILDDIR ... folder where the intermediate object files are built
|
||||||
|
|
||||||
LNK_LIBS = -lstdc++ -ldl -lz
|
LNK_LIBS = -lstdc++ -ldl -lz
|
||||||
@ -139,7 +139,7 @@ SHAREDOBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(SHAREDOBJECTS))
|
|||||||
BlockZapper : $(OBJECTS) $(SHAREDOBJECTS)
|
BlockZapper : $(OBJECTS) $(SHAREDOBJECTS)
|
||||||
$(CC) $(LNK_OPTIONS) $(OBJECTS) $(SHAREDOBJECTS) $(LNK_LIBS) -o BlockZapper
|
$(CC) $(LNK_OPTIONS) $(OBJECTS) $(SHAREDOBJECTS) $(LNK_LIBS) -o BlockZapper
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm -rf $(BUILDDIR) BlockZapper
|
rm -rf $(BUILDDIR) BlockZapper
|
||||||
|
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ clean :
|
|||||||
# -MM ... generate a list of includes
|
# -MM ... generate a list of includes
|
||||||
|
|
||||||
$(BUILDDIR)%.o: %.c
|
$(BUILDDIR)%.o: %.c
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(CC_OPTIONS) -x c -c $(INCLUDE) $< -o $@
|
$(CC) $(CC_OPTIONS) -x c -c $(INCLUDE) $< -o $@
|
||||||
@$(CC) $(CC_OPTIONS) -x c -MM $(INCLUDE) $< > $(patsubst %.o,%.d,$@)
|
@$(CC) $(CC_OPTIONS) -x c -MM $(INCLUDE) $< > $(patsubst %.o,%.d,$@)
|
||||||
@mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d,$@).tmp
|
@mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d,$@).tmp
|
||||||
|
@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 2.6)
|
|||||||
|
|
||||||
project (MCADefrag)
|
project (MCADefrag)
|
||||||
|
|
||||||
# Without this, the MSVC variable isn't defined for MSVC builds ( http://www.cmake.org/pipermail/cmake/2011-November/047130.html )
|
# Without this, the MSVC variable isn't defined for MSVC builds ( https://www.cmake.org/pipermail/cmake/2011-November/047130.html )
|
||||||
enable_language(CXX C)
|
enable_language(CXX C)
|
||||||
|
|
||||||
include(../../SetFlags.cmake)
|
include(../../SetFlags.cmake)
|
||||||
@ -106,4 +106,3 @@ add_executable(MCADefrag
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(MCADefrag zlib)
|
target_link_libraries(MCADefrag zlib)
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -141,7 +141,7 @@ generates a grid of alternating biomes.</p>
|
|||||||
<h3>Voronoi diagram</h3>
|
<h3>Voronoi diagram</h3>
|
||||||
<p>Those two generators were more of a technicality, we need to make something more interesting if we're
|
<p>Those two generators were more of a technicality, we need to make something more interesting if we're
|
||||||
going for a natural look. The Voronoi generator is the first step towards such a change. Recall that a
|
going for a natural look. The Voronoi generator is the first step towards such a change. Recall that a
|
||||||
<a href="http://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi diagram</a> is a construct that creates a
|
<a href="https://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi diagram</a> is a construct that creates a
|
||||||
set of areas where each point in an area is closer to the appropriate seed of the area than the seeds of any
|
set of areas where each point in an area is closer to the appropriate seed of the area than the seeds of any
|
||||||
other area:</p>
|
other area:</p>
|
||||||
<img src="img/voronoi.png" />
|
<img src="img/voronoi.png" />
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
PLATFORM=$(uname -m)
|
PLATFORM=$(uname -m)
|
||||||
|
|
||||||
echo "Identifying platform: $PLATFORM"
|
echo "Identifying platform: $PLATFORM"
|
||||||
case $PLATFORM in
|
case $PLATFORM in
|
||||||
"i686") DOWNLOADURL="http://builds.cuberite.org/job/Cuberite%20Linux%20x86%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;;
|
"i686") DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20x86%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;;
|
||||||
"x86_64") DOWNLOADURL="http://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;;
|
"x86_64") DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;;
|
||||||
# Assume that all arm devices are a raspi for now.
|
# Assume that all arm devices are a raspi for now.
|
||||||
arm*) DOWNLOADURL="http://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz"
|
arm*) DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "Downloading precompiled binaries."
|
echo "Downloading precompiled binaries."
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
inline unsigned int GetTime()
|
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<unsigned int>(std::chrono::seconds(time(0)).count());
|
return static_cast<unsigned int>(std::chrono::seconds(time(0)).count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
class cBlockFarmlandHandler :
|
class cBlockFarmlandHandler :
|
||||||
public cBlockHandler
|
public cBlockHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cBlockFarmlandHandler(BLOCKTYPE a_BlockType) :
|
cBlockFarmlandHandler(BLOCKTYPE a_BlockType) :
|
||||||
cBlockHandler(a_BlockType)
|
cBlockHandler(a_BlockType)
|
||||||
@ -104,7 +104,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search for water in a close proximity:
|
// 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
|
// TODO: Rewrite this to use the chunk and its neighbors directly
|
||||||
cBlockArea Area;
|
cBlockArea Area;
|
||||||
int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
|
int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
|
||||||
@ -139,7 +139,3 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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 with even digit length
|
||||||
- (TODO) Hex numbers in lowercase
|
- (TODO) Hex numbers in lowercase
|
||||||
- (TODO) Not using "* "-style doxy comment continuation lines
|
- (TODO) Not using "* "-style doxy comment continuation lines
|
||||||
|
|
||||||
Violations that cannot be checked easily:
|
Violations that cannot be checked easily:
|
||||||
- Spaces around "+" (there are things like "a++", "++a", "a += 1", "X+", "stack +1" and ascii-drawn tables)
|
- 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
|
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.
|
the line brings the editor directly to the violation.
|
||||||
|
|
||||||
@ -114,38 +114,38 @@ local g_ViolationPatterns =
|
|||||||
|
|
||||||
-- Check against indenting using spaces:
|
-- Check against indenting using spaces:
|
||||||
{"^\t* +", "Indenting with a space"},
|
{"^\t* +", "Indenting with a space"},
|
||||||
|
|
||||||
-- Check against alignment using tabs:
|
-- Check against alignment using tabs:
|
||||||
{"[^%s]\t+[^%s]", "Aligning with a tab"},
|
{"[^%s]\t+[^%s]", "Aligning with a tab"},
|
||||||
|
|
||||||
-- Check against trailing whitespace:
|
-- Check against trailing whitespace:
|
||||||
{"[^%s]%s+\n", "Trailing whitespace"},
|
{"[^%s]%s+\n", "Trailing whitespace"},
|
||||||
|
|
||||||
-- Check that all "//"-style comments have at least two spaces in front (unless alone on line):
|
-- 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"},
|
{"[^%s] //", "Needs at least two spaces in front of a \"//\"-style comment"},
|
||||||
|
|
||||||
-- Check that all "//"-style comments have at least one spaces after:
|
-- Check that all "//"-style comments have at least one spaces after:
|
||||||
{"%s//[^%s/*<]", "Needs a space after a \"//\"-style comment"},
|
{"%s//[^%s/*<]", "Needs a space after a \"//\"-style comment"},
|
||||||
|
|
||||||
-- Check that doxy-comments are used only in the double-asterisk form:
|
-- Check that doxy-comments are used only in the double-asterisk form:
|
||||||
{"/// ", "Use doxycomments in the form /** Comment */"},
|
{"/// ", "Use doxycomments in the form /** Comment */"},
|
||||||
|
|
||||||
-- Check that /* */ comments have whitespace around the insides:
|
-- Check that /* */ comments have whitespace around the insides:
|
||||||
{"%*%*/", "Wrong comment termination, use */"},
|
{"%*%*/", "Wrong comment termination, use */"},
|
||||||
{"/%*[^%s*/\"]", "Needs a space after /*"}, -- Need to take care of the special "//*/" comment ends
|
{"/%*[^%s*/\"]", "Needs a space after /*"}, -- Need to take care of the special "//*/" comment ends
|
||||||
{"/%*%*[^%s*<]", "Needs a space after /**"},
|
{"/%*%*[^%s*<]", "Needs a space after /**"},
|
||||||
{"[^%s/*]%*/", "Needs a space before */"},
|
{"[^%s/*]%*/", "Needs a space before */"},
|
||||||
|
|
||||||
-- Check against MS XML doxycomments:
|
-- Check against MS XML doxycomments:
|
||||||
{"/%*%* <", "Remove the MS XML markers from comment"},
|
{"/%*%* <", "Remove the MS XML markers from comment"},
|
||||||
|
|
||||||
-- Check that all commas have spaces after them and not in front of them:
|
-- Check that all commas have spaces after them and not in front of them:
|
||||||
{" ,", "Extra space before a \",\""},
|
{" ,", "Extra space before a \",\""},
|
||||||
{",[^%s\"%%\']", "Needs a space after a \",\""}, -- Report all except >> "," << needed for splitting and >>,%s<< needed for formatting
|
{",[^%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:
|
-- Check that opening braces are not at the end of a code line:
|
||||||
{"[^%s].-{\n?$", "Brace should be on a separate line"},
|
{"[^%s].-{\n?$", "Brace should be on a separate line"},
|
||||||
|
|
||||||
-- Space after keywords:
|
-- Space after keywords:
|
||||||
{"[^_]if%(", "Needs a space after \"if\""},
|
{"[^_]if%(", "Needs a space after \"if\""},
|
||||||
{"%sfor%(", "Needs a space after \"for\""},
|
{"%sfor%(", "Needs a space after \"for\""},
|
||||||
@ -153,16 +153,16 @@ local g_ViolationPatterns =
|
|||||||
{"%sswitch%(", "Needs a space after \"switch\""},
|
{"%sswitch%(", "Needs a space after \"switch\""},
|
||||||
{"%scatch%(", "Needs a space after \"catch\""},
|
{"%scatch%(", "Needs a space after \"catch\""},
|
||||||
{"%stemplate<", "Needs a space after \"template\""},
|
{"%stemplate<", "Needs a space after \"template\""},
|
||||||
|
|
||||||
-- No space after keyword's parenthesis:
|
-- No space after keyword's parenthesis:
|
||||||
{"[^%a#]if %( ", "Remove the space after \"(\""},
|
{"[^%a#]if %( ", "Remove the space after \"(\""},
|
||||||
{"for %( ", "Remove the space after \"(\""},
|
{"for %( ", "Remove the space after \"(\""},
|
||||||
{"while %( ", "Remove the space after \"(\""},
|
{"while %( ", "Remove the space after \"(\""},
|
||||||
{"catch %( ", "Remove the space after \"(\""},
|
{"catch %( ", "Remove the space after \"(\""},
|
||||||
|
|
||||||
-- No space before a closing parenthesis:
|
-- No space before a closing parenthesis:
|
||||||
{" %)", "Remove the space before \")\""},
|
{" %)", "Remove the space before \")\""},
|
||||||
|
|
||||||
-- Check spaces around "+":
|
-- Check spaces around "+":
|
||||||
{"^[a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"},
|
{"^[a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"},
|
||||||
{"[!@#$%%%^&*() %[%]\t][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 +"},
|
{"^[a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"},
|
||||||
{"[!@#$%%%^&*() %[%]\t][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
|
-- Cannot check spaces around "-", because the minus is sometimes used as a hyphen between-words
|
||||||
|
|
||||||
-- Check spaces around "*":
|
-- Check spaces around "*":
|
||||||
@ -191,7 +191,7 @@ local g_ViolationPatterns =
|
|||||||
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around &"},
|
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around &"},
|
||||||
{"^[a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"},
|
{"^[a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"},
|
||||||
{"^[^\"]*[!@#$%%%^&*() %[%]\t][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 ">=":
|
-- Check spaces around "==", "<=" and ">=":
|
||||||
{"==[a-zA-Z0-9]+", "Add space after =="},
|
{"==[a-zA-Z0-9]+", "Add space after =="},
|
||||||
{"[a-zA-Z0-9]+==", "Add space before =="},
|
{"[a-zA-Z0-9]+==", "Add space before =="},
|
||||||
@ -212,7 +212,7 @@ local g_ViolationPatterns =
|
|||||||
--- Processes one file
|
--- Processes one file
|
||||||
local function ProcessFile(a_FileName)
|
local function ProcessFile(a_FileName)
|
||||||
assert(type(a_FileName) == "string")
|
assert(type(a_FileName) == "string")
|
||||||
|
|
||||||
-- Read the whole file:
|
-- Read the whole file:
|
||||||
local f, err = io.open(a_FileName, "r")
|
local f, err = io.open(a_FileName, "r")
|
||||||
if (f == nil) then
|
if (f == nil) then
|
||||||
@ -222,7 +222,7 @@ local function ProcessFile(a_FileName)
|
|||||||
end
|
end
|
||||||
local all = f:read("*all")
|
local all = f:read("*all")
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
-- Check that the last line is empty - otherwise processing won't work properly:
|
-- Check that the last line is empty - otherwise processing won't work properly:
|
||||||
local lastChar = string.byte(all, string.len(all))
|
local lastChar = string.byte(all, string.len(all))
|
||||||
if ((lastChar ~= 13) and (lastChar ~= 10)) then
|
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")
|
ReportViolation(a_FileName, numLines, 1, 1, "Missing empty line at file end")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Process each line separately:
|
-- 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 lineCounter = 1
|
||||||
local lastIndentLevel = 0
|
local lastIndentLevel = 0
|
||||||
local isLastLineControl = false
|
local isLastLineControl = false
|
||||||
@ -244,7 +244,7 @@ local function ProcessFile(a_FileName)
|
|||||||
for _, pat in ipairs(g_ViolationPatterns) do
|
for _, pat in ipairs(g_ViolationPatterns) do
|
||||||
ReportViolationIfFound(a_Line, a_FileName, lineCounter, pat[1], pat[2])
|
ReportViolationIfFound(a_Line, a_FileName, lineCounter, pat[1], pat[2])
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check that divider comments are well formed - 80 slashes plus optional indent:
|
-- Check that divider comments are well formed - 80 slashes plus optional indent:
|
||||||
local dividerStart, dividerEnd = a_Line:find("/////*")
|
local dividerStart, dividerEnd = a_Line:find("/////*")
|
||||||
if (dividerStart) then
|
if (dividerStart) then
|
||||||
@ -260,7 +260,7 @@ local function ProcessFile(a_FileName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check the indent level change from the last line, if it's too much, report:
|
-- Check the indent level change from the last line, if it's too much, report:
|
||||||
local indentStart, indentEnd = a_Line:find("\t+")
|
local indentStart, indentEnd = a_Line:find("\t+")
|
||||||
local indentLevel = 0
|
local indentLevel = 0
|
||||||
@ -273,7 +273,7 @@ local function ProcessFile(a_FileName)
|
|||||||
end
|
end
|
||||||
lastIndentLevel = indentLevel
|
lastIndentLevel = indentLevel
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check that control statements have braces on separate lines after them:
|
-- 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
|
-- Note that if statements can be broken into multiple lines, in which case this test is not taken
|
||||||
if (isLastLineControl) then
|
if (isLastLineControl) then
|
||||||
@ -304,12 +304,12 @@ end
|
|||||||
--- Processes one item - a file or a folder
|
--- Processes one item - a file or a folder
|
||||||
local function ProcessItem(a_ItemName)
|
local function ProcessItem(a_ItemName)
|
||||||
assert(type(a_ItemName) == "string")
|
assert(type(a_ItemName) == "string")
|
||||||
|
|
||||||
-- Skip files / folders that should be ignored
|
-- Skip files / folders that should be ignored
|
||||||
if (g_ShouldIgnoreFile[a_ItemName]) then
|
if (g_ShouldIgnoreFile[a_ItemName]) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local ext = a_ItemName:match("%.([^/%.]-)$")
|
local ext = a_ItemName:match("%.([^/%.]-)$")
|
||||||
if (g_ShouldProcessExt[ext]) then
|
if (g_ShouldProcessExt[ext]) then
|
||||||
ProcessFile(a_ItemName)
|
ProcessFile(a_ItemName)
|
||||||
@ -340,7 +340,7 @@ local CmdLineHandlers =
|
|||||||
table.insert(ToProcess, fnam)
|
table.insert(ToProcess, fnam)
|
||||||
return a_Idx + 2 -- skip the filename in param parsing
|
return a_Idx + 2 -- skip the filename in param parsing
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- "-g" checks files reported by git as being committed.
|
-- "-g" checks files reported by git as being committed.
|
||||||
["-g"] = function (a_Args, a_Idx)
|
["-g"] = function (a_Args, a_Idx)
|
||||||
local f = io.popen("git diff --cached --name-only --diff-filter=ACMR")
|
local f = io.popen("git diff --cached --name-only --diff-filter=ACMR")
|
||||||
@ -348,7 +348,7 @@ local CmdLineHandlers =
|
|||||||
table.insert(ToProcess, fnam)
|
table.insert(ToProcess, fnam)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- "-h" prints help and exits
|
-- "-h" prints help and exits
|
||||||
["-h"] = function (a_Args, a_Idx)
|
["-h"] = function (a_Args, a_Idx)
|
||||||
print([[
|
print([[
|
||||||
@ -368,7 +368,7 @@ Only .cpp and .h files are ever checked.
|
|||||||
]])
|
]])
|
||||||
os.exit(0)
|
os.exit(0)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- "-l listfile" loads the list of files to check from the specified listfile
|
-- "-l listfile" loads the list of files to check from the specified listfile
|
||||||
["-l"] = function (a_Args, a_Idx)
|
["-l"] = function (a_Args, a_Idx)
|
||||||
local listFile = a_Args[a_Idx + 1]
|
local listFile = a_Args[a_Idx + 1]
|
||||||
@ -380,7 +380,7 @@ Only .cpp and .h files are ever checked.
|
|||||||
end
|
end
|
||||||
return a_Idx + 2 -- Skip the listfile in param parsing
|
return a_Idx + 2 -- Skip the listfile in param parsing
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- "--" reads the list of files from stdin
|
-- "--" reads the list of files from stdin
|
||||||
["--"] = function (a_Args, a_Idx)
|
["--"] = function (a_Args, a_Idx)
|
||||||
for fnam in io.lines() do
|
for fnam in io.lines() do
|
||||||
@ -425,7 +425,7 @@ for _, fnam in ipairs(ToProcess) do
|
|||||||
if (fnam:sub(1, 2) == "./") then
|
if (fnam:sub(1, 2) == "./") then
|
||||||
fnam = fnam:sub(3)
|
fnam = fnam:sub(3)
|
||||||
end
|
end
|
||||||
|
|
||||||
ProcessItem(fnam)
|
ProcessItem(fnam)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -440,7 +440,3 @@ if (g_NumViolations > 0) then
|
|||||||
else
|
else
|
||||||
os.exit(0)
|
os.exit(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,10 +67,10 @@ public:
|
|||||||
|
|
||||||
/** Generates the array of templated size into a_Values, based on given min coords. */
|
/** 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;
|
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<int... >
|
template<int... >
|
||||||
struct sSeq
|
struct sSeq
|
||||||
@ -92,7 +92,7 @@ struct sGens<0, S...>
|
|||||||
template<class Gen, class... Args>
|
template<class Gen, class... Args>
|
||||||
class cIntGenFactory
|
class cIntGenFactory
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef Gen Generator;
|
typedef Gen Generator;
|
||||||
@ -101,7 +101,7 @@ public:
|
|||||||
m_args(std::make_tuple<Args...>(std::forward<Args>(a_args)...))
|
m_args(std::make_tuple<Args...>(std::forward<Args>(a_args)...))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class LhsGen>
|
template <class LhsGen>
|
||||||
std::shared_ptr<Gen> construct(LhsGen&& a_Lhs)
|
std::shared_ptr<Gen> construct(LhsGen&& a_Lhs)
|
||||||
{
|
{
|
||||||
@ -111,13 +111,13 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::tuple<Args...> m_args;
|
std::tuple<Args...> m_args;
|
||||||
|
|
||||||
template <class LhsGen, int... S>
|
template <class LhsGen, int... S>
|
||||||
std::shared_ptr<Gen> construct_impl(LhsGen&& a_Lhs, sSeq<S...>)
|
std::shared_ptr<Gen> construct_impl(LhsGen&& a_Lhs, sSeq<S...>)
|
||||||
{
|
{
|
||||||
return std::make_shared<Gen>(std::get<S>(m_args)..., std::forward<LhsGen>(a_Lhs));
|
return std::make_shared<Gen>(std::get<S>(m_args)..., std::forward<LhsGen>(a_Lhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T, class RhsGen, class... Args>
|
template<class T, class RhsGen, class... Args>
|
||||||
@ -1466,7 +1466,3 @@ protected:
|
|||||||
Underlying m_Underlying;
|
Underlying m_Underlying;
|
||||||
Underlying m_Alteration;
|
Underlying m_Alteration;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,12 +68,12 @@ class cCubicNoise
|
|||||||
public:
|
public:
|
||||||
/** Maximum size of each dimension of the query arrays. */
|
/** Maximum size of each dimension of the query arrays. */
|
||||||
static const int MAX_SIZE = 512;
|
static const int MAX_SIZE = 512;
|
||||||
|
|
||||||
|
|
||||||
/** Creates a new instance with the specified seed. */
|
/** Creates a new instance with the specified seed. */
|
||||||
cCubicNoise(int a_Seed);
|
cCubicNoise(int a_Seed);
|
||||||
|
|
||||||
|
|
||||||
/** Fills a 2D array with the values of the noise. */
|
/** Fills a 2D array with the values of the noise. */
|
||||||
void Generate2D(
|
void Generate2D(
|
||||||
NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y]
|
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_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
|
NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY ///< Noise-space coords of the array in the Y direction
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
/** Fills a 3D array with the values of the noise. */
|
/** Fills a 3D array with the values of the noise. */
|
||||||
void Generate3D(
|
void Generate3D(
|
||||||
NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y + a_SizeX * a_SizeY * z]
|
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_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
|
NOISE_DATATYPE a_StartZ, NOISE_DATATYPE a_EndZ ///< Noise-space coords of the array in the Z direction
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Noise used for integral random values. */
|
/** Noise used for integral random values. */
|
||||||
cNoise m_Noise;
|
cNoise m_Noise;
|
||||||
|
|
||||||
@ -115,8 +115,8 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Improved noise, as described by Ken Perlin: http://mrl.nyu.edu/~perlin/paper445.pdf
|
/** Improved noise, as described by Ken Perlin: https://mrl.nyu.edu/~perlin/paper445.pdf
|
||||||
Implementation adapted from Perlin's Java implementation: http://mrl.nyu.edu/~perlin/noise/ */
|
Implementation adapted from Perlin's Java implementation: https://mrl.nyu.edu/~perlin/noise/ */
|
||||||
class cImprovedNoise
|
class cImprovedNoise
|
||||||
{
|
{
|
||||||
public:
|
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_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
|
NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY ///< Noise-space coords of the array in the Y direction
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
/** Fills a 3D array with the values of the noise. */
|
/** Fills a 3D array with the values of the noise. */
|
||||||
void Generate3D(
|
void Generate3D(
|
||||||
NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y + a_SizeX * a_SizeY * z]
|
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);
|
return Lerp(a_Val1, a_Val2, a_Ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
#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;
|
const DWORD MS_VC_EXCEPTION = 0x406D1388;
|
||||||
#pragma pack(push, 8)
|
#pragma pack(push, 8)
|
||||||
@ -144,7 +144,3 @@ bool cIsThread::Wait(void)
|
|||||||
LOGD("Thread %s finished", m_ThreadName.c_str());
|
LOGD("Thread %s finished", m_ThreadName.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,14 +35,10 @@ void PrintStackTrace(void)
|
|||||||
#else
|
#else
|
||||||
#ifdef __GLIBC__
|
#ifdef __GLIBC__
|
||||||
// Use the backtrace() function to get and output the stackTrace:
|
// 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];
|
void * stackTrace[30];
|
||||||
auto numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
|
auto numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
|
||||||
backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO);
|
backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ static const AString & GetCACerts(void)
|
|||||||
|
|
||||||
// Starfield G2 cert
|
// 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
|
// 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"
|
"-----BEGIN CERTIFICATE-----\n"
|
||||||
"MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx\n"
|
"MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx\n"
|
||||||
"EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT\n"
|
"EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT\n"
|
||||||
@ -118,7 +118,7 @@ static const AString & GetCACerts(void)
|
|||||||
"WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q=\n"
|
"WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q=\n"
|
||||||
"-----END CERTIFICATE-----\n"
|
"-----END CERTIFICATE-----\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
return Cert;
|
return Cert;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ cMojangAPI::sProfile::sProfile(
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Parse the Textures and TexturesSignature from the Profile:
|
// Parse the Textures and TexturesSignature from the Profile:
|
||||||
if (!a_Properties.isArray())
|
if (!a_Properties.isArray())
|
||||||
{
|
{
|
||||||
@ -272,7 +272,7 @@ AString cMojangAPI::GetUUIDFromPlayerName(const AString & a_PlayerName, bool a_U
|
|||||||
{
|
{
|
||||||
// Convert the playername to lowercase:
|
// Convert the playername to lowercase:
|
||||||
AString lcPlayerName = StrToLower(a_PlayerName);
|
AString lcPlayerName = StrToLower(a_PlayerName);
|
||||||
|
|
||||||
// Request the cache to query the name if not yet cached:
|
// Request the cache to query the name if not yet cached:
|
||||||
if (!a_UseOnlyCached)
|
if (!a_UseOnlyCached)
|
||||||
{
|
{
|
||||||
@ -280,7 +280,7 @@ AString cMojangAPI::GetUUIDFromPlayerName(const AString & a_PlayerName, bool a_U
|
|||||||
PlayerNames.push_back(lcPlayerName);
|
PlayerNames.push_back(lcPlayerName);
|
||||||
CacheNamesToUUIDs(PlayerNames);
|
CacheNamesToUUIDs(PlayerNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve from cache:
|
// Retrieve from cache:
|
||||||
cCSLock Lock(m_CSNameToUUID);
|
cCSLock Lock(m_CSNameToUUID);
|
||||||
cProfileMap::const_iterator itr = m_NameToUUID.find(lcPlayerName);
|
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:
|
// Normalize the UUID to lowercase short format that is used as the map key:
|
||||||
AString UUID = MakeUUIDShort(a_UUID);
|
AString UUID = MakeUUIDShort(a_UUID);
|
||||||
|
|
||||||
// Retrieve from caches:
|
// Retrieve from caches:
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSUUIDToProfile);
|
cCSLock Lock(m_CSUUIDToProfile);
|
||||||
@ -325,7 +325,7 @@ AString cMojangAPI::GetPlayerNameFromUUID(const AString & a_UUID, bool a_UseOnly
|
|||||||
CacheUUIDToProfile(UUID);
|
CacheUUIDToProfile(UUID);
|
||||||
return GetPlayerNameFromUUID(a_UUID, true);
|
return GetPlayerNameFromUUID(a_UUID, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No value found, none queried. Return an error:
|
// No value found, none queried. Return an error:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -342,13 +342,13 @@ AStringVector cMojangAPI::GetUUIDsFromPlayerNames(const AStringVector & a_Player
|
|||||||
{
|
{
|
||||||
PlayerNames.push_back(StrToLower(*itr));
|
PlayerNames.push_back(StrToLower(*itr));
|
||||||
} // for itr - a_PlayerNames[]
|
} // for itr - a_PlayerNames[]
|
||||||
|
|
||||||
// Request the cache to populate any names not yet contained:
|
// Request the cache to populate any names not yet contained:
|
||||||
if (!a_UseOnlyCached)
|
if (!a_UseOnlyCached)
|
||||||
{
|
{
|
||||||
CacheNamesToUUIDs(PlayerNames);
|
CacheNamesToUUIDs(PlayerNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve from cache:
|
// Retrieve from cache:
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
AStringVector res;
|
AStringVector res;
|
||||||
@ -367,7 +367,7 @@ AStringVector cMojangAPI::GetUUIDsFromPlayerNames(const AStringVector & a_Player
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cMojangAPI::AddPlayerNameToUUIDMapping(const AString & a_PlayerName, const AString & a_UUID)
|
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
|
// Already is a short UUID, only lowercase
|
||||||
return StrToLower(a_UUID);
|
return StrToLower(a_UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 36:
|
case 36:
|
||||||
{
|
{
|
||||||
// Remove the dashes from the string by appending together the parts between them:
|
// 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
|
// Already is a dashed UUID, only lowercase
|
||||||
return StrToLower(a_UUID);
|
return StrToLower(a_UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
// Insert dashes at the proper positions:
|
// 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);
|
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 PlayerNameToUUID (PlayerName, UUID, DateTime)");
|
||||||
db.exec("CREATE TABLE IF NOT EXISTS UUIDToProfile (UUID, PlayerName, Textures, TexturesSignature, DateTime)");
|
db.exec("CREATE TABLE IF NOT EXISTS UUIDToProfile (UUID, PlayerName, Textures, TexturesSignature, DateTime)");
|
||||||
|
|
||||||
// Retrieve all entries:
|
// Retrieve all entries:
|
||||||
{
|
{
|
||||||
SQLite::Statement stmt(db, "SELECT PlayerName, UUID, DateTime FROM PlayerNameToUUID");
|
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);
|
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 PlayerNameToUUID (PlayerName, UUID, DateTime)");
|
||||||
db.exec("CREATE TABLE IF NOT EXISTS UUIDToProfile (UUID, PlayerName, Textures, TexturesSignature, DateTime)");
|
db.exec("CREATE TABLE IF NOT EXISTS UUIDToProfile (UUID, PlayerName, Textures, TexturesSignature, DateTime)");
|
||||||
|
|
||||||
// Remove all entries:
|
// Remove all entries:
|
||||||
db.exec("DELETE FROM PlayerNameToUUID");
|
db.exec("DELETE FROM PlayerNameToUUID");
|
||||||
db.exec("DELETE FROM UUIDToProfile");
|
db.exec("DELETE FROM UUIDToProfile");
|
||||||
|
|
||||||
// Save all cache entries - m_PlayerNameToUUID:
|
// Save all cache entries - m_PlayerNameToUUID:
|
||||||
Int64 LimitDateTime = time(nullptr) - MAX_AGE;
|
Int64 LimitDateTime = time(nullptr) - MAX_AGE;
|
||||||
{
|
{
|
||||||
@ -658,7 +658,7 @@ void cMojangAPI::CacheNamesToUUIDs(const AStringVector & a_PlayerNames)
|
|||||||
}
|
}
|
||||||
} // for itr - a_PlayerNames[]
|
} // for itr - a_PlayerNames[]
|
||||||
} // Lock(m_CSNameToUUID)
|
} // Lock(m_CSNameToUUID)
|
||||||
|
|
||||||
QueryNamesToUUIDs(NamesToQuery);
|
QueryNamesToUUIDs(NamesToQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,7 +720,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Response.erase(0, idxHeadersEnd + 4);
|
Response.erase(0, idxHeadersEnd + 4);
|
||||||
|
|
||||||
// Parse the returned string into Json:
|
// Parse the returned string into Json:
|
||||||
Json::Reader reader;
|
Json::Reader reader;
|
||||||
if (!reader.parse(Response, root, false) || !root.isArray())
|
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());
|
LOGD("Response body:\n%s", CreateHexDump(HexDump, Response.data(), Response.size(), 16).c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the returned results into cache:
|
// Store the returned results into cache:
|
||||||
Json::Value::UInt JsonCount = root.size();
|
Json::Value::UInt JsonCount = root.size();
|
||||||
Int64 Now = time(nullptr);
|
Int64 Now = time(nullptr);
|
||||||
@ -748,7 +748,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery)
|
|||||||
NotifyNameUUID(JsonName, JsonUUID);
|
NotifyNameUUID(JsonName, JsonUUID);
|
||||||
} // for idx - root[]
|
} // for idx - root[]
|
||||||
} // cCSLock (m_CSNameToUUID)
|
} // cCSLock (m_CSNameToUUID)
|
||||||
|
|
||||||
// Also cache the UUIDToName:
|
// Also cache the UUIDToName:
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSUUIDToName);
|
cCSLock Lock(m_CSUUIDToName);
|
||||||
@ -774,7 +774,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery)
|
|||||||
void cMojangAPI::CacheUUIDToProfile(const AString & a_UUID)
|
void cMojangAPI::CacheUUIDToProfile(const AString & a_UUID)
|
||||||
{
|
{
|
||||||
ASSERT(a_UUID.size() == 32);
|
ASSERT(a_UUID.size() == 32);
|
||||||
|
|
||||||
// Check if already present:
|
// Check if already present:
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSUUIDToProfile);
|
cCSLock Lock(m_CSUUIDToProfile);
|
||||||
@ -783,7 +783,7 @@ void cMojangAPI::CacheUUIDToProfile(const AString & a_UUID)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryUUIDToProfile(a_UUID);
|
QueryUUIDToProfile(a_UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -796,7 +796,7 @@ void cMojangAPI::QueryUUIDToProfile(const AString & a_UUID)
|
|||||||
// Create the request address:
|
// Create the request address:
|
||||||
AString Address = m_UUIDToProfileAddress;
|
AString Address = m_UUIDToProfileAddress;
|
||||||
ReplaceString(Address, "%UUID%", a_UUID);
|
ReplaceString(Address, "%UUID%", a_UUID);
|
||||||
|
|
||||||
// Create the HTTP request:
|
// Create the HTTP request:
|
||||||
AString 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
|
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;
|
return;
|
||||||
}
|
}
|
||||||
Response.erase(0, idxHeadersEnd + 4);
|
Response.erase(0, idxHeadersEnd + 4);
|
||||||
|
|
||||||
// Parse the returned string into Json:
|
// Parse the returned string into Json:
|
||||||
Json::Reader reader;
|
Json::Reader reader;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
@ -943,7 +943,3 @@ void cMojangAPI::Update(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -767,7 +767,7 @@ int cRoot::GetVirtualRAMUsage(void)
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
#elif defined(__linux__)
|
#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");
|
std::ifstream StatFile("/proc/self/status");
|
||||||
if (!StatFile.good())
|
if (!StatFile.good())
|
||||||
{
|
{
|
||||||
@ -785,7 +785,7 @@ int cRoot::GetVirtualRAMUsage(void)
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
#elif defined (__APPLE__)
|
#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;
|
struct task_basic_info t_info;
|
||||||
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
|
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
|
||||||
|
|
||||||
@ -819,7 +819,7 @@ int cRoot::GetPhysicalRAMUsage(void)
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
#elif defined(__linux__)
|
#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");
|
std::ifstream StatFile("/proc/self/status");
|
||||||
if (!StatFile.good())
|
if (!StatFile.good())
|
||||||
{
|
{
|
||||||
@ -837,7 +837,7 @@ int cRoot::GetPhysicalRAMUsage(void)
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
#elif defined (__APPLE__)
|
#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;
|
struct task_basic_info t_info;
|
||||||
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
|
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
AString & AppendVPrintf(AString & str, const char * format, va_list args)
|
AString & AppendVPrintf(AString & str, const char * format, va_list args)
|
||||||
{
|
{
|
||||||
ASSERT(format != nullptr);
|
ASSERT(format != nullptr);
|
||||||
|
|
||||||
char buffer[2048];
|
char buffer[2048];
|
||||||
int len;
|
int len;
|
||||||
#ifdef va_copy
|
#ifdef va_copy
|
||||||
@ -47,7 +47,7 @@ AString & AppendVPrintf(AString & str, const char * format, va_list args)
|
|||||||
#ifdef va_copy
|
#ifdef va_copy
|
||||||
va_end(argsCopy);
|
va_end(argsCopy);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The result did not fit into the static buffer, use a dynamic buffer:
|
// The result did not fit into the static buffer, use a dynamic buffer:
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// for MS CRT, we need to calculate the result length
|
// 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;
|
return str;
|
||||||
}
|
}
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
// Allocate a buffer and printf into it:
|
// Allocate a buffer and printf into it:
|
||||||
#ifdef va_copy
|
#ifdef va_copy
|
||||||
va_copy(argsCopy, args);
|
va_copy(argsCopy, args);
|
||||||
@ -232,7 +232,7 @@ AString TrimString(const AString & str)
|
|||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t end = len;
|
size_t end = len;
|
||||||
while (end >= start)
|
while (end >= start)
|
||||||
{
|
{
|
||||||
@ -242,7 +242,7 @@ AString TrimString(const AString & str)
|
|||||||
}
|
}
|
||||||
--end;
|
--end;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str.substr(start, end - start + 1);
|
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:
|
// 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
|
// Begin of Unicode, Inc.'s code / information
|
||||||
@ -524,7 +524,7 @@ std::u16string UTF8ToRawBEUTF16(const AString & a_UTF8)
|
|||||||
{
|
{
|
||||||
return UTF16;
|
return UTF16;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The cases all fall through. See "Note A" below.
|
// The cases all fall through. See "Note A" below.
|
||||||
switch (extraBytesToRead)
|
switch (extraBytesToRead)
|
||||||
{
|
{
|
||||||
@ -609,7 +609,7 @@ AString & CreateHexDump(AString & a_Out, const void * a_Data, size_t a_Size, siz
|
|||||||
char line[512];
|
char line[512];
|
||||||
char * p;
|
char * p;
|
||||||
char * q;
|
char * q;
|
||||||
|
|
||||||
a_Out.reserve(a_Size / a_BytesPerLine * (18 + 6 * a_BytesPerLine));
|
a_Out.reserve(a_Size / a_BytesPerLine * (18 + 6 * a_BytesPerLine));
|
||||||
for (size_t i = 0; i < a_Size; i += 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));
|
a_Output.push_back(a_Strings.substr(start, size - start));
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1000,7 +1000,3 @@ AString StringsConcat(const AStringVector & a_Strings, char a_Separator)
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ all: NoiseTest
|
|||||||
# CXX_OPTIONS ... options for the C++ code compiler
|
# CXX_OPTIONS ... options for the C++ code compiler
|
||||||
# LNK_OPTIONS ... options for the linker
|
# LNK_OPTIONS ... options for the linker
|
||||||
# LNK_LIBS ... libraries to link in
|
# LNK_LIBS ... libraries to link in
|
||||||
# -- according to http://stackoverflow.com/questions/6183899/undefined-reference-to-dlopen, libs must come after all sources
|
# -- according to https://stackoverflow.com/questions/6183899/undefined-reference-to-dlopen, libs must come after all sources
|
||||||
# BUILDDIR ... folder where the intermediate object files are built
|
# BUILDDIR ... folder where the intermediate object files are built
|
||||||
|
|
||||||
LNK_LIBS = -lstdc++ -ldl
|
LNK_LIBS = -lstdc++ -ldl
|
||||||
@ -120,7 +120,7 @@ SHAREDOBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(SHAREDOBJECTS))
|
|||||||
NoiseTest : $(OBJECTS) $(SHAREDOBJECTS)
|
NoiseTest : $(OBJECTS) $(SHAREDOBJECTS)
|
||||||
$(CC) $(LNK_OPTIONS) $(OBJECTS) $(SHAREDOBJECTS) $(LNK_LIBS) -o NoiseTest
|
$(CC) $(LNK_OPTIONS) $(OBJECTS) $(SHAREDOBJECTS) $(LNK_LIBS) -o NoiseTest
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm -rf $(BUILDDIR) NoiseTest
|
rm -rf $(BUILDDIR) NoiseTest
|
||||||
|
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ clean :
|
|||||||
# -MM ... generate a list of includes
|
# -MM ... generate a list of includes
|
||||||
|
|
||||||
$(BUILDDIR)%.o: %.c
|
$(BUILDDIR)%.o: %.c
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(CC_OPTIONS) -x c -c $(INCLUDE) $< -o $@
|
$(CC) $(CC_OPTIONS) -x c -c $(INCLUDE) $< -o $@
|
||||||
@$(CC) $(CC_OPTIONS) -x c -MM $(INCLUDE) $< > $(patsubst %.o,%.d,$@)
|
@$(CC) $(CC_OPTIONS) -x c -MM $(INCLUDE) $< > $(patsubst %.o,%.d,$@)
|
||||||
@mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d,$@).tmp
|
@mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d,$@).tmp
|
||||||
|
Loading…
Reference in New Issue
Block a user