[SETUPAPI/FORMATTING]

- Try to fix some indentation nightmares. No code changes

svn path=/trunk/; revision=53897
This commit is contained in:
Thomas Faber 2011-09-29 22:30:48 +00:00
parent 761d041617
commit a20f6e3513
5 changed files with 489 additions and 495 deletions

File diff suppressed because it is too large Load diff

View file

@ -149,9 +149,9 @@ static void *grow_array( void *array, unsigned int *count, size_t elem )
if (new_count < 32) new_count = 32;
if (array)
new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, array, new_count * elem );
new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, array, new_count * elem );
else
new_array = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, new_count * elem );
new_array = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, new_count * elem );
if (new_array)
*count = new_count;
@ -327,35 +327,35 @@ static const WCHAR *get_string_subst( const struct inf_file *file, const WCHAR *
strings_section = file->sections[file->strings_section];
for (j = 0, line = strings_section->lines; j < strings_section->nb_lines; j++, line++)
{
if (line->key_field == -1) continue;
if (strncmpiW( str, file->fields[line->key_field].text, *len )) continue;
if (line->key_field == -1) continue;
if (strncmpiW( str, file->fields[line->key_field].text, *len )) continue;
if (!file->fields[line->key_field].text[*len]) break;
}
if (j == strings_section->nb_lines || !line->nb_fields) goto not_found;
field = &file->fields[line->first_field];
GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, Lang, sizeof(Lang)/sizeof(TCHAR)); // get the current system locale for translated strings
strcatW(StringLangId, Lang); // append the Language identifier from GetLocaleInfo
// now you have e.g. Strings.0407 for german translations
for (i = 0; i < file->nb_sections; i++) // search in all sections
{
if (!strcmpiW(file->sections[i]->name,StringLangId)) // if the section is a Strings.* section
{
strings_section = file->sections[i]; // select this section for further use
for (j = 0, line = strings_section->lines; j < strings_section->nb_lines; j++, line++) // process all lines in this section
{
if (line->key_field == -1) continue; // if no key then skip
if (strncmpiW( str, file->fields[line->key_field].text, *len )) continue; // if wrong key name, then skip
if (!file->fields[line->key_field].text[*len]) // if value exist
{
field = &file->fields[line->first_field]; // then extract value and
break; // no more search necessary
}
}
}
}
*len = strlenW( field->text ); // set length
ret = field->text; // return the english or translated string
return ret;
}
if (j == strings_section->nb_lines || !line->nb_fields) goto not_found;
field = &file->fields[line->first_field];
GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, Lang, sizeof(Lang)/sizeof(TCHAR)); // get the current system locale for translated strings
strcatW(StringLangId, Lang); // append the Language identifier from GetLocaleInfo
// now you have e.g. Strings.0407 for german translations
for (i = 0; i < file->nb_sections; i++) // search in all sections
{
if (!strcmpiW(file->sections[i]->name,StringLangId)) // if the section is a Strings.* section
{
strings_section = file->sections[i]; // select this section for further use
for (j = 0, line = strings_section->lines; j < strings_section->nb_lines; j++, line++) // process all lines in this section
{
if (line->key_field == -1) continue; // if no key then skip
if (strncmpiW( str, file->fields[line->key_field].text, *len )) continue; // if wrong key name, then skip
if (!file->fields[line->key_field].text[*len]) // if value exist
{
field = &file->fields[line->first_field]; // then extract value and
break; // no more search necessary
}
}
}
}
*len = strlenW( field->text ); // set length
ret = field->text; // return the english or translated string
return ret;
not_found: /* check for integer id */
@ -1511,7 +1511,7 @@ BOOL WINAPI SetupGetLineByIndexW( HINF hinf, PCWSTR section, DWORD index, INFCON
index -= file->sections[section_index]->nb_lines;
}
TRACE( "(%p,%s) not found\n", hinf, debugstr_w(section) );
SetLastError( ERROR_LINE_NOT_FOUND );
SetLastError( ERROR_LINE_NOT_FOUND );
return FALSE;
}
@ -1578,7 +1578,7 @@ BOOL WINAPI SetupFindFirstLineW( HINF hinf, PCWSTR section, PCWSTR key, INFCONTE
}
}
TRACE( "(%p,%s,%s): not found\n", hinf, debugstr_w(section), debugstr_w(key) );
SetLastError( ERROR_LINE_NOT_FOUND );
SetLastError( ERROR_LINE_NOT_FOUND );
return FALSE;
}

