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
e09e67e8
Commit
e09e67e8
authored
Jan 03, 2005
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 03, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of W->A calls.
parent
e07a9568
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
51 deletions
+67
-51
ordinal.c
dlls/shlwapi/ordinal.c
+28
-8
string.c
dlls/shlwapi/string.c
+39
-43
No files found.
dlls/shlwapi/ordinal.c
View file @
e09e67e8
...
...
@@ -648,15 +648,35 @@ INT WINAPI SHStringFromGUIDA(REFGUID guid, LPSTR lpszDest, INT cchMax)
/*************************************************************************
* @ [SHLWAPI.24]
*
* Unicode version of SHStringFromGUIDA.
* Convert a GUID to a string.
*
* PARAMS
* guid [I] GUID to convert
* str [O] Destination for string
* cmax [I] Length of output buffer
*
* RETURNS
* The length of the string created.
*/
INT
WINAPI
SHStringFromGUIDW
(
REFGUID
guid
,
LPWSTR
lpszDest
,
INT
cchMax
)
{
char
xguid
[
40
];
INT
iLen
=
SHStringFromGUIDA
(
guid
,
xguid
,
cchMax
);
WCHAR
xguid
[
40
];
INT
iLen
;
static
const
WCHAR
wszFormat
[]
=
{
'{'
,
'%'
,
'0'
,
'8'
,
'l'
,
'X'
,
'-'
,
'%'
,
'0'
,
'4'
,
'X'
,
'-'
,
'%'
,
'0'
,
'4'
,
'X'
,
'-'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'-'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'%'
,
'0'
,
'2'
,
'X'
,
'}'
,
0
};
TRACE
(
"(%s,%p,%d)
\n
"
,
debugstr_guid
(
guid
),
lpszDest
,
cchMax
);
if
(
iLen
)
MultiByteToWideChar
(
CP_ACP
,
0
,
xguid
,
-
1
,
lpszDest
,
cchMax
);
sprintfW
(
xguid
,
wszFormat
,
guid
->
Data1
,
guid
->
Data2
,
guid
->
Data3
,
guid
->
Data4
[
0
],
guid
->
Data4
[
1
],
guid
->
Data4
[
2
],
guid
->
Data4
[
3
],
guid
->
Data4
[
4
],
guid
->
Data4
[
5
],
guid
->
Data4
[
6
],
guid
->
Data4
[
7
]);
iLen
=
strlenW
(
xguid
)
+
1
;
if
(
iLen
>
cchMax
)
return
0
;
memcpy
(
lpszDest
,
xguid
,
iLen
*
sizeof
(
WCHAR
));
return
iLen
;
}
...
...
@@ -2706,7 +2726,7 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle
wc
.
cbWndExtra
=
4
;
wc
.
hInstance
=
shlwapi_hInstance
;
wc
.
hIcon
=
NULL
;
wc
.
hCursor
=
LoadCursor
A
(
NULL
,
(
LP
STR
)
IDC_ARROW
);
wc
.
hCursor
=
LoadCursor
W
(
NULL
,
(
LPW
STR
)
IDC_ARROW
);
wc
.
hbrBackground
=
(
HBRUSH
)
COLOR_BTNSHADOW
;
wc
.
lpszMenuName
=
NULL
;
wc
.
lpszClassName
=
szClass
;
...
...
@@ -2719,10 +2739,10 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle
hWndParent
,
hMenu
,
shlwapi_hInstance
,
0
);
if
(
hWnd
)
{
SetWindowLong
A
(
hWnd
,
DWL_MSGRESULT
,
z
);
SetWindowLong
W
(
hWnd
,
DWL_MSGRESULT
,
z
);
if
(
wndProc
)
SetWindowLongPtr
A
(
hWnd
,
GWLP_WNDPROC
,
wndProc
);
SetWindowLongPtr
W
(
hWnd
,
GWLP_WNDPROC
,
wndProc
);
}
return
hWnd
;
}
...
...
dlls/shlwapi/string.c
View file @
e09e67e8
...
...
@@ -599,7 +599,7 @@ LPWSTR WINAPI StrRStrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch)
while
(
lpszStr
<=
lpszEnd
&&
*
lpszStr
)
{
if
(
!
ChrCmpI
A
(
*
lpszSearch
,
*
lpszStr
))
if
(
!
ChrCmpI
W
(
*
lpszSearch
,
*
lpszStr
))
{
if
(
!
StrCmpNIW
(
lpszStr
,
lpszSearch
,
iLen
))
lpszRet
=
(
LPWSTR
)
lpszStr
;
...
...
@@ -2186,7 +2186,7 @@ INT WINAPI StrCmpLogicalW(LPCWSTR lpszStr, LPCWSTR lpszComp)
return
1
;
else
{
iDiff
=
SHLWAPI_ChrCmpHelper
A
(
*
lpszStr
,
*
lpszComp
,
NORM_IGNORECASE
);
iDiff
=
SHLWAPI_ChrCmpHelper
W
(
*
lpszStr
,
*
lpszComp
,
NORM_IGNORECASE
);
if
(
iDiff
>
0
)
return
1
;
else
if
(
iDiff
<
0
)
...
...
@@ -2208,12 +2208,12 @@ typedef struct tagSHLWAPI_BYTEFORMATS
LONGLONG
dLimit
;
double
dDivisor
;
double
dNormaliser
;
LPC
STR
lp
szFormat
;
CHAR
wPrefix
;
LPC
WSTR
lpw
szFormat
;
W
CHAR
wPrefix
;
}
SHLWAPI_BYTEFORMATS
;
/*************************************************************************
* StrFormatByteSize
64A
[SHLWAPI.@]
* StrFormatByteSize
W
[SHLWAPI.@]
*
* Create a string containing an abbreviated byte count of up to 2^63-1.
*
...
...
@@ -2228,12 +2228,12 @@ typedef struct tagSHLWAPI_BYTEFORMATS
* NOTES
* There is no StrFormatByteSize64W function, it is called StrFormatByteSizeW().
*/
LP
STR
WINAPI
StrFormatByteSize64A
(
LONGLONG
llBytes
,
LP
STR
lpszDest
,
UINT
cchMax
)
LP
WSTR
WINAPI
StrFormatByteSizeW
(
LONGLONG
llBytes
,
LPW
STR
lpszDest
,
UINT
cchMax
)
{
static
const
char
szBytes
[]
=
"%ld bytes"
;
static
const
char
sz3_0
[]
=
"%3.0f"
;
static
const
char
sz3_1
[]
=
"%3.1f"
;
static
const
char
sz3_2
[]
=
"%3.2f"
;
static
const
WCHAR
wszBytes
[]
=
{
'%'
,
'l'
,
'd'
,
' '
,
'b'
,
'y'
,
't'
,
'e'
,
's'
,
0
}
;
static
const
WCHAR
wsz3_0
[]
=
{
'%'
,
'3'
,
'.'
,
'0'
,
'f'
,
0
}
;
static
const
WCHAR
wsz3_1
[]
=
{
'%'
,
'3'
,
'.'
,
'1'
,
'f'
,
0
}
;
static
const
WCHAR
wsz3_2
[]
=
{
'%'
,
'3'
,
'.'
,
'2'
,
'f'
,
0
}
;
#define KB ((ULONGLONG)1024)
#define MB (KB*KB)
...
...
@@ -2243,25 +2243,25 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
static
const
SHLWAPI_BYTEFORMATS
bfFormats
[]
=
{
{
10
*
KB
,
10
.
24
,
100
.
0
,
sz3_2
,
'K'
},
/* 10 KB */
{
100
*
KB
,
102
.
4
,
10
.
0
,
sz3_1
,
'K'
},
/* 100 KB */
{
1000
*
KB
,
1024
.
0
,
1
.
0
,
sz3_0
,
'K'
},
/* 1000 KB */
{
10
*
MB
,
10485
.
76
,
100
.
0
,
sz3_2
,
'M'
},
/* 10 MB */
{
100
*
MB
,
104857
.
6
,
10
.
0
,
sz3_1
,
'M'
},
/* 100 MB */
{
1000
*
MB
,
1048576
.
0
,
1
.
0
,
sz3_0
,
'M'
},
/* 1000 MB */
{
10
*
GB
,
10737418
.
24
,
100
.
0
,
sz3_2
,
'G'
},
/* 10 GB */
{
100
*
GB
,
107374182
.
4
,
10
.
0
,
sz3_1
,
'G'
},
/* 100 GB */
{
1000
*
GB
,
1073741824
.
0
,
1
.
0
,
sz3_0
,
'G'
},
/* 1000 GB */
{
10
*
TB
,
10485
.
76
,
100
.
0
,
sz3_2
,
'T'
},
/* 10 TB */
{
100
*
TB
,
104857
.
6
,
10
.
0
,
sz3_1
,
'T'
},
/* 100 TB */
{
1000
*
TB
,
1048576
.
0
,
1
.
0
,
sz3_0
,
'T'
},
/* 1000 TB */
{
10
*
PB
,
10737418
.
24
,
100
.
00
,
sz3_2
,
'P'
},
/* 10 PB */
{
100
*
PB
,
107374182
.
4
,
10
.
00
,
sz3_1
,
'P'
},
/* 100 PB */
{
1000
*
PB
,
1073741824
.
0
,
1
.
00
,
sz3_0
,
'P'
},
/* 1000 PB */
{
0
,
10995116277
.
76
,
100
.
00
,
sz3_2
,
'E'
}
/* EB's, catch all */
{
10
*
KB
,
10
.
24
,
100
.
0
,
w
sz3_2
,
'K'
},
/* 10 KB */
{
100
*
KB
,
102
.
4
,
10
.
0
,
w
sz3_1
,
'K'
},
/* 100 KB */
{
1000
*
KB
,
1024
.
0
,
1
.
0
,
w
sz3_0
,
'K'
},
/* 1000 KB */
{
10
*
MB
,
10485
.
76
,
100
.
0
,
w
sz3_2
,
'M'
},
/* 10 MB */
{
100
*
MB
,
104857
.
6
,
10
.
0
,
w
sz3_1
,
'M'
},
/* 100 MB */
{
1000
*
MB
,
1048576
.
0
,
1
.
0
,
w
sz3_0
,
'M'
},
/* 1000 MB */
{
10
*
GB
,
10737418
.
24
,
100
.
0
,
w
sz3_2
,
'G'
},
/* 10 GB */
{
100
*
GB
,
107374182
.
4
,
10
.
0
,
w
sz3_1
,
'G'
},
/* 100 GB */
{
1000
*
GB
,
1073741824
.
0
,
1
.
0
,
w
sz3_0
,
'G'
},
/* 1000 GB */
{
10
*
TB
,
10485
.
76
,
100
.
0
,
w
sz3_2
,
'T'
},
/* 10 TB */
{
100
*
TB
,
104857
.
6
,
10
.
0
,
w
sz3_1
,
'T'
},
/* 100 TB */
{
1000
*
TB
,
1048576
.
0
,
1
.
0
,
w
sz3_0
,
'T'
},
/* 1000 TB */
{
10
*
PB
,
10737418
.
24
,
100
.
00
,
w
sz3_2
,
'P'
},
/* 10 PB */
{
100
*
PB
,
107374182
.
4
,
10
.
00
,
w
sz3_1
,
'P'
},
/* 100 PB */
{
1000
*
PB
,
1073741824
.
0
,
1
.
00
,
w
sz3_0
,
'P'
},
/* 1000 PB */
{
0
,
10995116277
.
76
,
100
.
00
,
w
sz3_2
,
'E'
}
/* EB's, catch all */
};
char
szBuff
[
32
];
char
szAdd
[
4
]
;
WCHAR
w
szBuff
[
32
];
WCHAR
wszAdd
[]
=
{
' '
,
'?'
,
'B'
,
0
}
;
double
dBytes
;
UINT
i
=
0
;
...
...
@@ -2272,7 +2272,7 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
if
(
llBytes
<
1024
)
/* 1K */
{
snprintf
(
lpszDest
,
cchMax
,
szBytes
,
(
long
)
llBytes
);
snprintf
W
(
lpszDest
,
cchMax
,
w
szBytes
,
(
long
)
llBytes
);
return
lpszDest
;
}
...
...
@@ -2298,30 +2298,26 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
dBytes
=
floor
(
dBytes
/
bfFormats
[
i
].
dDivisor
)
/
bfFormats
[
i
].
dNormaliser
;
sprintf
(
szBuff
,
bfFormats
[
i
].
lpszFormat
,
dBytes
);
szAdd
[
0
]
=
' '
;
szAdd
[
1
]
=
bfFormats
[
i
].
wPrefix
;
szAdd
[
2
]
=
'B'
;
szAdd
[
3
]
=
'\0'
;
strcat
(
szBuff
,
szAdd
);
strncpy
(
lpszDest
,
szBuff
,
cchMax
);
sprintfW
(
wszBuff
,
bfFormats
[
i
].
lpwszFormat
,
dBytes
);
wszAdd
[
1
]
=
bfFormats
[
i
].
wPrefix
;
strcatW
(
wszBuff
,
wszAdd
);
strncpyW
(
lpszDest
,
wszBuff
,
cchMax
);
return
lpszDest
;
}
/*************************************************************************
* StrFormatByteSize
W
[SHLWAPI.@]
* StrFormatByteSize
64A
[SHLWAPI.@]
*
* See StrFormatByteSize
64A
.
* See StrFormatByteSize
W
.
*/
LPWSTR
WINAPI
StrFormatByteSizeW
(
LONGLONG
llBytes
,
LPWSTR
lpszDest
,
UINT
cchMax
)
LPSTR
WINAPI
StrFormatByteSize64A
(
LONGLONG
llBytes
,
LPSTR
lpszDest
,
UINT
cchMax
)
{
char
szBuff
[
32
];
WCHAR
w
szBuff
[
32
];
StrFormatByteSize
64A
(
llBytes
,
szBuff
,
sizeof
(
szBuff
));
StrFormatByteSize
W
(
llBytes
,
wszBuff
,
sizeof
(
wszBuff
)
/
sizeof
(
WCHAR
));
if
(
lpszDest
)
MultiByteToWideChar
(
CP_ACP
,
0
,
szBuff
,
-
1
,
lpszDest
,
cchMax
);
WideCharToMultiByte
(
CP_ACP
,
0
,
wszBuff
,
-
1
,
lpszDest
,
cchMax
,
0
,
0
);
return
lpszDest
;
}
...
...
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