mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:23:07 +00:00
sync with trunk (r46275)
svn path=/branches/reactos-yarotows/; revision=46279
This commit is contained in:
commit
c16ad873a6
2621 changed files with 249911 additions and 78036 deletions
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<group>
|
||||
<module name="chkstk" type="staticlibrary">
|
||||
<directory name="except">
|
||||
<if property="ARCH" value="i386">
|
||||
|
@ -490,3 +491,4 @@
|
|||
<file>undname.c</file>
|
||||
</directory>
|
||||
</module>
|
||||
</group>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<module name="libcntpr" type="staticlibrary">
|
||||
<include base="crt">.</include>
|
||||
<include base="crt">include</include>
|
||||
<include base="libcntpr">.</include>
|
||||
<include base="libcntpr">include</include>
|
||||
<define name="NO_RTL_INLINES" />
|
||||
<define name="_NTSYSTEM_" />
|
||||
<define name="_NTDLLBUILD_" />
|
||||
|
@ -83,6 +83,14 @@
|
|||
<file>lfind.c</file>
|
||||
</directory>
|
||||
|
||||
<directory name="setjmp">
|
||||
<if property="ARCH" value="i386">
|
||||
<directory name="i386">
|
||||
<file>setjmp.s</file>
|
||||
</directory>
|
||||
</if>
|
||||
</directory>
|
||||
|
||||
<directory name="stdlib">
|
||||
<file>qsort.c</file>
|
||||
</directory>
|
||||
|
|
|
@ -44,6 +44,7 @@ static struct cp_extra_info_t g_cpextrainfo[] =
|
|||
{936, {0x40, 0xfe, 0, 0}},
|
||||
{949, {0x41, 0xfe, 0, 0}},
|
||||
{950, {0x40, 0x7e, 0xa1, 0xfe, 0, 0}},
|
||||
{1361, {0x31, 0x7e, 0x81, 0xfe, 0, 0}},
|
||||
{20932, {1, 255, 0, 0}}, /* seems to give different results on different systems */
|
||||
{0, {1, 255, 0, 0}} /* match all with FIXME */
|
||||
};
|
||||
|
|
|
@ -76,6 +76,7 @@ int *__p___mb_cur_max(void);
|
|||
#define WX_OPEN 0x01
|
||||
#define WX_ATEOF 0x02
|
||||
#define WX_READEOF 0x04 /* like ATEOF, but for underlying file rather than buffer */
|
||||
#define WX_READCR 0x08 /* underlying file is at \r */
|
||||
#define WX_DONTINHERIT 0x10
|
||||
#define WX_APPEND 0x20
|
||||
#define WX_TEXT 0x80
|
||||
|
@ -913,6 +914,9 @@ int CDECL fseek(FILE* file, long offset, int whence)
|
|||
if (file->_ptr[i] == '\n')
|
||||
offset--;
|
||||
}
|
||||
/* Black magic when reading CR at buffer boundary*/
|
||||
if(fdesc[file->_file].wxflag & WX_READCR)
|
||||
offset--;
|
||||
}
|
||||
}
|
||||
/* Discard buffered input */
|
||||
|
@ -1573,6 +1577,9 @@ static int read_i(int fd, void *buf, unsigned int count)
|
|||
char *bufstart = buf;
|
||||
HANDLE hand = fdtoh(fd);
|
||||
|
||||
if (count == 0)
|
||||
return 0;
|
||||
|
||||
if (fdesc[fd].wxflag & WX_READEOF) {
|
||||
fdesc[fd].wxflag |= WX_ATEOF;
|
||||
TRACE("already at EOF, returning 0\n");
|
||||
|
@ -1589,9 +1596,29 @@ static int read_i(int fd, void *buf, unsigned int count)
|
|||
*/
|
||||
if (ReadFile(hand, bufstart, count, &num_read, NULL))
|
||||
{
|
||||
if (fdesc[fd].wxflag & WX_TEXT)
|
||||
if (count != 0 && num_read == 0)
|
||||
{
|
||||
fdesc[fd].wxflag |= (WX_ATEOF|WX_READEOF);
|
||||
TRACE(":EOF %s\n",debugstr_an(buf,num_read));
|
||||
}
|
||||
else if (fdesc[fd].wxflag & WX_TEXT)
|
||||
{
|
||||
DWORD i, j;
|
||||
if (bufstart[num_read-1] == '\r')
|
||||
{
|
||||
if(count == 1)
|
||||
{
|
||||
fdesc[fd].wxflag &= ~WX_READCR;
|
||||
ReadFile(hand, bufstart, 1, &num_read, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
fdesc[fd].wxflag |= WX_READCR;
|
||||
num_read--;
|
||||
}
|
||||
}
|
||||
else
|
||||
fdesc[fd].wxflag &= ~WX_READCR;
|
||||
for (i=0, j=0; i<num_read; i++)
|
||||
{
|
||||
/* in text mode, a ctrl-z signals EOF */
|
||||
|
@ -1605,17 +1632,12 @@ static int read_i(int fd, void *buf, unsigned int count)
|
|||
* BUG: should save state across calls somehow, so CR LF that
|
||||
* straddles buffer boundary gets recognized properly?
|
||||
*/
|
||||
if ((bufstart[i] != '\r')
|
||||
|| ((i+1) < num_read && bufstart[i+1] != '\n'))
|
||||
bufstart[j++] = bufstart[i];
|
||||
if ((bufstart[i] != '\r')
|
||||
|| ((i+1) < num_read && bufstart[i+1] != '\n'))
|
||||
bufstart[j++] = bufstart[i];
|
||||
}
|
||||
num_read = j;
|
||||
}
|
||||
if (count != 0 && num_read == 0)
|
||||
{
|
||||
fdesc[fd].wxflag |= (WX_ATEOF|WX_READEOF);
|
||||
TRACE(":EOF %s\n",debugstr_an(buf,num_read));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue