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
71c0b94d
Commit
71c0b94d
authored
Oct 31, 1999
by
Huw D M Davies
Committed by
Alexandre Julliard
Oct 31, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better handling of newlines in FormatMessage*.
parent
3b8e9b43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
48 deletions
+49
-48
lstr.c
misc/lstr.c
+49
-48
No files found.
misc/lstr.c
View file @
71c0b94d
...
...
@@ -502,8 +502,8 @@ DWORD WINAPI FormatMessage16(
DWORD
talloced
;
LPSTR
from
,
f
;
DWORD
width
=
dwFlags
&
FORMAT_MESSAGE_MAX_WIDTH_MASK
;
DWORD
nolinefeed
=
0
;
LPSTR
allocstring
;
BOOL
eos
=
FALSE
;
LPSTR
allocstring
=
NULL
;
TRACE
(
"(0x%lx,%lx,%d,0x%x,%p,%d,%p)
\n
"
,
dwFlags
,
lpSource
,
dwMessageId
,
dwLanguageId
,
lpBuffer
,
nSize
,
args
);
...
...
@@ -541,7 +541,7 @@ DWORD WINAPI FormatMessage16(
if
(
from
)
{
f
=
from
;
while
(
*
f
&&
!
nolinefeed
)
{
while
(
*
f
&&
!
eos
)
{
if
(
*
f
==
'%'
)
{
int
insertnr
;
char
*
fmtstr
,
*
sprintfbuf
,
*
x
,
*
lastf
;
...
...
@@ -612,31 +612,28 @@ DWORD WINAPI FormatMessage16(
}
HeapFree
(
GetProcessHeap
(),
0
,
fmtstr
);
break
;
case
'n'
:
/* FIXME: perhaps add \r too? */
ADD_TO_T
(
'\n'
);
f
++
;
break
;
case
'0'
:
nolinefeed
=
1
;
case
'0'
:
/* Just stop processing format string */
eos
=
TRUE
;
f
++
;
break
;
case
'n'
:
/* 16 bit version just outputs 'n' */
default:
ADD_TO_T
(
*
f
++
);
break
;
}
}
else
{
ADD_TO_T
(
*
f
++
);
}
else
{
/* '\n' or '\r' gets mapped to "\r\n" */
if
(
*
f
==
'\n'
||
*
f
==
'\r'
)
{
ADD_TO_T
(
'\r'
);
ADD_TO_T
(
'\n'
);
if
(
*
f
++
==
'\r'
&&
*
f
==
'\n'
)
f
++
;
}
else
{
ADD_TO_T
(
*
f
++
);
}
}
}
*
t
=
'\0'
;
}
if
(
!
nolinefeed
)
{
/* add linefeed */
if
(
t
==
target
||
t
[
-
1
]
!=
'\n'
)
ADD_TO_T
(
'\n'
);
/* FIXME: perhaps add \r too? */
}
talloced
=
strlen
(
target
)
+
1
;
if
(
nSize
&&
talloced
<
nSize
)
{
target
=
(
char
*
)
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
target
,
nSize
);
...
...
@@ -661,7 +658,7 @@ DWORD WINAPI FormatMessage16(
#undef ADD_TO_T
/***********************************************************************
* FormatMessage
32
A (KERNEL32.138)
* FormatMessageA (KERNEL32.138)
* FIXME: missing wrap,FROM_SYSTEM message-loading,
*/
DWORD
WINAPI
FormatMessageA
(
...
...
@@ -679,7 +676,7 @@ DWORD WINAPI FormatMessageA(
DWORD
talloced
;
LPSTR
from
,
f
;
DWORD
width
=
dwFlags
&
FORMAT_MESSAGE_MAX_WIDTH_MASK
;
DWORD
nolinefeed
=
0
;
BOOL
eos
=
FALSE
;
TRACE
(
"(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)
\n
"
,
dwFlags
,
lpSource
,
dwMessageId
,
dwLanguageId
,
lpBuffer
,
nSize
,
args
);
...
...
@@ -716,7 +713,7 @@ DWORD WINAPI FormatMessageA(
if
(
from
)
{
f
=
from
;
while
(
*
f
&&
!
nolinefeed
)
{
while
(
*
f
&&
!
eos
)
{
if
(
*
f
==
'%'
)
{
int
insertnr
;
char
*
fmtstr
,
*
sprintfbuf
,
*
x
,
*
lastf
;
...
...
@@ -768,7 +765,7 @@ DWORD WINAPI FormatMessageA(
else
argliststart
=
(
*
(
DWORD
**
)
args
)
+
insertnr
-
1
;
if
(
fmtstr
[
strlen
(
fmtstr
)
-
1
]
==
's'
)
if
(
fmtstr
[
strlen
(
fmtstr
)
-
1
]
==
's'
&&
argliststart
[
0
]
)
sprintfbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
((
LPSTR
)
argliststart
[
0
])
+
1
);
else
sprintfbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
100
);
...
...
@@ -791,29 +788,31 @@ DWORD WINAPI FormatMessageA(
HeapFree
(
GetProcessHeap
(),
0
,
fmtstr
);
break
;
case
'n'
:
/* FIXME: perhaps add \r too? */
ADD_TO_T
(
'\r'
);
ADD_TO_T
(
'\n'
);
f
++
;
break
;
case
'0'
:
nolinefeed
=
1
;
eos
=
TRUE
;
f
++
;
break
;
default:
ADD_TO_T
(
*
f
++
)
default:
ADD_TO_T
(
*
f
++
)
break
;
}
}
else
{
ADD_TO_T
(
*
f
++
)
}
else
{
/* '\n' or '\r' gets mapped to "\r\n" */
if
(
*
f
==
'\n'
||
*
f
==
'\r'
)
{
ADD_TO_T
(
'\r'
);
ADD_TO_T
(
'\n'
);
if
(
*
f
++
==
'\r'
&&
*
f
==
'\n'
)
f
++
;
}
else
{
ADD_TO_T
(
*
f
++
);
}
}
}
*
t
=
'\0'
;
}
if
(
!
nolinefeed
)
{
/* add linefeed */
if
(
t
==
target
||
t
[
-
1
]
!=
'\n'
)
ADD_TO_T
(
'\n'
);
/* FIXME: perhaps add \r too? */
}
talloced
=
strlen
(
target
)
+
1
;
if
(
nSize
&&
talloced
<
nSize
)
{
target
=
(
char
*
)
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
target
,
nSize
);
...
...
@@ -838,7 +837,7 @@ DWORD WINAPI FormatMessageA(
/***********************************************************************
* FormatMessage
32
W (KERNEL32.138)
* FormatMessageW (KERNEL32.138)
*/
DWORD
WINAPI
FormatMessageW
(
DWORD
dwFlags
,
...
...
@@ -855,7 +854,7 @@ DWORD WINAPI FormatMessageW(
DWORD
talloced
;
LPSTR
from
,
f
;
DWORD
width
=
dwFlags
&
FORMAT_MESSAGE_MAX_WIDTH_MASK
;
DWORD
nolinefeed
=
0
;
BOOL
eos
=
FALSE
;
TRACE
(
"(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)
\n
"
,
dwFlags
,
lpSource
,
dwMessageId
,
dwLanguageId
,
lpBuffer
,
nSize
,
args
);
...
...
@@ -894,7 +893,7 @@ DWORD WINAPI FormatMessageW(
if
(
from
)
{
f
=
from
;
while
(
*
f
&&
!
nolinefeed
)
{
while
(
*
f
&&
!
eos
)
{
if
(
*
f
==
'%'
)
{
int
insertnr
;
char
*
fmtstr
,
*
sprintfbuf
,
*
x
;
...
...
@@ -945,7 +944,7 @@ DWORD WINAPI FormatMessageW(
else
argliststart
=
(
*
(
DWORD
**
)
args
)
+
insertnr
-
1
;
if
(
fmtstr
[
strlen
(
fmtstr
)
-
1
]
==
's'
)
{
if
(
fmtstr
[
strlen
(
fmtstr
)
-
1
]
==
's'
&&
argliststart
[
0
]
)
{
DWORD
xarr
[
3
];
xarr
[
0
]
=
(
DWORD
)
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,(
LPWSTR
)(
*
(
argliststart
+
0
)));
...
...
@@ -970,29 +969,31 @@ DWORD WINAPI FormatMessageW(
HeapFree
(
GetProcessHeap
(),
0
,
fmtstr
);
break
;
case
'n'
:
/* FIXME: perhaps add \r too? */
ADD_TO_T
(
'\r'
);
ADD_TO_T
(
'\n'
);
f
++
;
break
;
case
'0'
:
nolinefeed
=
1
;
eos
=
TRUE
;
f
++
;
break
;
default:
ADD_TO_T
(
*
f
++
)
default:
ADD_TO_T
(
*
f
++
)
break
;
}
}
else
{
ADD_TO_T
(
*
f
++
)
}
else
{
/* '\n' or '\r' gets mapped to "\r\n" */
if
(
*
f
==
'\n'
||
*
f
==
'\r'
)
{
ADD_TO_T
(
'\r'
);
ADD_TO_T
(
'\n'
);
if
(
*
f
++
==
'\r'
&&
*
f
==
'\n'
)
f
++
;
}
else
{
ADD_TO_T
(
*
f
++
);
}
}
}
*
t
=
'\0'
;
}
if
(
!
nolinefeed
)
{
/* add linefeed */
if
(
t
==
target
||
t
[
-
1
]
!=
'\n'
)
ADD_TO_T
(
'\n'
);
/* FIXME: perhaps add \r too? */
}
talloced
=
strlen
(
target
)
+
1
;
if
(
nSize
&&
talloced
<
nSize
)
target
=
(
char
*
)
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
target
,
nSize
);
...
...
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