View file

@ -938,36 +938,36 @@ static BOOL create_full_pathW(const WCHAR *path)
strcpyW(new_path, path);
while((len = strlenW(new_path)) && new_path[len - 1] == '\\')
new_path[len - 1] = 0;
new_path[len - 1] = 0;
while(!CreateDirectoryW(new_path, NULL))
{
WCHAR *slash;
DWORD last_error = GetLastError();
WCHAR *slash;
DWORD last_error = GetLastError();
if(last_error == ERROR_ALREADY_EXISTS)
break;
if(last_error == ERROR_ALREADY_EXISTS)
break;
if(last_error != ERROR_PATH_NOT_FOUND)
{
ret = FALSE;
break;
}
if(last_error != ERROR_PATH_NOT_FOUND)
{
ret = FALSE;
break;
}
if(!(slash = strrchrW(new_path, '\\')))
{
ret = FALSE;
break;
}
if(!(slash = strrchrW(new_path, '\\')))
{
ret = FALSE;
break;
}
len = slash - new_path;
new_path[len] = 0;
if(!create_full_pathW(new_path))
{
ret = FALSE;
break;
}
new_path[len] = '\\';
len = slash - new_path;
new_path[len] = 0;
if(!create_full_pathW(new_path))
{
ret = FALSE;
break;
}
new_path[len] = '\\';
}
HeapFree(GetProcessHeap(), 0, new_path);
@ -1311,15 +1311,15 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
debugstr_w( op_result == FILEOP_NEWPATH ? newpath : paths.Source ),
debugstr_w(paths.Target) );
if (op->dst_path)
{
if (!create_full_pathW( op->dst_path ))
{
paths.Win32Error = GetLastError();
op_result = handler( context, SPFILENOTIFY_COPYERROR,
(UINT_PTR)&paths, (UINT_PTR)newpath );
if (op_result == FILEOP_ABORT) goto done;
}
}
{
if (!create_full_pathW( op->dst_path ))
{
paths.Win32Error = GetLastError();
op_result = handler( context, SPFILENOTIFY_COPYERROR,
(UINT_PTR)&paths, (UINT_PTR)newpath );
if (op_result == FILEOP_ABORT) goto done;
}
}
if (do_file_copyW( op_result == FILEOP_NEWPATH ? newpath : paths.Source,
paths.Target, op->style, handler, context )) break; /* success */
/* try to extract it from the cabinet file */
@ -1724,7 +1724,7 @@ UINT WINAPI SetupRenameErrorW( HWND parent, PCWSTR dialogTitle, PCWSTR source,
UINT WINAPI SetupCopyErrorA( HWND parent, PCSTR dialogTitle, PCSTR diskname,
PCSTR sourcepath, PCSTR sourcefile, PCSTR targetpath,
UINT w32error, DWORD style, PSTR pathbuffer,
DWORD buffersize, PDWORD requiredsize)
DWORD buffersize, PDWORD requiredsize)
{
FIXME( "stub: (Error Number %d when attempting to copy file %s from %s to %s)\n",
w32error, debugstr_a(sourcefile), debugstr_a(sourcepath) ,debugstr_a(targetpath));
@ -1738,7 +1738,7 @@ UINT WINAPI SetupCopyErrorA( HWND parent, PCSTR dialogTitle, PCSTR diskname,
UINT WINAPI SetupCopyErrorW( HWND parent, PCWSTR dialogTitle, PCWSTR diskname,
PCWSTR sourcepath, PCWSTR sourcefile, PCWSTR targetpath,
UINT w32error, DWORD style, PWSTR pathbuffer,
DWORD buffersize, PDWORD requiredsize)
DWORD buffersize, PDWORD requiredsize)
{
FIXME( "stub: (Error Number %d when attempting to copy file %s from %s to %s)\n",
w32error, debugstr_w(sourcefile), debugstr_w(sourcepath) ,debugstr_w(targetpath));