mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Rebase against cad72d3cd7a40e2c1f70d19b988e19da62710bf8
This commit is contained in:
parent
8f51d290fd
commit
7ba10a3ef2
@ -1,137 +0,0 @@
|
||||
From bbcdf76bf8fd3786856b2c9afebe2a6b3974a037 Mon Sep 17 00:00:00 2001
|
||||
From: Claudio Fontana <claudio.fontana@linaro.org>
|
||||
Date: Sat, 29 Nov 2014 22:06:20 +0100
|
||||
Subject: [PATCH] kernel32: Allow empty profile section and key name strings.
|
||||
|
||||
Consider "" a normal section, and fix calculation for zero
|
||||
length section name string and key name string.
|
||||
|
||||
Signed-off-by: Claudio Fontana <claudio.fontana@gmail.com>
|
||||
Changes by Sebastian Lackner <sebastian@fds-team.de>:
|
||||
* Several style improvements, remove todo_wine from tests
|
||||
---
|
||||
dlls/kernel32/profile.c | 40 ++++++++++++++++------------------------
|
||||
dlls/kernel32/tests/profile.c | 2 --
|
||||
2 files changed, 16 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
|
||||
index 0974aaf..f0c65f1 100644
|
||||
--- a/dlls/kernel32/profile.c
|
||||
+++ b/dlls/kernel32/profile.c
|
||||
@@ -500,7 +500,7 @@ static BOOL PROFILE_DeleteSection( PROFILESECTION **section, LPCWSTR name )
|
||||
{
|
||||
while (*section)
|
||||
{
|
||||
- if ((*section)->name[0] && !strcmpiW( (*section)->name, name ))
|
||||
+ if (!strcmpiW( (*section)->name, name ))
|
||||
{
|
||||
PROFILESECTION *to_del = *section;
|
||||
*section = to_del->next;
|
||||
@@ -524,7 +524,7 @@ static BOOL PROFILE_DeleteKey( PROFILESECTION **section,
|
||||
{
|
||||
while (*section)
|
||||
{
|
||||
- if ((*section)->name[0] && !strcmpiW( (*section)->name, section_name ))
|
||||
+ if (!strcmpiW( (*section)->name, section_name ))
|
||||
{
|
||||
PROFILEKEY **key = &(*section)->key;
|
||||
while (*key)
|
||||
@@ -556,7 +556,7 @@ static void PROFILE_DeleteAllKeys( LPCWSTR section_name)
|
||||
PROFILESECTION **section= &CurProfile->section;
|
||||
while (*section)
|
||||
{
|
||||
- if ((*section)->name[0] && !strcmpiW( (*section)->name, section_name ))
|
||||
+ if (!strcmpiW( (*section)->name, section_name ))
|
||||
{
|
||||
PROFILEKEY **key = &(*section)->key;
|
||||
while (*key)
|
||||
@@ -582,31 +582,28 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section, LPCWSTR section_name,
|
||||
LPCWSTR key_name, BOOL create, BOOL create_always )
|
||||
{
|
||||
LPCWSTR p;
|
||||
- int seclen, keylen;
|
||||
+ int seclen = 0, keylen = 0;
|
||||
|
||||
while (PROFILE_isspaceW(*section_name)) section_name++;
|
||||
if (*section_name)
|
||||
+ {
|
||||
p = section_name + strlenW(section_name) - 1;
|
||||
- else
|
||||
- p = section_name;
|
||||
-
|
||||
- while ((p > section_name) && PROFILE_isspaceW(*p)) p--;
|
||||
- seclen = p - section_name + 1;
|
||||
+ while ((p > section_name) && PROFILE_isspaceW(*p)) p--;
|
||||
+ seclen = p - section_name + 1;
|
||||
+ }
|
||||
|
||||
while (PROFILE_isspaceW(*key_name)) key_name++;
|
||||
if (*key_name)
|
||||
+ {
|
||||
p = key_name + strlenW(key_name) - 1;
|
||||
- else
|
||||
- p = key_name;
|
||||
-
|
||||
- while ((p > key_name) && PROFILE_isspaceW(*p)) p--;
|
||||
- keylen = p - key_name + 1;
|
||||
+ while ((p > key_name) && PROFILE_isspaceW(*p)) p--;
|
||||
+ keylen = p - key_name + 1;
|
||||
+ }
|
||||
|
||||
while (*section)
|
||||
{
|
||||
- if ( ((*section)->name[0])
|
||||
- && (!(strncmpiW( (*section)->name, section_name, seclen )))
|
||||
- && (((*section)->name)[seclen] == '\0') )
|
||||
+ if (!strncmpiW((*section)->name, section_name, seclen) &&
|
||||
+ ((*section)->name)[seclen] == '\0')
|
||||
{
|
||||
PROFILEKEY **key = &(*section)->key;
|
||||
|
||||
@@ -873,7 +870,7 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCWSTR section_name,
|
||||
|
||||
while (section)
|
||||
{
|
||||
- if (section->name[0] && !strcmpiW( section->name, section_name ))
|
||||
+ if (!strcmpiW( section->name, section_name ))
|
||||
{
|
||||
UINT oldlen = len;
|
||||
for (key = section->key; key; key = key->next)
|
||||
@@ -988,11 +985,6 @@ static INT PROFILE_GetString( LPCWSTR section, LPCWSTR key_name,
|
||||
if (!def_val) def_val = empty_strW;
|
||||
if (key_name)
|
||||
{
|
||||
- if (!key_name[0])
|
||||
- {
|
||||
- PROFILE_CopyEntry(buffer, def_val, len, TRUE);
|
||||
- return strlenW(buffer);
|
||||
- }
|
||||
key = PROFILE_Find( &CurProfile->section, section, key_name, FALSE, FALSE);
|
||||
PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_val,
|
||||
len, TRUE );
|
||||
@@ -1002,7 +994,7 @@ static INT PROFILE_GetString( LPCWSTR section, LPCWSTR key_name,
|
||||
return strlenW( buffer );
|
||||
}
|
||||
/* no "else" here ! */
|
||||
- if (section && section[0])
|
||||
+ if (section)
|
||||
{
|
||||
INT ret = PROFILE_GetSection(CurProfile->section, section, buffer, len, FALSE);
|
||||
if (!buffer[0]) /* no luck -> def_val */
|
||||
diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
|
||||
index 4dbe129..e443b25 100644
|
||||
--- a/dlls/kernel32/tests/profile.c
|
||||
+++ b/dlls/kernel32/tests/profile.c
|
||||
@@ -153,9 +153,7 @@ static void test_profile_string(void)
|
||||
|
||||
/* works only in unicode, ascii crashes */
|
||||
ret=GetPrivateProfileStringW(sW, emptyW, emptyW, bufW, ARRAY_SIZE(bufW), TESTFILE2W);
|
||||
- todo_wine
|
||||
ok(ret == 10, "expected 10, got %u\n", ret);
|
||||
- todo_wine
|
||||
ok(!lstrcmpW(valnokeyW,bufW), "expected %s, got %s\n",
|
||||
wine_dbgstr_w(valnokeyW), wine_dbgstr_w(bufW) );
|
||||
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,2 +0,0 @@
|
||||
Fixes: [8036] Fix handling of empty section and key name for profile files.
|
||||
Fixes: [18099] Super Mario 3: Mario Forever fails to load keyboard mapping from profile files.
|
@ -52,7 +52,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "0e8401076679f337655e72fa1726f05fcd89e069"
|
||||
echo "cad72d3cd7a40e2c1f70d19b988e19da62710bf8"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -168,7 +168,6 @@ patch_enable_all ()
|
||||
enable_kernel32_NeedCurrentDirectoryForExePath="$1"
|
||||
enable_kernel32_PE_Loader_Fixes="$1"
|
||||
enable_kernel32_Processor_Group="$1"
|
||||
enable_kernel32_Profile="$1"
|
||||
enable_kernel32_SCSI_Sysfs="$1"
|
||||
enable_krnl386_exe16_GDT_LDT_Emulation="$1"
|
||||
enable_krnl386_exe16_Invalid_Console_Handles="$1"
|
||||
@ -648,9 +647,6 @@ patch_enable ()
|
||||
kernel32-Processor_Group)
|
||||
enable_kernel32_Processor_Group="$2"
|
||||
;;
|
||||
kernel32-Profile)
|
||||
enable_kernel32_Profile="$2"
|
||||
;;
|
||||
kernel32-SCSI_Sysfs)
|
||||
enable_kernel32_SCSI_Sysfs="$2"
|
||||
;;
|
||||
@ -3883,22 +3879,6 @@ if test "$enable_kernel32_Processor_Group" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset kernel32-Profile
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#8036] Fix handling of empty section and key name for profile files.
|
||||
# | * [#18099] Super Mario 3: Mario Forever fails to load keyboard mapping from profile files.
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/kernel32/profile.c, dlls/kernel32/tests/profile.c
|
||||
# |
|
||||
if test "$enable_kernel32_Profile" -eq 1; then
|
||||
patch_apply kernel32-Profile/0001-kernel32-Allow-empty-profile-section-and-key-name-st.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Claudio Fontana", "kernel32: Allow empty profile section and key name strings.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset kernel32-SCSI_Sysfs
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
Loading…
Reference in New Issue
Block a user