Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d5229aee
Commit
d5229aee
authored
Aug 10, 2015
by
Iván Matellanes
Committed by
Alexandre Julliard
Aug 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcirt: Implement filebuf::seekoff.
parent
0ed82afe
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
4 deletions
+47
-4
msvcirt.c
dlls/msvcirt/msvcirt.c
+7
-4
msvcirt.c
dlls/msvcirt/tests/msvcirt.c
+40
-0
No files found.
dlls/msvcirt/msvcirt.c
View file @
d5229aee
...
@@ -968,11 +968,12 @@ filebuf* __thiscall filebuf_open(filebuf *this, const char *name, ios_open_mode
...
@@ -968,11 +968,12 @@ filebuf* __thiscall filebuf_open(filebuf *this, const char *name, ios_open_mode
streambuf_lock
(
&
this
->
base
);
streambuf_lock
(
&
this
->
base
);
this
->
close
=
1
;
this
->
close
=
1
;
this
->
fd
=
fd
;
if
((
mode
&
OPENMODE_ate
)
&&
if
((
mode
&
OPENMODE_ate
)
&&
call_streambuf_seekoff
(
&
this
->
base
,
0
,
SEEKDIR_end
,
mode
&
(
OPENMODE_in
|
OPENMODE_out
))
==
EOF
)
{
call_streambuf_seekoff
(
&
this
->
base
,
0
,
SEEKDIR_end
,
mode
&
(
OPENMODE_in
|
OPENMODE_out
))
==
EOF
)
{
_close
(
fd
);
_close
(
fd
);
}
else
this
->
fd
=
-
1
;
this
->
fd
=
fd
;
}
streambuf_allocate
(
&
this
->
base
);
streambuf_allocate
(
&
this
->
base
);
streambuf_unlock
(
&
this
->
base
);
streambuf_unlock
(
&
this
->
base
);
return
(
this
->
fd
==
-
1
)
?
NULL
:
this
;
return
(
this
->
fd
==
-
1
)
?
NULL
:
this
;
...
@@ -1003,8 +1004,10 @@ int __thiscall filebuf_overflow(filebuf *this, int c)
...
@@ -1003,8 +1004,10 @@ int __thiscall filebuf_overflow(filebuf *this, int c)
DEFINE_THISCALL_WRAPPER
(
filebuf_seekoff
,
16
)
DEFINE_THISCALL_WRAPPER
(
filebuf_seekoff
,
16
)
streampos
__thiscall
filebuf_seekoff
(
filebuf
*
this
,
streamoff
offset
,
ios_seek_dir
dir
,
int
mode
)
streampos
__thiscall
filebuf_seekoff
(
filebuf
*
this
,
streamoff
offset
,
ios_seek_dir
dir
,
int
mode
)
{
{
FIXME
(
"(%p %d %d %d) stub
\n
"
,
this
,
offset
,
dir
,
mode
);
TRACE
(
"(%p %d %d %d)
\n
"
,
this
,
offset
,
dir
,
mode
);
return
0
;
if
(
call_streambuf_sync
(
&
this
->
base
)
==
EOF
)
return
EOF
;
return
_lseek
(
this
->
fd
,
offset
,
dir
);
}
}
/* ?setbuf@filebuf@@UAEPAVstreambuf@@PADH@Z */
/* ?setbuf@filebuf@@UAEPAVstreambuf@@PADH@Z */
...
...
dlls/msvcirt/tests/msvcirt.c
View file @
d5229aee
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#include "wine/test.h"
#include "wine/test.h"
typedef
void
(
*
vtable_ptr
)(
void
);
typedef
void
(
*
vtable_ptr
)(
void
);
typedef
LONG
streamoff
;
typedef
LONG
streampos
;
typedef
int
filedesc
;
typedef
int
filedesc
;
typedef
enum
{
typedef
enum
{
...
@@ -45,6 +47,12 @@ typedef enum {
...
@@ -45,6 +47,12 @@ typedef enum {
}
ios_open_mode
;
}
ios_open_mode
;
typedef
enum
{
typedef
enum
{
SEEKDIR_beg
=
0
,
SEEKDIR_cur
=
1
,
SEEKDIR_end
=
2
}
ios_seek_dir
;
typedef
enum
{
FLAGS_skipws
=
0x1
,
FLAGS_skipws
=
0x1
,
FLAGS_left
=
0x2
,
FLAGS_left
=
0x2
,
FLAGS_right
=
0x4
,
FLAGS_right
=
0x4
,
...
@@ -162,6 +170,7 @@ static streambuf* (*__thiscall p_filebuf_setbuf)(filebuf*, char*, int);
...
@@ -162,6 +170,7 @@ static streambuf* (*__thiscall p_filebuf_setbuf)(filebuf*, char*, int);
static
int
(
*
__thiscall
p_filebuf_sync
)(
filebuf
*
);
static
int
(
*
__thiscall
p_filebuf_sync
)(
filebuf
*
);
static
int
(
*
__thiscall
p_filebuf_overflow
)(
filebuf
*
,
int
);
static
int
(
*
__thiscall
p_filebuf_overflow
)(
filebuf
*
,
int
);
static
int
(
*
__thiscall
p_filebuf_underflow
)(
filebuf
*
);
static
int
(
*
__thiscall
p_filebuf_underflow
)(
filebuf
*
);
static
streampos
(
*
__thiscall
p_filebuf_seekoff
)(
filebuf
*
,
streamoff
,
ios_seek_dir
,
int
);
/* ios */
/* ios */
static
ios
*
(
*
__thiscall
p_ios_copy_ctor
)(
ios
*
,
const
ios
*
);
static
ios
*
(
*
__thiscall
p_ios_copy_ctor
)(
ios
*
,
const
ios
*
);
...
@@ -305,6 +314,7 @@ static BOOL init(void)
...
@@ -305,6 +314,7 @@ static BOOL init(void)
SET
(
p_filebuf_sync
,
"?sync@filebuf@@UEAAHXZ"
);
SET
(
p_filebuf_sync
,
"?sync@filebuf@@UEAAHXZ"
);
SET
(
p_filebuf_overflow
,
"?overflow@filebuf@@UEAAHH@Z"
);
SET
(
p_filebuf_overflow
,
"?overflow@filebuf@@UEAAHH@Z"
);
SET
(
p_filebuf_underflow
,
"?underflow@filebuf@@UEAAHXZ"
);
SET
(
p_filebuf_underflow
,
"?underflow@filebuf@@UEAAHXZ"
);
SET
(
p_filebuf_seekoff
,
"?seekoff@filebuf@@UEAAJJW4seek_dir@ios@@H@Z"
);
SET
(
p_ios_copy_ctor
,
"??0ios@@IEAA@AEBV0@@Z"
);
SET
(
p_ios_copy_ctor
,
"??0ios@@IEAA@AEBV0@@Z"
);
SET
(
p_ios_ctor
,
"??0ios@@IEAA@XZ"
);
SET
(
p_ios_ctor
,
"??0ios@@IEAA@XZ"
);
...
@@ -368,6 +378,7 @@ static BOOL init(void)
...
@@ -368,6 +378,7 @@ static BOOL init(void)
SET
(
p_filebuf_sync
,
"?sync@filebuf@@UAEHXZ"
);
SET
(
p_filebuf_sync
,
"?sync@filebuf@@UAEHXZ"
);
SET
(
p_filebuf_overflow
,
"?overflow@filebuf@@UAEHH@Z"
);
SET
(
p_filebuf_overflow
,
"?overflow@filebuf@@UAEHH@Z"
);
SET
(
p_filebuf_underflow
,
"?underflow@filebuf@@UAEHXZ"
);
SET
(
p_filebuf_underflow
,
"?underflow@filebuf@@UAEHXZ"
);
SET
(
p_filebuf_seekoff
,
"?seekoff@filebuf@@UAEJJW4seek_dir@ios@@H@Z"
);
SET
(
p_ios_copy_ctor
,
"??0ios@@IAE@ABV0@@Z"
);
SET
(
p_ios_copy_ctor
,
"??0ios@@IAE@ABV0@@Z"
);
SET
(
p_ios_ctor
,
"??0ios@@IAE@XZ"
);
SET
(
p_ios_ctor
,
"??0ios@@IAE@XZ"
);
...
@@ -1305,6 +1316,35 @@ static void test_filebuf(void)
...
@@ -1305,6 +1316,35 @@ static void test_filebuf(void)
ret
=
(
int
)
call_func1
(
p_filebuf_underflow
,
&
fb2
);
ret
=
(
int
)
call_func1
(
p_filebuf_underflow
,
&
fb2
);
ok
(
ret
==
EOF
,
"wrong return, expected EOF got %d
\n
"
,
ret
);
ok
(
ret
==
EOF
,
"wrong return, expected EOF got %d
\n
"
,
ret
);
/* seekoff */
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
5
,
SEEKDIR_beg
,
0
);
ok
(
ret
==
5
,
"wrong return, expected 5 got %d
\n
"
,
ret
);
ok
(
fb1
.
base
.
gptr
==
NULL
,
"wrong get pointer, expected %p got %p
\n
"
,
NULL
,
fb1
.
base
.
gptr
);
ok
(
fb1
.
base
.
pptr
==
NULL
,
"wrong put pointer, expected %p got %p
\n
"
,
NULL
,
fb1
.
base
.
pptr
);
fb1
.
base
.
eback
=
fb1
.
base
.
gptr
=
fb1
.
base
.
base
;
fb1
.
base
.
egptr
=
fb1
.
base
.
ebuf
;
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
0
,
SEEKDIR_beg
,
0
);
ok
(
ret
==
EOF
,
"wrong return, expected EOF got %d
\n
"
,
ret
);
fb1
.
base
.
eback
=
fb1
.
base
.
gptr
=
fb1
.
base
.
egptr
=
NULL
;
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
10
,
SEEKDIR_beg
,
OPENMODE_in
|
OPENMODE_out
);
ok
(
ret
==
10
,
"wrong return, expected 10 got %d
\n
"
,
ret
);
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
0
,
SEEKDIR_cur
,
0
);
ok
(
ret
==
10
,
"wrong return, expected 10 got %d
\n
"
,
ret
);
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
200
,
SEEKDIR_cur
,
OPENMODE_in
);
ok
(
ret
==
210
,
"wrong return, expected 210 got %d
\n
"
,
ret
);
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
-
60
,
SEEKDIR_cur
,
0
);
ok
(
ret
==
150
,
"wrong return, expected 150 got %d
\n
"
,
ret
);
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
0
,
SEEKDIR_end
,
0
);
ok
(
ret
==
106
,
"wrong return, expected 106 got %d
\n
"
,
ret
);
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
20
,
SEEKDIR_end
,
OPENMODE_out
);
ok
(
ret
==
126
,
"wrong return, expected 126 got %d
\n
"
,
ret
);
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
-
150
,
SEEKDIR_end
,
-
1
);
ok
(
ret
==
EOF
,
"wrong return, expected EOF got %d
\n
"
,
ret
);
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
10
,
3
,
0
);
ok
(
ret
==
EOF
,
"wrong return, expected EOF got %d
\n
"
,
ret
);
ret
=
(
int
)
call_func4
(
p_filebuf_seekoff
,
&
fb1
,
16
,
SEEKDIR_beg
,
0
);
ok
(
ret
==
16
,
"wrong return, expected 16 got %d
\n
"
,
ret
);
/* close */
/* close */
pret
=
(
filebuf
*
)
call_func1
(
p_filebuf_close
,
&
fb2
);
pret
=
(
filebuf
*
)
call_func1
(
p_filebuf_close
,
&
fb2
);
ok
(
pret
==
NULL
,
"wrong return, expected %p got %p
\n
"
,
NULL
,
pret
);
ok
(
pret
==
NULL
,
"wrong return, expected %p got %p
\n
"
,
NULL
,
pret
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment