mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-02-17 01:11:18 +00:00
Allow for bigger map-packs. Hopefully everyone is running a 64bit system now...
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6091 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
660f128569
commit
b676f9c3e2
1 changed files with 9 additions and 7 deletions
|
@ -1773,9 +1773,9 @@ typedef struct
|
||||||
vfsfile_t funcs;
|
vfsfile_t funcs;
|
||||||
|
|
||||||
char *data;
|
char *data;
|
||||||
int maxlen;
|
size_t maxlen;
|
||||||
unsigned int writepos;
|
size_t writepos;
|
||||||
unsigned int readpos;
|
size_t readpos;
|
||||||
void *mutex;
|
void *mutex;
|
||||||
int refs;
|
int refs;
|
||||||
qboolean terminate; //one end has closed, make the other report failures now that its no longer needed.
|
qboolean terminate; //one end has closed, make the other report failures now that its no longer needed.
|
||||||
|
@ -1842,6 +1842,8 @@ static int QDECL VFSPIPE_ReadBytes(vfsfile_t *f, void *buffer, int len)
|
||||||
static int QDECL VFSPIPE_WriteBytes(vfsfile_t *f, const void *buffer, int len)
|
static int QDECL VFSPIPE_WriteBytes(vfsfile_t *f, const void *buffer, int len)
|
||||||
{
|
{
|
||||||
vfspipe_t *p = (vfspipe_t*)f;
|
vfspipe_t *p = (vfspipe_t*)f;
|
||||||
|
if (len < 0)
|
||||||
|
return -1;
|
||||||
Sys_LockMutex(p->mutex);
|
Sys_LockMutex(p->mutex);
|
||||||
if (p->terminate)
|
if (p->terminate)
|
||||||
{ //if we started with 2 refs, and we're down to one, and we're writing, then its the reader that closed. that means writing is redundant and we should signal an error.
|
{ //if we started with 2 refs, and we're down to one, and we're writing, then its the reader that closed. that means writing is redundant and we should signal an error.
|
||||||
|
@ -1860,15 +1862,15 @@ static int QDECL VFSPIPE_WriteBytes(vfsfile_t *f, const void *buffer, int len)
|
||||||
p->maxlen = p->writepos + len;
|
p->maxlen = p->writepos + len;
|
||||||
if (p->maxlen < (p->writepos-p->readpos)*2) //over-allocate a little
|
if (p->maxlen < (p->writepos-p->readpos)*2) //over-allocate a little
|
||||||
p->maxlen = (p->writepos-p->readpos)*2;
|
p->maxlen = (p->writepos-p->readpos)*2;
|
||||||
if (p->maxlen > 0x8000000)
|
if (p->maxlen > 0x8000000 && p->data)
|
||||||
{
|
{
|
||||||
p->maxlen = 0x8000000;
|
p->maxlen = max(p->writepos,0x8000000);
|
||||||
len = p->maxlen - p->writepos;
|
if (p->maxlen <= p->writepos)
|
||||||
if (!len)
|
|
||||||
{
|
{
|
||||||
Sys_UnlockMutex(p->mutex);
|
Sys_UnlockMutex(p->mutex);
|
||||||
return -1; //try and get the caller to stop
|
return -1; //try and get the caller to stop
|
||||||
}
|
}
|
||||||
|
len = min(len, p->maxlen - p->writepos);
|
||||||
}
|
}
|
||||||
p->data = realloc(p->data, p->maxlen);
|
p->data = realloc(p->data, p->maxlen);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue