瀏覽代碼

Remove obsolete code.

legacy
Sam Hocevar 4 年之前
父節點
當前提交
c142c1c8a5
共有 5 個文件被更改,包括 1 次插入178 次删除
  1. +1
    -1
      src/Makefile.am
  2. +0
    -123
      src/base/string.cpp
  3. +0
    -1
      src/lol-core.vcxproj
  4. +0
    -3
      src/lol-core.vcxproj.filters
  5. +0
    -50
      src/sys/hacks.cpp

+ 1
- 1
src/Makefile.am 查看文件

@@ -103,7 +103,7 @@ liblol_core_sources = \
mesh/mesh.cpp mesh/mesh.h \
mesh/primitivemesh.cpp mesh/primitivemesh.h \
\
sys/init.cpp sys/file.cpp sys/hacks.cpp \
sys/init.cpp sys/file.cpp \
\
image/resource.cpp image/resource-private.h \
image/image.cpp image/image-private.h image/kernel.cpp image/pixel.cpp \


+ 0
- 123
src/base/string.cpp 查看文件

@@ -1,123 +0,0 @@
//
// Lol Engine
//
// Copyright © 2010—2018 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

#include <lol/engine-internal.h>

#include <cstdio>
#include <string>

#if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef WIN32_LEAN_AND_MEAN
#endif

#include <cstdarg>
#include <cctype>

namespace lol
{

array<std::string> split(std::string const &s, char sep)
{
array<std::string> ret;
size_t start = 0, end = 0;
while ((end = s.find(sep, start)) != std::string::npos)
{
ret << s.substr(start, end - start);
start = end + 1;
}
ret << s.substr(start);
return ret;
}

array<std::string> split(std::string const &s, std::string const &seps)
{
array<std::string> ret;
size_t start = s.find_first_not_of(seps), end = 0;

while ((end = s.find_first_of(seps, start)) != std::string::npos)
{
ret << s.substr(start, end - start);
start = s.find_first_not_of(seps, end);
}
if (start != std::string::npos)
ret << s.substr(start);

return ret;
}

bool starts_with(std::string const &s, std::string const &prefix)
{
return s.size() >= prefix.size() &&
s.compare(0, prefix.size(), prefix) == 0;
}

bool ends_with(std::string const &s, std::string const &suffix)
{
return s.size() >= suffix.size() &&
s.compare(s.size() - suffix.size(), suffix.size(), suffix) == 0;
}

std::string tolower(std::string const &s)
{
std::string ret;
std::transform(s.begin(), s.end(), std::back_inserter(ret),
[](unsigned char c){ return std::tolower(c); });
return ret;
}

std::string toupper(std::string const &s)
{
std::string ret;
std::transform(s.begin(), s.end(), std::back_inserter(ret),
[](unsigned char c){ return std::toupper(c); });
return ret;
}

std::string format(char const *format, ...)
{
va_list ap;
va_start(ap, format);
std::string ret = vformat(format, ap);
va_end(ap);
return ret;
}

std::string vformat(char const *format, va_list ap)
{
va_list ap2;
#if defined va_copy || !defined _MSC_VER
/* Visual Studio 2010 does not support va_copy. */
va_copy(ap2, ap);
#else
ap2 = ap;
#endif

/* vsnprintf() tells us how many characters we need, not counting
* the terminating null character. */
size_t needed = vsnprintf(nullptr, 0, format, ap2);

#if defined va_copy || !defined _MSC_VER
/* do not call va_end() if va_copy() wasn't called. */
va_end(ap2);
#endif

std::string ret;
ret.resize(needed);
vsnprintf(&ret[0], needed + 1, format, ap);

return ret;
}

} /* namespace lol */


+ 0
- 1
src/lol-core.vcxproj 查看文件

@@ -191,7 +191,6 @@
<ClCompile Include="scene.cpp" />
<ClCompile Include="sprite.cpp" />
<ClCompile Include="sys\file.cpp" />
<ClCompile Include="sys\hacks.cpp" />
<ClCompile Include="sys\init.cpp" />
<ClCompile Include="text.cpp" />
<ClCompile Include="textureimage.cpp" />


+ 0
- 3
src/lol-core.vcxproj.filters 查看文件

@@ -203,9 +203,6 @@
<ClCompile Include="sys\file.cpp">
<Filter>sys</Filter>
</ClCompile>
<ClCompile Include="sys\hacks.cpp">
<Filter>sys</Filter>
</ClCompile>
<ClCompile Include="sys\init.cpp">
<Filter>sys</Filter>
</ClCompile>


+ 0
- 50
src/sys/hacks.cpp 查看文件

@@ -1,50 +0,0 @@
//
// Lol Engine
//
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

#include <lol/engine-internal.h>

/*
* VS 2015 hack: the CRT was fully rewritten, and functions such
* as _iob_func() and fprintf() have disappeared. Since we link with
* libSDL which uses these versions, we need to provide them.
*/

#if _MSC_VER >= 1900
#include <cstdio>

extern "C" {

#if _M_X64
void *__imp___iob_func(void)
#else
void *_imp____iob_func(void)
#endif
{
return NULL;
}

#if _M_X64
int __imp_fprintf(FILE *stream, char const *fmt, ...)
#else
int _imp__fprintf(FILE *stream, char const *fmt, ...)
#endif
{
va_list va;
va_start(va, fmt);
int ret = vfprintf(stream, fmt, va);
va_end(va);
return ret;
}

}
#endif


Loading…
取消
儲存