Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4c5832ba
Commit
4c5832ba
authored
Mar 02, 2005
by
Rein Klazes
Committed by
Alexandre Julliard
Mar 02, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When enumerating keys using Get(Private)ProfileString do not include
lines without an '=' character. Added a test that shows the behavior.
parent
2fd19dfb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
profile.c
dlls/kernel/profile.c
+1
-0
profile.c
dlls/kernel/tests/profile.c
+38
-0
No files found.
dlls/kernel/profile.c
View file @
4c5832ba
...
...
@@ -863,6 +863,7 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCWSTR section_name,
if
(
len
<=
2
)
break
;
if
(
!*
key
->
name
)
continue
;
/* Skip empty lines */
if
(
IS_ENTRY_COMMENT
(
key
->
name
))
continue
;
/* Skip comments */
if
(
!
key
->
value
)
continue
;
/* Skip lines w.o. '=' */
PROFILE_CopyEntry
(
buffer
,
key
->
name
,
len
-
1
,
0
);
len
-=
strlenW
(
buffer
)
+
1
;
buffer
+=
strlenW
(
buffer
)
+
1
;
...
...
dlls/kernel/tests/profile.c
View file @
4c5832ba
...
...
@@ -28,6 +28,7 @@
#define KEY "ProfileInt"
#define SECTION "Test"
#define TESTFILE ".\\testwine.ini"
#define TESTFILE2 ".\\testwine2.ini"
struct
_profileInt
{
LPCSTR
section
;
...
...
@@ -88,7 +89,44 @@ static void test_profile_int(void)
DeleteFileA
(
TESTFILE
);
}
void
test_profile_string
()
{
HANDLE
h
;
int
ret
;
DWORD
count
;
char
buf
[
100
];
char
*
p
;
/* test that lines without an '=' will not be enumerated */
/* in the case below, name2 is a key while name3 is not. */
char
content
[]
=
"[s]
\r\n
name1=val1
\r\n
name2=
\r\n
name3
\r\n
name4=val4
\r\n
"
;
DeleteFileA
(
TESTFILE2
);
h
=
CreateFileA
(
TESTFILE2
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
h
!=
INVALID_HANDLE_VALUE
,
" cannot create %s
\n
"
,
TESTFILE2
);
if
(
h
==
INVALID_HANDLE_VALUE
)
return
;
WriteFile
(
h
,
content
,
sizeof
(
content
),
&
count
,
NULL
);
CloseHandle
(
h
);
/* enumerate the keys */
ret
=
GetPrivateProfileStringA
(
"s"
,
NULL
,
""
,
buf
,
sizeof
(
buf
),
TESTFILE2
);
for
(
p
=
buf
+
strlen
(
buf
)
+
1
;
*
p
;
p
+=
strlen
(
p
)
+
1
)
p
[
-
1
]
=
','
;
/* and test */
ok
(
!
strcmp
(
buf
,
"name1,name2,name4"
),
"wrong keys returned: %s
\n
"
,
buf
);
/* add a new key to test that the file is quite usable */
WritePrivateProfileStringA
(
"s"
,
"name5"
,
"val5"
,
TESTFILE2
);
ret
=
GetPrivateProfileStringA
(
"s"
,
NULL
,
""
,
buf
,
sizeof
(
buf
),
TESTFILE2
);
for
(
p
=
buf
+
strlen
(
buf
)
+
1
;
*
p
;
p
+=
strlen
(
p
)
+
1
)
p
[
-
1
]
=
','
;
ok
(
!
strcmp
(
buf
,
"name1,name2,name4,name5"
),
"wrong keys returned: %s
\n
"
,
buf
);
DeleteFileA
(
TESTFILE2
);
}
START_TEST
(
profile
)
{
test_profile_int
();
test_profile_string
();
}
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