Build fixes and whatnot

This was SVN commit r9115.
This commit is contained in:
Ykkrosh
2011-03-23 21:15:22 +00:00
parent 4a2b47689b
commit 9193ba56f9
14 changed files with 31 additions and 30 deletions
-10
View File
@@ -589,16 +589,6 @@ LibError debug_stl_get_container_info(const wchar_t* type_name, const u8* p, siz
// doing so is lots of work for little gain.)
CONTAINER(queue, L"std::queue<*,std::deque<*> >")
CONTAINER(stack, L"std::stack<*,std::deque<*> >")
// nonstandard containers (will probably be part of C++0x)
#if HAVE_STL_HASH
CONTAINER(hash_map, WIDEN(STRINGIZE(STL_HASH_MAP)) L"<*>")
CONTAINER(hash_multimap, WIDEN(STRINGIZE(STL_HASH_MULTIMAP)) L"<*>")
CONTAINER(hash_set, WIDEN(STRINGIZE(STL_HASH_SET)) L"<*>")
CONTAINER(hash_multiset, WIDEN(STRINGIZE(STL_HASH_MULTISET)) L"<*>")
#endif
#if HAVE_STL_SLIST
CONTAINER(slist, WIDEN(STRINGIZE(STL_SLIST)) L"<*>")
#endif
// note: do not raise warnings - these can happen for new
// STL classes or if the debuggee's memory is corrupted.
+1 -1
View File
@@ -70,7 +70,7 @@ static const LibErrorAssociation* AssociationFromLibError(LibError err)
return 0;
}
static const LibErrorAssociation* AssociationFromErrno(errno_t errno_equivalent)
static const LibErrorAssociation* AssociationFromErrno(int errno_equivalent)
{
for(const LibErrorAssociation* lea = associations; lea; lea = lea->next)
{
+2
View File
@@ -41,6 +41,8 @@
# include "boost/functional/hash.hpp"
#endif
#include <cstring>
namespace ERR
{
const LibError PATH_CHARACTER_ILLEGAL = -100300;
+2 -2
View File
@@ -266,8 +266,8 @@ namespace CxxTest
#define TSM_ASSERT_STR_EQUALS(m, str1, str2) TSM_ASSERT_EQUALS(m, std::string(str1), std::string(str2))
#define TS_ASSERT_WSTR_EQUALS(str1, str2) TS_ASSERT_EQUALS(std::wstring(str1), std::wstring(str2))
#define TSM_ASSERT_WSTR_EQUALS(m, str1, str2) TSM_ASSERT_EQUALS(m, std::wstring(str1), std::wstring(str2))
#define TS_ASSERT_PATH_EQUALS(path1, path2) TS_ASSERT_EQUALS(path1.string(), path2.string())
#define TSM_ASSERT_PATH_EQUALS(m, path1, path2) TSM_ASSERT_EQUALS(m, path1.string(), path2.string())
#define TS_ASSERT_PATH_EQUALS(path1, path2) TS_ASSERT_EQUALS((path1).string(), (path2).string())
#define TSM_ASSERT_PATH_EQUALS(m, path1, path2) TSM_ASSERT_EQUALS(m, (path1).string(), (path2).string())
bool ts_str_contains(const std::wstring& str1, const std::wstring& str2); // defined in test_setup.cpp
#define TS_ASSERT_WSTR_CONTAINS(str1, str2) TSM_ASSERT(str1, ts_str_contains(str1, str2))
+2 -2
View File
@@ -55,7 +55,7 @@ struct wdirent* wreaddir(WDIR* wd)
dirent* ent = readdir(wd->d);
if(!ent)
return 0;
wcscpy_s(wd->name, ARRAY_SIZE(wd->name), ent->d_name);
wcscpy_s(wd->name, ARRAY_SIZE(wd->name), OsPath(ent->d_name).string().c_str());
return &wd->ent;
}
@@ -104,7 +104,7 @@ int wrename(const OsPath& pathnameOld, const OsPath& pathnameNew)
return rename(OsString(pathnameOld).c_str(), OsString(pathnameNew).c_str());
}
OsPath realpath(const OsPath& pathname)
OsPath wrealpath(const OsPath& pathname)
{
char resolvedBuf[PATH_MAX];
const char* resolved = realpath(OsString(pathname).c_str(), resolvedBuf);
+5
View File
@@ -410,3 +410,8 @@ LibError sys_open_url(const std::string& url)
return INFO::OK;
}
}
FILE* sys_OpenFile(const OsPath& pathname, const char* mode)
{
return fopen(OsString(pathname).c_str(), mode);
}
+3
View File
@@ -182,6 +182,9 @@ LIB_API LibError sys_generate_random_bytes(u8* buf, size_t count);
**/
LIB_API LibError sys_get_proxy_config(const std::wstring& url, std::wstring& proxy);
/**
* open a file like with fopen (but taking an OsPath argument).
*/
LIB_API FILE* sys_OpenFile(const OsPath& pathname, const char* mode);
/**
+2 -3
View File
@@ -99,9 +99,8 @@ public:
for (size_t i = 0; i < ARRAY_SIZE(files); ++i)
{
std::string name = rootstr + files[i];
FILE* f;
errno_t err = fopen_s(&f, name.c_str(), "w");
TS_ASSERT_EQUALS(err, 0);
FILE* f = fopen(name.c_str(), "w");
TS_ASSERT(f);
fclose(f);
}
+2 -2
View File
@@ -90,7 +90,7 @@ void CArchiveBuilder::Build(const OsPath& archive)
// Compress textures and store the new cached version instead of the original
if (boost::algorithm::starts_with(path.string(), L"art/textures/") &&
tex_is_known_extension(m_Files[i]) &&
tex_is_known_extension(path) &&
// Skip some subdirectories where the engine doesn't use CTextureManager yet:
!boost::algorithm::starts_with(path.string(), L"art/textures/cursors/") &&
!boost::algorithm::starts_with(path.string(), L"art/textures/terrain/alphamaps/")
@@ -118,7 +118,7 @@ void CArchiveBuilder::Build(const OsPath& archive)
writer->AddFile(realPath, path);
// Also cache XMB versions of all XML files
if (m_Files[i].Extension() == L".xml")
if (path.Extension() == L".xml")
{
VfsPath cachedPath;
debug_printf(L"Converting XML file %ls\n", realPath.string().c_str());
+1 -1
View File
@@ -141,7 +141,7 @@ VfsPath CCacheLoader::LooseCachePath(const VfsPath& sourcePath, const MD5& initi
digestPrefix << std::setfill(L'0') << std::setw(2) << (int)digest[i];
// Construct the final path
return VfsPath("cache") /sourcePath.ChangeExtension(sourcePath.Extension().string() + L"." + digestPrefix.str() + m_FileExtension);
return VfsPath("cache") / sourcePath.ChangeExtension(sourcePath.Extension().string() + L"." + digestPrefix.str() + m_FileExtension);
// TODO: we should probably include the mod name, once that's possible (http://trac.wildfiregames.com/ticket/564)
}
+1 -1
View File
@@ -75,7 +75,7 @@ void SkyManager::LoadSkyTextures()
{
for (size_t i = 0; i < ARRAY_SIZE(m_SkyTexture); ++i)
{
VfsPath path = VfsPath("art/textures/skies") / m_SkySet / (Path::String(s_imageNames[i])+L".dds");
VfsPath path = VfsPath("art/textures/skies") / m_SkySet / (Path::String(s_imageNames[i])+L".dds");
CTextureProperties textureProps(path);
textureProps.SetWrap(GL_CLAMP_TO_EDGE);
+1 -1
View File
@@ -123,7 +123,7 @@ template<> bool ScriptInterface::FromJSVal<std::wstring>(JSContext* cx, jsval v,
template<> bool ScriptInterface::FromJSVal<Path>(JSContext* cx, jsval v, Path& out)
{
std::wstring string;
if(!FromJSVal(cx, v, string))
if (!FromJSVal(cx, v, string))
return false;
out = string;
return true;
+8 -6
View File
@@ -770,15 +770,16 @@ bool ScriptInterface::FreezeObject(jsval obj, bool deep)
bool ScriptInterface::LoadScript(const VfsPath& filename, const std::wstring& code)
{
std::string fnAscii = utf8_from_wstring(filename.string());
// Compile the code in strict mode, to encourage better coding practices and
// to possibly help SpiderMonkey with optimisations
std::wstring codeStrict = L"\"use strict\";\n" + code;
utf16string codeUtf16(codeStrict.begin(), codeStrict.end());
uintN lineNo = 0; // put the automatic 'use strict' on line 0, so the real code starts at line 1
JSFunction* func = JS_CompileUCFunction(m->m_cx, NULL, NULL, 0, NULL, reinterpret_cast<const jschar*> (codeUtf16.c_str()), (uintN)(codeUtf16.length()), fnAscii.c_str(), lineNo);
JSFunction* func = JS_CompileUCFunction(m->m_cx, NULL, NULL, 0, NULL,
reinterpret_cast<const jschar*> (codeUtf16.c_str()), (uintN)(codeUtf16.length()),
utf8_from_wstring(filename.string()).c_str(), lineNo);
if (!func)
return false;
@@ -809,8 +810,6 @@ bool ScriptInterface::LoadGlobalScriptFile(const VfsPath& path)
std::string content(file.GetBuffer(), file.GetBuffer() + file.GetBufferSize());
std::wstring code = wstring_from_utf8(content);
std::string fnAscii = utf8_from_wstring(path.string());
// Compile the code in strict mode, to encourage better coding practices and
// to possibly help SpiderMonkey with optimisations
std::wstring codeStrict = L"\"use strict\";\n" + code;
@@ -818,7 +817,10 @@ bool ScriptInterface::LoadGlobalScriptFile(const VfsPath& path)
uintN lineNo = 0; // put the automatic 'use strict' on line 0, so the real code starts at line 1
jsval rval;
JSBool ok = JS_EvaluateUCScript(m->m_cx, m->m_glob, reinterpret_cast<const jschar*> (codeUtf16.c_str()), (uintN)(codeUtf16.length()), fnAscii.c_str(), lineNo, &rval);
JSBool ok = JS_EvaluateUCScript(m->m_cx, m->m_glob,
reinterpret_cast<const jschar*> (codeUtf16.c_str()), (uintN)(codeUtf16.length()),
utf8_from_wstring(path.string()).c_str(), lineNo, &rval);
return ok ? true : false;
}
@@ -44,7 +44,7 @@ private:
}
// TODO: more efficient representation
typedef boost::unordered_map<std::pair<ssize_t, ssize_t>, std::pair<T, T>> Data; // map of <x,y> -> <old_val, new_val>
typedef boost::unordered_map<std::pair<ssize_t, ssize_t>, std::pair<T, T> > Data; // map of <x,y> -> <old_val, new_val>
Data m_Data;
};