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
280f8237
Commit
280f8237
authored
Mar 28, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 28, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Move fread_s function to msvcrt.
parent
12b8c967
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
57 deletions
+61
-57
msvcr100.c
dlls/msvcr100/msvcr100.c
+0
-53
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr110.spec
dlls/msvcr110/msvcr110.spec
+1
-1
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+1
-1
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+1
-1
file.c
dlls/msvcrt/file.c
+51
-0
msvcrt.h
dlls/msvcrt/msvcrt.h
+5
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-0
No files found.
dlls/msvcr100/msvcr100.c
View file @
280f8237
...
...
@@ -448,59 +448,6 @@ unsigned __int64 CDECL _byteswap_uint64(unsigned __int64 i)
}
/*********************************************************************
* fread_s (MSVCR100.@)
*/
size_t
CDECL
fread_s
(
void
*
buf
,
size_t
buf_size
,
size_t
elem_size
,
size_t
count
,
FILE
*
stream
)
{
size_t
bytes_left
,
buf_pos
;
TRACE
(
"(%p %lu %lu %lu %p
\n
"
,
buf
,
(
unsigned
long
)
buf_size
,
(
unsigned
long
)
elem_size
,
(
unsigned
long
)
count
,
stream
);
if
(
!
CHECK_PMT
(
stream
!=
NULL
))
{
if
(
buf
&&
buf_size
)
memset
(
buf
,
0
,
buf_size
);
return
0
;
}
if
(
!
elem_size
||
!
count
)
return
0
;
if
(
!
CHECK_PMT
(
buf
!=
NULL
))
return
0
;
if
(
!
CHECK_PMT
(
SIZE_MAX
/
count
>=
elem_size
))
return
0
;
bytes_left
=
elem_size
*
count
;
buf_pos
=
0
;
while
(
bytes_left
)
{
if
(
stream
->
_cnt
>
0
)
{
size_t
size
=
bytes_left
<
stream
->
_cnt
?
bytes_left
:
stream
->
_cnt
;
if
(
!
CHECK_PMT_ERR
(
size
<=
buf_size
-
buf_pos
,
ERANGE
))
{
memset
(
buf
,
0
,
buf_size
);
return
0
;
}
fread
((
char
*
)
buf
+
buf_pos
,
1
,
size
,
stream
);
buf_pos
+=
size
;
bytes_left
-=
size
;
}
else
{
int
c
=
_filbuf
(
stream
);
if
(
c
==
EOF
)
break
;
if
(
!
CHECK_PMT_ERR
(
buf_size
-
buf_pos
>
0
,
ERANGE
))
{
memset
(
buf
,
0
,
buf_size
);
return
0
;
}
((
char
*
)
buf
)[
buf_pos
++
]
=
c
;
bytes_left
--
;
}
}
return
buf_pos
/
elem_size
;
}
/*********************************************************************
* _sprintf_p (MSVCR100.@)
*/
int
CDECL
_sprintf_p
(
char
*
buffer
,
size_t
length
,
const
char
*
format
,
...)
...
...
dlls/msvcr100/msvcr100.spec
View file @
280f8237
...
...
@@ -1670,7 +1670,7 @@
@ cdecl fputwc(long ptr) msvcrt.fputwc
@ cdecl fputws(wstr ptr) msvcrt.fputws
@ cdecl fread(ptr long long ptr) msvcrt.fread
@ cdecl fread_s(ptr long long long ptr)
@ cdecl fread_s(ptr long long long ptr)
msvcrt.fread_s
@ cdecl free(ptr) msvcrt.free
@ cdecl freopen(str str ptr) msvcrt.freopen
@ cdecl freopen_s(ptr str str ptr) msvcrt.freopen_s
...
...
dlls/msvcr110/msvcr110.spec
View file @
280f8237
...
...
@@ -2033,7 +2033,7 @@
@ cdecl fputwc(long ptr) msvcrt.fputwc
@ cdecl fputws(wstr ptr) msvcrt.fputws
@ cdecl fread(ptr long long ptr) msvcrt.fread
@ cdecl fread_s(ptr long long long ptr) msvcr
100
.fread_s
@ cdecl fread_s(ptr long long long ptr) msvcr
t
.fread_s
@ cdecl free(ptr) msvcrt.free
@ cdecl freopen(str str ptr) msvcrt.freopen
@ cdecl freopen_s(ptr str str ptr) msvcrt.freopen_s
...
...
dlls/msvcr80/msvcr80.spec
View file @
280f8237
...
...
@@ -1323,7 +1323,7 @@
@ cdecl fputwc(long ptr) msvcrt.fputwc
@ cdecl fputws(wstr ptr) msvcrt.fputws
@ cdecl fread(ptr long long ptr) msvcrt.fread
@ cdecl fread_s(ptr long long long ptr) msvcr
100
.fread_s
@ cdecl fread_s(ptr long long long ptr) msvcr
t
.fread_s
@ cdecl free(ptr) msvcrt.free
@ cdecl freopen(str str ptr) msvcrt.freopen
@ cdecl freopen_s(ptr str str ptr) msvcrt.freopen_s
...
...
dlls/msvcr90/msvcr90.spec
View file @
280f8237
...
...
@@ -1324,7 +1324,7 @@
@ cdecl fputwc(long ptr) msvcrt.fputwc
@ cdecl fputws(wstr ptr) msvcrt.fputws
@ cdecl fread(ptr long long ptr) msvcrt.fread
@ cdecl fread_s(ptr long long long ptr) msvcr
100
.fread_s
@ cdecl fread_s(ptr long long long ptr) msvcr
t
.fread_s
@ cdecl free(ptr) msvcrt.free
@ cdecl freopen(str str ptr) msvcrt.freopen
@ cdecl freopen_s(ptr str str ptr) msvcrt.freopen_s
...
...
dlls/msvcrt/file.c
View file @
280f8237
...
...
@@ -3686,6 +3686,57 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
return
read
/
size
;
}
/* fread_s - not exported in native msvcrt */
MSVCRT_size_t
CDECL
fread_s
(
void
*
buf
,
MSVCRT_size_t
buf_size
,
MSVCRT_size_t
elem_size
,
MSVCRT_size_t
count
,
MSVCRT_FILE
*
stream
)
{
size_t
bytes_left
,
buf_pos
;
TRACE
(
"(%p %lu %lu %lu %p
\n
"
,
buf
,
buf_size
,
elem_size
,
count
,
stream
);
if
(
!
MSVCRT_CHECK_PMT
(
stream
!=
NULL
))
{
if
(
buf
&&
buf_size
)
memset
(
buf
,
0
,
buf_size
);
return
0
;
}
if
(
!
elem_size
||
!
count
)
return
0
;
if
(
!
MSVCRT_CHECK_PMT
(
buf
!=
NULL
))
return
0
;
if
(
!
MSVCRT_CHECK_PMT
(
MSVCRT_SIZE_MAX
/
count
>=
elem_size
))
return
0
;
bytes_left
=
elem_size
*
count
;
buf_pos
=
0
;
while
(
bytes_left
)
{
if
(
stream
->
_cnt
>
0
)
{
size_t
size
=
bytes_left
<
stream
->
_cnt
?
bytes_left
:
stream
->
_cnt
;
if
(
!
MSVCRT_CHECK_PMT_ERR
(
size
<=
buf_size
-
buf_pos
,
MSVCRT_ERANGE
))
{
memset
(
buf
,
0
,
buf_size
);
return
0
;
}
MSVCRT_fread
((
char
*
)
buf
+
buf_pos
,
1
,
size
,
stream
);
buf_pos
+=
size
;
bytes_left
-=
size
;
}
else
{
int
c
=
MSVCRT__filbuf
(
stream
);
if
(
c
==
EOF
)
break
;
if
(
!
MSVCRT_CHECK_PMT_ERR
(
buf_size
-
buf_pos
>
0
,
MSVCRT_ERANGE
))
{
memset
(
buf
,
0
,
buf_size
);
return
0
;
}
((
char
*
)
buf
)[
buf_pos
++
]
=
c
;
bytes_left
--
;
}
}
return
buf_pos
/
elem_size
;
}
/*********************************************************************
* _wfreopen (MSVCRT.@)
*
...
...
dlls/msvcrt/msvcrt.h
View file @
280f8237
...
...
@@ -48,6 +48,11 @@
#define MSVCRT_I64_MIN (-MSVCRT_I64_MAX-1)
#define MSVCRT_UI64_MAX (((unsigned __int64)0xffffffff << 32) | 0xffffffff)
#define MSVCRT_MB_LEN_MAX 2
#ifdef _WIN64
#define MSVCRT_SIZE_MAX MSVCRT_UI64_MAX
#else
#define MSVCRT_SIZE_MAX MSVCRT_ULONG_MAX
#endif
#define MSVCRT__MAX_DRIVE 3
#define MSVCRT__MAX_DIR 256
...
...
dlls/msvcrt/msvcrt.spec
View file @
280f8237
...
...
@@ -1530,3 +1530,4 @@
@ cdecl _get_printf_count_output() MSVCRT__get_printf_count_output
@ cdecl _set_printf_count_output(long) MSVCRT__set_printf_count_output
@ cdecl _getptd()
@ cdecl fread_s(ptr long long long ptr)
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