/*
 * Copyright 2003-2006, Haiku. All rights reserved.
 * Distributed under the terms of the MIT License.
 *
 * Authors in chronological order:
 *		Sikosis
 *		Jérôme Duval
 */
 
 
#include "Media.h"
 
#include <stdio.h>
 
#include <Catalog.h>
#include <Locale.h>
#include <StorageKit.h>
#include <String.h>
 
 
Media::Media() 
	:
	BApplication("application/x-vnd.Haiku-Media"),
	fIcons(),
	fWindow(NULL)
{
	BRect rect(32, 64, 637, 462);
 
	BPath path;
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
		path.Append(SETTINGS_FILE);
		BFile file(path.Path(),B_READ_ONLY);
		if (file.InitCheck()==B_OK) {
			char buffer[255];
			ssize_t size = 0;
			while ((size = file.Read(buffer, 255)) > 0) {
				int32 i = 0;
				while (buffer[i] == '#') {
					while (i < size && buffer[i] != '\n')
						i++;
					i++;
				}
				int32 a, b, c, d;
				const char* scanString = " rect = %li,%li,%li,%li";
				if (sscanf(&buffer[i], scanString, &a, &b, &c, &d) == 4) {
					if (c - a >= rect.IntegerWidth()) {
						rect.left = a;
						rect.right = c;
					}
					if (d - b >= rect.IntegerHeight()) {
						rect.top = b;
						rect.bottom = d;
					}
				}
			}
		}
	}
 
	MediaListItem::SetIcons(&fIcons);
	fWindow = new MediaWindow(rect);
}
 
 
status_t
Media::InitCheck()
{
	if (fWindow)
		return fWindow->InitCheck();
	return B_OK;
}
 
 
//	#pragma mark -
 
 
int
main(int, char**)
{
	Media app;
	if (app.InitCheck() == B_OK)
		app.Run();
 
	return 0;
}
 

V576 Incorrect format. Consider checking the third actual argument of the 'sscanf' function. A pointer to the signed long type is expected.

V576 Incorrect format. Consider checking the fifth actual argument of the 'sscanf' function. A pointer to the signed long type is expected.

V576 Incorrect format. Consider checking the sixth actual argument of the 'sscanf' function. A pointer to the signed long type is expected.

V576 Incorrect format. Consider checking the fourth actual argument of the 'sscanf' function. A pointer to the signed long type is expected.