Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johnny Cai
wine
Commits
4041c6b6
Commit
4041c6b6
authored
22 years ago
by
Eric Pouech
Committed by
Alexandre Julliard
22 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fixed some line reading functions.
parent
1858d530
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debugger/debug.l
+10
-8
10 additions, 8 deletions
debugger/debug.l
debugger/source.c
+16
-21
16 additions, 21 deletions
debugger/source.c
with
26 additions
and
29 deletions
debugger/debug.l
+
10
−
8
View file @
4041c6b6
...
...
@@ -36,7 +36,7 @@ static int DEBUG_FetchFromLine(const char* pfx, char* buf, int size);
#define YY_INPUT(buf,result,max_size) \
if ( (result = DEBUG_FetchFromLine("Wine-dbg>", buf, max_size)) < 0 ) \
YY_FATAL_ERROR( "
Read
Line() in flex scanner failed" );
YY_FATAL_ERROR( "
FetchFrom
Line() in flex scanner failed" );
#define YY_NO_UNPUT
...
...
@@ -227,7 +227,7 @@ static int DEBUG_FetchEntireLine(const char* pfx, char** line, size_t* allo
do
{
if (!ReadFile(DEBUG_hParserInput, buf_line, sizeof(buf_line) - 1, &nread, NULL) || nread == 0)
break;
break;
buf_line[nread] = '\0';
if (check_nl && len == 0 && nread == 1 && buf_line[0] == '\n')
...
...
@@ -246,9 +246,7 @@ static int DEBUG_FetchEntireLine(const char* pfx, char** line, size_t* allo
{
*line = HeapReAlloc(GetProcessHeap(), 0, *line, *alloc = 1);
**line = '\0';
strcpy(*line + len, buf_line);
len += nread;
} while (nread == 0 || buf_line[nread - 1] != '\n');
}
/* Remove leading and trailing whitespace from the line */
stripwhite(*line);
...
...
@@ -294,10 +292,14 @@ int DEBUG_ReadLine(const char* pfx, char* buf, int size)
size_t len = 0;
DEBUG_FetchEntireLine(pfx, &line, &len, FALSE);
len = min(size, len);
memcpy(buf, line, len - 1);
len = strlen(line);
/* remove trailing \n */
if (len > 0 && line[len - 1] == '\n') len--;
len = min(size - 1, len);
memcpy(buf, line, len);
buf[len] = '\0';
return len - 1;
HeapFree(GetProcessHeap(), 0, line);
return 1;
}
static char** local_symbols /* = NULL */;
...
...
This diff is collapsed.
Click to expand it.
debugger/source.c
+
16
−
21
View file @
4041c6b6
...
...
@@ -110,7 +110,7 @@ static void* DEBUG_MapFile(const char* name, HANDLE* hMap, unsigned* size)
{
HANDLE
hFile
;
hFile
=
CreateFile
(
name
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
hFile
=
CreateFile
(
name
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
(
void
*
)
-
1
;
if
(
size
!=
NULL
&&
(
*
size
=
GetFileSize
(
hFile
,
NULL
))
==
-
1
)
return
(
void
*
)
-
1
;
...
...
@@ -152,13 +152,13 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
HANDLE
hMap
;
DWORD
status
;
char
tmppath
[
PATH_MAX
];
/*
* First see whether we have the file open already. If so, then
* use that, otherwise we have to try and open it.
*/
ol
=
DEBUG_SearchOpenFile
(
sourcefile
);
if
(
ol
==
NULL
)
{
/*
...
...
@@ -171,10 +171,10 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
basename
=
sourcefile
;
else
basename
++
;
ol
=
DEBUG_SearchOpenFile
(
basename
);
}
if
(
ol
==
NULL
)
{
/*
...
...
@@ -202,11 +202,11 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
* Now append the base file name.
*/
strcat
(
tmppath
,
basename
);
status
=
GetFileAttributes
(
tmppath
);
if
(
status
!=
-
1
)
break
;
}
if
(
sl
==
NULL
)
{
if
(
DEBUG_InteractiveP
)
...
...
@@ -217,12 +217,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
*/
sprintf
(
zbuf
,
"Enter path to file '%s': "
,
sourcefile
);
DEBUG_ReadLine
(
zbuf
,
tmppath
,
sizeof
(
tmppath
));
if
(
tmppath
[
strlen
(
tmppath
)
-
1
]
==
'\n'
)
{
tmppath
[
strlen
(
tmppath
)
-
1
]
=
'\0'
;
}
if
(
tmppath
[
strlen
(
tmppath
)
-
1
]
!=
'/'
)
{
strcat
(
tmppath
,
"/"
);
...
...
@@ -231,7 +226,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
* Now append the base file name.
*/
strcat
(
tmppath
,
basename
);
status
=
GetFileAttributes
(
tmppath
);
}
else
...
...
@@ -239,7 +234,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
status
=
-
1
;
strcpy
(
tmppath
,
sourcefile
);
}
if
(
status
==
-
1
)
{
/*
...
...
@@ -269,7 +264,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
ol
->
linelist
=
NULL
;
ol
->
size
=
0
;
ofiles
=
ol
;
addr
=
DEBUG_MapFile
(
tmppath
,
&
hMap
,
&
ol
->
size
);
if
(
addr
==
(
char
*
)
-
1
)
{
...
...
@@ -287,10 +282,10 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
ol
->
nlines
++
;
}
}
ol
->
nlines
++
;
ol
->
linelist
=
(
unsigned
int
*
)
DBG_alloc
(
ol
->
nlines
*
sizeof
(
unsigned
int
)
);
nlines
=
0
;
pnt
=
addr
;
ol
->
linelist
[
nlines
++
]
=
0
;
...
...
@@ -302,7 +297,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
}
}
ol
->
linelist
[
nlines
++
]
=
pnt
-
addr
;
}
else
{
...
...
@@ -324,7 +319,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
{
continue
;
}
rtn
=
TRUE
;
memset
(
&
buffer
,
0
,
sizeof
(
buffer
));
if
(
ol
->
linelist
[
i
+
1
]
!=
ol
->
linelist
[
i
]
)
...
...
@@ -334,7 +329,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
}
DEBUG_Printf
(
DBG_CHN_MESG
,
"%d
\t
%s
\n
"
,
i
+
1
,
buffer
);
}
DEBUG_UnmapFile
(
addr
,
hMap
);
return
rtn
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment