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
7435723e
Commit
7435723e
authored
Aug 20, 2003
by
Eric Pouech
Committed by
Alexandre Julliard
Aug 20, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed code for handling ${VAR} constructs in .ini files.
parent
3d6e91cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
48 deletions
+10
-48
profile.c
files/profile.c
+10
-48
No files found.
files/profile.c
View file @
7435723e
...
...
@@ -108,10 +108,9 @@ static const char hex[16] = "0123456789ABCDEF";
* translating environment variables.
*/
static
void
PROFILE_CopyEntry
(
LPWSTR
buffer
,
LPCWSTR
value
,
int
len
,
int
handle_env
,
BOOL
strip_quote
)
BOOL
strip_quote
)
{
WCHAR
quote
=
'\0'
;
LPCWSTR
p
;
if
(
!
buffer
)
return
;
...
...
@@ -120,42 +119,8 @@ static void PROFILE_CopyEntry( LPWSTR buffer, LPCWSTR value, int len,
if
(
value
[
1
]
&&
(
value
[
strlenW
(
value
)
-
1
]
==
*
value
))
quote
=
*
value
++
;
}
if
(
!
handle_env
)
{
lstrcpynW
(
buffer
,
value
,
len
);
if
(
quote
&&
(
len
>=
strlenW
(
value
)))
buffer
[
strlenW
(
buffer
)
-
1
]
=
'\0'
;
return
;
}
p
=
value
;
while
(
*
p
&&
(
len
>
1
))
{
if
((
*
p
==
'$'
)
&&
(
p
[
1
]
==
'{'
))
{
WCHAR
env_val
[
1024
];
LPCWSTR
p2
=
strchrW
(
p
,
'}'
);
int
copy_len
;
if
(
!
p2
)
continue
;
/* ignore it */
copy_len
=
min
(
1024
,
(
int
)(
p2
-
p
)
-
1
);
strncpyW
(
env_val
,
p
+
2
,
copy_len
);
env_val
[
copy_len
-
1
]
=
0
;
/* ensure 0 termination */
*
buffer
=
0
;
if
(
GetEnvironmentVariableW
(
env_val
,
buffer
,
len
))
{
copy_len
=
strlenW
(
buffer
);
buffer
+=
copy_len
;
len
-=
copy_len
;
}
p
=
p2
+
1
;
}
else
{
*
buffer
++
=
*
p
++
;
len
--
;
}
}
if
(
quote
&&
(
len
>
1
))
buffer
--
;
*
buffer
=
'\0'
;
lstrcpynW
(
buffer
,
value
,
len
);
if
(
quote
&&
(
len
>=
strlenW
(
value
)))
buffer
[
strlenW
(
buffer
)
-
1
]
=
'\0'
;
}
...
...
@@ -698,8 +663,7 @@ static BOOL PROFILE_Open( LPCWSTR filename )
* If return_values is TRUE, also include the corresponding values.
*/
static
INT
PROFILE_GetSection
(
PROFILESECTION
*
section
,
LPCWSTR
section_name
,
LPWSTR
buffer
,
UINT
len
,
BOOL
handle_env
,
BOOL
return_values
)
LPWSTR
buffer
,
UINT
len
,
BOOL
return_values
)
{
PROFILEKEY
*
key
;
...
...
@@ -717,15 +681,14 @@ 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 */
PROFILE_CopyEntry
(
buffer
,
key
->
name
,
len
-
1
,
handle_env
,
0
);
PROFILE_CopyEntry
(
buffer
,
key
->
name
,
len
-
1
,
0
);
len
-=
strlenW
(
buffer
)
+
1
;
buffer
+=
strlenW
(
buffer
)
+
1
;
if
(
len
<
2
)
break
;
if
(
return_values
&&
key
->
value
)
{
buffer
[
-
1
]
=
'='
;
PROFILE_CopyEntry
(
buffer
,
key
->
value
,
len
-
1
,
handle_env
,
0
);
PROFILE_CopyEntry
(
buffer
,
key
->
value
,
len
-
1
,
0
);
len
-=
strlenW
(
buffer
)
+
1
;
buffer
+=
strlenW
(
buffer
)
+
1
;
}
...
...
@@ -829,7 +792,7 @@ static INT PROFILE_GetString( LPCWSTR section, LPCWSTR key_name,
}
key
=
PROFILE_Find
(
&
CurProfile
->
section
,
section
,
key_name
,
FALSE
,
FALSE
);
PROFILE_CopyEntry
(
buffer
,
(
key
&&
key
->
value
)
?
key
->
value
:
def_val
,
len
,
FALSE
,
TRUE
);
len
,
TRUE
);
TRACE
(
"(%s,%s,%s): returning %s
\n
"
,
debugstr_w
(
section
),
debugstr_w
(
key_name
),
debugstr_w
(
def_val
),
debugstr_w
(
buffer
)
);
...
...
@@ -838,10 +801,10 @@ static INT PROFILE_GetString( LPCWSTR section, LPCWSTR key_name,
/* no "else" here ! */
if
(
section
&&
section
[
0
])
{
INT
ret
=
PROFILE_GetSection
(
CurProfile
->
section
,
section
,
buffer
,
len
,
FALSE
,
FALSE
);
INT
ret
=
PROFILE_GetSection
(
CurProfile
->
section
,
section
,
buffer
,
len
,
FALSE
);
if
(
!
buffer
[
0
])
/* no luck -> def_val */
{
PROFILE_CopyEntry
(
buffer
,
def_val
,
len
,
FALSE
,
TRUE
);
PROFILE_CopyEntry
(
buffer
,
def_val
,
len
,
TRUE
);
ret
=
strlenW
(
buffer
);
}
return
ret
;
...
...
@@ -1254,8 +1217,7 @@ INT WINAPI GetPrivateProfileSectionW( LPCWSTR section, LPWSTR buffer,
RtlEnterCriticalSection
(
&
PROFILE_CritSect
);
if
(
PROFILE_Open
(
filename
))
ret
=
PROFILE_GetSection
(
CurProfile
->
section
,
section
,
buffer
,
len
,
FALSE
,
TRUE
);
ret
=
PROFILE_GetSection
(
CurProfile
->
section
,
section
,
buffer
,
len
,
TRUE
);
RtlLeaveCriticalSection
(
&
PROFILE_CritSect
);
...
...
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