1
0
forked from 0ad/0ad

Linux build fixes

This was SVN commit r3427.
This commit is contained in:
prefect 2006-01-28 22:04:09 +00:00
parent afe37d9fe2
commit 3b4295a177
8 changed files with 36 additions and 29 deletions

View File

@ -225,7 +225,7 @@ public:
void add(Key key, T item, size_t size, uint cost)
{
typedef std::pair<CacheMapIt, bool> PairIB;
CacheMap::value_type val = std::make_pair(key, CacheEntry(item, size, cost));
typename CacheMap::value_type val = std::make_pair(key, CacheEntry(item, size, cost));
PairIB ret = map.insert(val);
debug_assert(ret.second); // must not already be in map
}

View File

@ -17,6 +17,8 @@
#include "precompiled.h"
#include <deque>
#include "lib/res/mem.h"
#include "lib/allocators.h"
#include "lib/timer.h"
@ -399,11 +401,11 @@ uintptr_t comp_alloc(ContextType type, CompressionMethod method)
c = new(c_mem) ZLibCompressor(type);
break;
#endif
#include "mmgr.h"
default:
debug_warn("unknown compression type");
compressor_allocator.free(c_mem);
return 0;
#include "mmgr.h"
}
c->init();
@ -459,5 +461,7 @@ void comp_free(uintptr_t c_)
c->release();
c->~Compressor();
#include "nommgr.h"
compressor_allocator.free(c);
#include "mmgr.h"
}

View File

@ -776,8 +776,7 @@ LibError file_map(File* f, void*& p, size_t& size)
return ERR_FAIL;
errno = 0;
void* start = 0; // system picks start address
f->mapping = mmap(start, f->fc.size, prot, MAP_PRIVATE, f->fd, (off_t)0);
f->mapping = mmap(0, f->fc.size, prot, MAP_PRIVATE, f->fd, (off_t)0);
if(f->mapping == MAP_FAILED)
return LibError_from_errno();

View File

@ -345,8 +345,10 @@ FileIOBuf file_buf_alloc(size_t size, const char* atom_fn)
size_t size;
FileIOBuf discarded_buf = file_cache.remove_least_valuable(&size);
#include "nommgr.h"
if(discarded_buf)
cache_allocator.free((u8*)discarded_buf, size);
#include "mmgr.h"
if(attempts++ > 50)
debug_warn("possible infinite loop: failed to make room in cache");

View File

@ -1,5 +1,7 @@
#include "precompiled.h"
#include <deque>
#include "lib.h"
#include "lib/posix.h"
#include "lib/allocators.h"
@ -359,6 +361,7 @@ class IOManager
{
const off_t ofs = start_ofs+(off_t)total_issued;
size_t issue_size;
// write: must not issue beyond end of data.
if(is_write)
issue_size = MIN(FILE_BLOCK_SIZE, size - total_issued);
@ -371,11 +374,11 @@ class IOManager
// check if in cache
slot.block_id = block_cache_make_id(f->fc.atom_fn, ofs);
slot.cached_block = block_cache_find(slot.block_id);
if(slot.cached_block)
goto skip_issue;
if(!slot.cached_block)
{
void* buf;
// if using buffer, set position in it; otherwise, use temp buffer
void* buf;
if(pbuf == FILE_BUF_TEMP)
buf = slot.temp_buf = block_cache_alloc(slot.block_id);
else
@ -386,8 +389,7 @@ class IOManager
// waiting for all pending transfers to complete.
if(ret != ERR_OK)
err = ret;
skip_issue:
}
total_issued += issue_size;
}

View File

@ -757,7 +757,7 @@ LibError vfs_reload_changed_files()
//-----------------------------------------------------------------------------
inline void vfs_display()
void vfs_display()
{
tree_display();
}