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
955e2f90
Commit
955e2f90
authored
Nov 17, 2010
by
Vincas Miliūnas
Committed by
Alexandre Julliard
Nov 18, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added qsort_s implementation.
parent
63316d09
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
4 deletions
+71
-4
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+1
-1
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+1
-1
misc.c
dlls/msvcrt/misc.c
+67
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
No files found.
dlls/msvcr100/msvcr100.spec
View file @
955e2f90
...
...
@@ -1550,7 +1550,7 @@
@ cdecl putwc(long ptr) msvcrt.putwc
@ cdecl putwchar(long) msvcrt.putwchar
@ cdecl qsort(ptr long long ptr) msvcrt.qsort
@
stub
qsort_s
@
cdecl qsort_s(ptr long long ptr ptr) msvcrt.
qsort_s
@ cdecl raise(long) msvcrt.raise
@ cdecl rand() msvcrt.rand
@ cdecl rand_s(ptr) msvcrt.rand_s
...
...
dlls/msvcr80/msvcr80.spec
View file @
955e2f90
...
...
@@ -1404,7 +1404,7 @@
@ cdecl putwc(long ptr) msvcrt.putwc
@ cdecl putwchar(long) msvcrt.putwchar
@ cdecl qsort(ptr long long ptr) msvcrt.qsort
@
stub
qsort_s
@
cdecl qsort_s(ptr long long ptr ptr) msvcrt.
qsort_s
@ cdecl raise(long) msvcrt.raise
@ cdecl rand() msvcrt.rand
@ cdecl rand_s(ptr) msvcrt.rand_s
...
...
dlls/msvcr90/msvcr90.spec
View file @
955e2f90
...
...
@@ -1388,7 +1388,7 @@
@ cdecl putwc(long ptr) msvcrt.putwc
@ cdecl putwchar(long) msvcrt.putwchar
@ cdecl qsort(ptr long long ptr) msvcrt.qsort
@
stub
qsort_s
@
cdecl qsort_s(ptr long long ptr ptr) msvcrt.
qsort_s
@ cdecl raise(long) msvcrt.raise
@ cdecl rand() msvcrt.rand
@ cdecl rand_s(ptr) msvcrt.rand_s
...
...
dlls/msvcrt/misc.c
View file @
955e2f90
...
...
@@ -186,3 +186,70 @@ void CDECL _chkesp(void)
# endif
/* __GNUC__ */
#endif
/* __i386__ */
/*********************************************************************
* Helper function for MSVCRT_qsort_s.
*
* Based on NTDLL_qsort in dlls/ntdll/misc.c
*/
static
void
MSVCRT_mergesort
(
void
*
arr
,
void
*
barr
,
size_t
elemsize
,
int
(
CDECL
*
compar
)(
void
*
,
const
void
*
,
const
void
*
),
size_t
left
,
size_t
right
,
void
*
context
)
{
if
(
right
>
left
)
{
size_t
i
,
j
,
k
,
m
;
m
=
left
+
(
right
-
left
)
/
2
;
MSVCRT_mergesort
(
arr
,
barr
,
elemsize
,
compar
,
left
,
m
,
context
);
MSVCRT_mergesort
(
arr
,
barr
,
elemsize
,
compar
,
m
+
1
,
right
,
context
);
#define X(a,i) ((char*)a+elemsize*(i))
for
(
i
=
m
+
1
;
i
>
left
;
i
--
)
memcpy
(
X
(
barr
,(
i
-
1
)),
X
(
arr
,(
i
-
1
)),
elemsize
);
for
(
j
=
m
;
j
<
right
;
j
++
)
memcpy
(
X
(
barr
,(
right
+
m
-
j
)),
X
(
arr
,(
j
+
1
)),
elemsize
);
/* i=left; j=right; */
for
(
k
=
left
;
i
<=
m
&&
j
>
m
;
k
++
)
{
if
(
i
==
j
||
compar
(
context
,
X
(
barr
,
i
),
X
(
barr
,
j
))
<=
0
)
{
memcpy
(
X
(
arr
,
k
),
X
(
barr
,
i
),
elemsize
);
i
++
;
}
else
{
memcpy
(
X
(
arr
,
k
),
X
(
barr
,
j
),
elemsize
);
j
--
;
}
}
for
(;
i
<=
m
;
i
++
,
k
++
)
memcpy
(
X
(
arr
,
k
),
X
(
barr
,
i
),
elemsize
);
for
(;
j
>
m
;
j
--
,
k
++
)
memcpy
(
X
(
arr
,
k
),
X
(
barr
,
j
),
elemsize
);
}
#undef X
}
/*********************************************************************
* qsort_s (MSVCRT.@)
*
* Based on NTDLL_qsort in dlls/ntdll/misc.c
*/
void
CDECL
MSVCRT_qsort_s
(
void
*
base
,
MSVCRT_size_t
nmemb
,
MSVCRT_size_t
size
,
int
(
CDECL
*
compar
)(
void
*
,
const
void
*
,
const
void
*
),
void
*
context
)
{
void
*
secondarr
;
const
size_t
total_size
=
nmemb
*
size
;
if
(
!
MSVCRT_CHECK_PMT
(
base
!=
NULL
||
(
base
==
NULL
&&
nmemb
==
0
))
||
!
MSVCRT_CHECK_PMT
(
size
>
0
)
||
!
MSVCRT_CHECK_PMT
(
compar
!=
NULL
)
||
total_size
/
size
!=
nmemb
)
{
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
;
}
if
(
nmemb
<
2
)
return
;
secondarr
=
MSVCRT_malloc
(
total_size
);
if
(
!
secondarr
)
return
;
MSVCRT_mergesort
(
base
,
secondarr
,
size
,
compar
,
0
,
nmemb
-
1
,
context
);
MSVCRT_free
(
secondarr
);
}
dlls/msvcrt/msvcrt.spec
View file @
955e2f90
...
...
@@ -1344,7 +1344,7 @@
@ cdecl putwc(long ptr) MSVCRT_fputwc
@ cdecl putwchar(long) _fputwchar
@ cdecl qsort(ptr long long ptr) ntdll.qsort
# stub
qsort_s
@ cdecl qsort_s(ptr long long ptr ptr) MSVCRT_
qsort_s
@ cdecl raise(long) MSVCRT_raise
@ cdecl rand() MSVCRT_rand
@ cdecl rand_s(ptr) MSVCRT_rand_s
...
...
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