mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
more foo
This commit is contained in:
parent
aabd66821f
commit
0bfd97d7c4
@ -6,7 +6,7 @@
|
|||||||
#ifndef __PFSTREAM_H__
|
#ifndef __PFSTREAM_H__
|
||||||
#define __PFSTREAM_H__
|
#define __PFSTREAM_H__
|
||||||
|
|
||||||
#include "pfstreambuf.h"
|
#include "pfstreamBuf.h"
|
||||||
|
|
||||||
class EXPCL_DTOOL ipfstream : public istream {
|
class EXPCL_DTOOL ipfstream : public istream {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
|
@ -83,21 +83,35 @@ int PipeStreamBuf::sync(void) {
|
|||||||
int PipeStreamBuf::underflow(void) {
|
int PipeStreamBuf::underflow(void) {
|
||||||
assert(_pipe != (FILE*)0L);
|
assert(_pipe != (FILE*)0L);
|
||||||
assert(_dir == Input);
|
assert(_dir == Input);
|
||||||
|
if ((eback() == (char*)0L) || (gptr() == (char*)0L) ||
|
||||||
|
(egptr() == (char*)0L)) {
|
||||||
|
// must be in win32
|
||||||
|
char* buf = new char[4096];
|
||||||
|
char* ebuf = &(buf[4096]);
|
||||||
|
setg(buf, ebuf, ebuf);
|
||||||
|
}
|
||||||
if (gptr() < egptr()) {
|
if (gptr() < egptr()) {
|
||||||
char c = *(gptr());
|
char c = *(gptr());
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
if (feof(_pipe) != 0)
|
if (feof(_pipe) != 0)
|
||||||
return EOF;
|
return EOF;
|
||||||
// size_t len = ebuf() - base();
|
#ifdef WIN32_VC
|
||||||
size_t len = 1024;
|
size_t len = 4096;
|
||||||
|
#else /* WIN32_VC */
|
||||||
|
size_t len = ebuf() - base();
|
||||||
|
#endif /* WIN32_VC */
|
||||||
char* buf = new char[len];
|
char* buf = new char[len];
|
||||||
size_t n = fread(buf, 1, len, _pipe);
|
size_t n = fread(buf, 1, len, _pipe);
|
||||||
int ret = buf[0];
|
int ret = buf[0];
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
ret = EOF;
|
ret = EOF;
|
||||||
else {
|
else {
|
||||||
// memcpy(base()+(len - n), buf, n);
|
#ifdef WIN32_VC
|
||||||
|
memcpy(eback()+(len-n), buf, n);
|
||||||
|
#else /* WIN32_VC */
|
||||||
|
memcpy(base()+(len-n), buf, n);
|
||||||
|
#endif /* WIN32_VC */
|
||||||
gbump(-n);
|
gbump(-n);
|
||||||
}
|
}
|
||||||
delete buf;
|
delete buf;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user