[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

@ -52,9 +52,9 @@ HDSKSPC WINAPI SetupCreateDiskSpaceListW(PVOID Reserved1, DWORD Reserved2, UINT
list = HeapAlloc(GetProcessHeap(),0,sizeof(DISKSPACELIST));
list->dwDriveCount = 0;
ptr = drives;
while (*ptr)
{
DWORD type = GetDriveTypeW(ptr);
@ -89,8 +89,8 @@ HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT
/***********************************************************************
* SetupAddInstallSectionToDiskSpaceListA (SETUPAPI.@)
*/
BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC DiskSpace,
HINF InfHandle, HINF LayoutInfHandle,
BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC DiskSpace,
HINF InfHandle, HINF LayoutInfHandle,
LPCSTR SectionName, PVOID Reserved1, UINT Reserved2)
{
FIXME ("Stub\n");
@ -100,8 +100,8 @@ BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC DiskSpace,
/***********************************************************************
* SetupQuerySpaceRequiredOnDriveA (SETUPAPI.@)
*/
BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace,
LPCSTR DriveSpec, LONGLONG* SpaceRequired,
BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace,
LPCSTR DriveSpec, LONGLONG* SpaceRequired,
PVOID Reserved1, UINT Reserved2)
{
WCHAR driveW[20];
@ -115,7 +115,7 @@ BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace,
lstrcatW(driveW,bkslsh);
TRACE("Looking for drive %s\n",debugstr_w(driveW));
for (i = 0; i < list->dwDriveCount; i++)
{
TRACE("checking drive %s\n",debugstr_w(list->Drives[i].lpzName));
@ -137,5 +137,5 @@ BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
{
LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace;
HeapFree(GetProcessHeap(),0,list);
return TRUE;
return TRUE;
}

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

@ -114,7 +114,7 @@ BOOL WINAPI SetupGetInfInformationA(LPCVOID InfSpec, DWORD SearchControl,
/***********************************************************************
* SetupGetInfInformationW (SETUPAPI.@)
*
*
* BUGS
* Only handles the case when InfSpec is an INF handle.
*/
@ -242,7 +242,7 @@ BOOL WINAPI SetupQueryInfFileInformationA(PSP_INF_INFORMATION InfInformation,
*/
BOOL WINAPI SetupQueryInfFileInformationW(PSP_INF_INFORMATION InfInformation,
UINT InfIndex, PWSTR ReturnBuffer,
DWORD ReturnBufferSize, PDWORD RequiredSize)
DWORD ReturnBufferSize, PDWORD RequiredSize)
{
DWORD len;
LPWSTR ptr;

View file

@ -938,43 +938,43 @@ 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);
return ret;
}
static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
PSP_FILE_CALLBACK_W handler, PVOID context )
{
BOOL rc = FALSE;
@ -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 */
@ -1721,10 +1721,10 @@ UINT WINAPI SetupRenameErrorW( HWND parent, PCWSTR dialogTitle, PCWSTR source,
* SetupCopyErrorA (SETUPAPI.@)
*/
UINT WINAPI SetupCopyErrorA( HWND parent, PCSTR dialogTitle, PCSTR diskname,
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)
UINT w32error, DWORD style, PSTR pathbuffer,
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));
@ -1735,10 +1735,10 @@ UINT WINAPI SetupCopyErrorA( HWND parent, PCSTR dialogTitle, PCSTR diskname,
* SetupCopyErrorW (SETUPAPI.@)
*/
UINT WINAPI SetupCopyErrorW( HWND parent, PCWSTR dialogTitle, PCWSTR 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)
UINT w32error, DWORD style, PWSTR pathbuffer,
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));