Fixes compiler warnings and a few minor code style violations. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37272 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -78,7 +78,7 @@ Link::Do() {
|
||||
}
|
||||
|
||||
// TODO: check this list and add more prefixes
|
||||
char* WebLink::fURLPrefix[] = {
|
||||
const char* WebLink::fURLPrefix[] = {
|
||||
"http://",
|
||||
"https://",
|
||||
"ftp://",
|
||||
@@ -128,7 +128,7 @@ bool
|
||||
WebLink::DetectUrlWithPrefix(int start)
|
||||
{
|
||||
int pos = INT_MAX;
|
||||
char* prefix = NULL;
|
||||
const char* prefix = NULL;
|
||||
const char* utf8 = fUtf8->String();
|
||||
|
||||
// search prefix with smallest position
|
||||
|
||||
@@ -74,7 +74,7 @@ class WebLink : public Link {
|
||||
|
||||
enum kind fKind;
|
||||
|
||||
static char* fURLPrefix[];
|
||||
static const char* fURLPrefix[];
|
||||
|
||||
bool IsValidStart(const char* cp);
|
||||
bool IsValidChar(const char* cp);
|
||||
|
||||
@@ -420,7 +420,7 @@ status_t
|
||||
PDFWriter::DeclareFonts()
|
||||
{
|
||||
char buffer[1024];
|
||||
char *parameter_name;
|
||||
const char *parameter_name;
|
||||
|
||||
for (int i = 0; i < fFonts->Length(); i++) {
|
||||
FontFile* f = fFonts->At(i);
|
||||
|
||||
@@ -55,7 +55,7 @@ THE SOFTWARE.
|
||||
// static global variables
|
||||
static struct
|
||||
{
|
||||
char *label;
|
||||
const char *label;
|
||||
float width;
|
||||
float height;
|
||||
} pageFormat[] =
|
||||
@@ -78,7 +78,7 @@ static struct
|
||||
|
||||
static struct
|
||||
{
|
||||
char *label;
|
||||
const char *label;
|
||||
int32 orientation;
|
||||
} orientation[] =
|
||||
{
|
||||
|
||||
@@ -34,12 +34,14 @@ THE SOFTWARE.
|
||||
#include <Message.h>
|
||||
#include <Box.h>
|
||||
|
||||
|
||||
static const uint32 kCancelMsg = 'cncl';
|
||||
static const uint32 kProgressMsg = 'prgs';
|
||||
|
||||
// --------------------------------------------------
|
||||
|
||||
StatusWindow::StatusWindow(int32 passes, int32 pages, PrinterDriver *pd)
|
||||
: HWindow(BRect(100, 100, 700, 600), "PDF Writer",
|
||||
:
|
||||
HWindow(BRect(100, 100, 700, 600), "PDF Writer",
|
||||
B_TITLED_WINDOW,
|
||||
B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_NOT_CLOSABLE|B_FRAME_EVENTS,
|
||||
B_CURRENT_WORKSPACE, kCancelMsg)
|
||||
@@ -52,19 +54,20 @@ StatusWindow::StatusWindow(int32 passes, int32 pages, PrinterDriver *pd)
|
||||
fCloseSem = -1;
|
||||
int32 closeOption;
|
||||
|
||||
if (pd->JobMsg()->FindInt32("close_option", &closeOption) != B_OK) closeOption = kNever;
|
||||
if (pd->JobMsg()->FindInt32("close_option", &closeOption) != B_OK)
|
||||
closeOption = kNever;
|
||||
fCloseOption = (CloseOption)closeOption;
|
||||
|
||||
BRect r(0, 0, Frame().Width(), Frame().Height());
|
||||
|
||||
// view for the background color
|
||||
BView *fPanel = new BBox(r, "top_panel", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
|
||||
B_PLAIN_BORDER);
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
|
||||
AddChild(fPanel);
|
||||
|
||||
r.Set(10, 12, Frame().Width()-5, 22);
|
||||
fPageLabel = new BStringView(r, "page_text", "Page", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
||||
fPageLabel = new BStringView(r, "page_text", "Page",
|
||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
||||
fPanel->AddChild(fPageLabel);
|
||||
|
||||
r.Set(10, 15, 300-10, 10);
|
||||
@@ -94,7 +97,7 @@ StatusWindow::StatusWindow(int32 passes, int32 pages, PrinterDriver *pd)
|
||||
Show();
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
|
||||
void
|
||||
StatusWindow::MessageReceived(BMessage *msg)
|
||||
{
|
||||
@@ -124,13 +127,16 @@ StatusWindow::MessageReceived(BMessage *msg)
|
||||
fPageStatus->Update(1);
|
||||
UpdateReport();
|
||||
break;
|
||||
|
||||
default:
|
||||
inherited::MessageReceived(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void StatusWindow::UpdateReport() {
|
||||
void
|
||||
StatusWindow::UpdateReport()
|
||||
{
|
||||
Report* r = Report::Instance();
|
||||
const int32 n = r->CountItems();
|
||||
const bool update = fReportIndex < n;
|
||||
@@ -173,19 +179,24 @@ void StatusWindow::UpdateReport() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusWindow::NextPage() {
|
||||
StatusWindow::NextPage()
|
||||
{
|
||||
PostMessage(kProgressMsg);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusWindow::WaitForClose() {
|
||||
StatusWindow::WaitForClose()
|
||||
{
|
||||
fCloseSem = create_sem(0, "close_sem");
|
||||
|
||||
Lock();
|
||||
Report* r = Report::Instance();
|
||||
char b[80];
|
||||
sprintf(b, "%d Infos, %d Warnings, %d Errors", r->Count(kInfo), r->Count(kWarning), r->Count(kError));
|
||||
sprintf(b, "%d Infos, %d Warnings, %d Errors", r->Count(kInfo),
|
||||
r->Count(kWarning), r->Count(kError));
|
||||
fPageLabel->SetText(b);
|
||||
fCancel->SetLabel("Close");
|
||||
fCancel->SetEnabled(true);
|
||||
@@ -195,10 +206,11 @@ StatusWindow::WaitForClose() {
|
||||
bool hasErrorsOrWarnings = hasErrors || r->Count(kWarning);
|
||||
bool hasErrorsWarningsOrInfo = hasErrorsOrWarnings || r->Count(kInfo);
|
||||
|
||||
if (fCloseOption == kAlways ||
|
||||
fCloseOption == kNoErrors && !hasErrors ||
|
||||
fCloseOption == kNoErrorsOrWarnings && !hasErrorsOrWarnings ||
|
||||
fCloseOption == kNoErrorsWarningsOrInfo && !hasErrorsWarningsOrInfo) {
|
||||
if (fCloseOption == kAlways
|
||||
|| (fCloseOption == kNoErrors && !hasErrors)
|
||||
|| (fCloseOption == kNoErrorsOrWarnings && !hasErrorsOrWarnings)
|
||||
|| (fCloseOption == kNoErrorsWarningsOrInfo
|
||||
&& !hasErrorsWarningsOrInfo)) {
|
||||
PostMessage(kCancelMsg);
|
||||
}
|
||||
Unlock();
|
||||
|
||||
Reference in New Issue
Block a user