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
c8dcafc6
Commit
c8dcafc6
authored
Feb 27, 2002
by
Andreas Mohr
Committed by
Alexandre Julliard
Feb 27, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed overflow and signed/unsigned behaviour.
parent
3c4538c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
profile.c
files/profile.c
+18
-11
No files found.
files/profile.c
View file @
c8dcafc6
...
@@ -969,6 +969,7 @@ int PROFILE_GetWineIniInt( const char *section, const char *key_name, int def )
...
@@ -969,6 +969,7 @@ int PROFILE_GetWineIniInt( const char *section, const char *key_name, int def )
PROFILE_GetWineIniString
(
section
,
key_name
,
""
,
buffer
,
sizeof
(
buffer
)
);
PROFILE_GetWineIniString
(
section
,
key_name
,
""
,
buffer
,
sizeof
(
buffer
)
);
if
(
!
buffer
[
0
])
return
def
;
if
(
!
buffer
[
0
])
return
def
;
/* FIXME: strtol wrong ?? see GetPrivateProfileIntA */
result
=
strtol
(
buffer
,
&
p
,
0
);
result
=
strtol
(
buffer
,
&
p
,
0
);
return
(
p
==
buffer
)
?
0
/* No digits at all */
:
(
int
)
result
;
return
(
p
==
buffer
)
?
0
/* No digits at all */
:
(
int
)
result
;
}
}
...
@@ -1349,12 +1350,10 @@ BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry,
...
@@ -1349,12 +1350,10 @@ BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry,
UINT16
WINAPI
GetPrivateProfileInt16
(
LPCSTR
section
,
LPCSTR
entry
,
UINT16
WINAPI
GetPrivateProfileInt16
(
LPCSTR
section
,
LPCSTR
entry
,
INT16
def_val
,
LPCSTR
filename
)
INT16
def_val
,
LPCSTR
filename
)
{
{
long
result
=
(
long
)
GetPrivateProfileIntA
(
section
,
entry
,
def_val
,
filename
);
/* we used to have some elaborate return value limitation (<= -32768 etc.)
* here, but Win98SE doesn't care about this at all, so I deleted it.
if
(
result
>
65535
)
return
65535
;
* AFAIR versions prior to Win9x had these limits, though. */
if
(
result
>=
0
)
return
(
UINT16
)
result
;
return
(
INT16
)
GetPrivateProfileIntA
(
section
,
entry
,
def_val
,
filename
);
if
(
result
<
-
32768
)
return
-
32768
;
return
(
UINT16
)(
INT16
)
result
;
}
}
/***********************************************************************
/***********************************************************************
...
@@ -1364,14 +1363,22 @@ UINT WINAPI GetPrivateProfileIntA( LPCSTR section, LPCSTR entry,
...
@@ -1364,14 +1363,22 @@ UINT WINAPI GetPrivateProfileIntA( LPCSTR section, LPCSTR entry,
INT
def_val
,
LPCSTR
filename
)
INT
def_val
,
LPCSTR
filename
)
{
{
char
buffer
[
20
];
char
buffer
[
20
];
char
*
p
;
long
result
;
long
result
;
PROFILE_GetPrivateProfileString
(
section
,
entry
,
""
,
if
(
!
PROFILE_GetPrivateProfileString
(
section
,
entry
,
""
,
buffer
,
sizeof
(
buffer
),
filename
,
FALSE
);
buffer
,
sizeof
(
buffer
),
filename
,
FALSE
))
return
def_val
;
/* FIXME: if entry can be found but it's empty, then Win16 is
* supposed to return 0 instead of def_val ! Difficult/problematic
* to implement (every other failure also returns zero buffer),
* thus wait until testing framework avail for making sure nothing
* else gets broken that way. */
if
(
!
buffer
[
0
])
return
(
UINT
)
def_val
;
if
(
!
buffer
[
0
])
return
(
UINT
)
def_val
;
result
=
strtol
(
buffer
,
&
p
,
0
);
if
(
p
==
buffer
)
return
0
;
/* No digits at all */
/* Don't use strtol() here !
* (returns LONG_MAX/MIN on overflow instead of "proper" overflow)
YES, scan for unsigned format ! (otherwise compatibility error) */
if
(
!
sscanf
(
buffer
,
"%lu"
,
&
result
))
return
0
;
return
(
UINT
)
result
;
return
(
UINT
)
result
;
}
}
...
...
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