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
|
// TODO: check this list and add more prefixes
|
||||||
char* WebLink::fURLPrefix[] = {
|
const char* WebLink::fURLPrefix[] = {
|
||||||
"http://",
|
"http://",
|
||||||
"https://",
|
"https://",
|
||||||
"ftp://",
|
"ftp://",
|
||||||
@@ -128,7 +128,7 @@ bool
|
|||||||
WebLink::DetectUrlWithPrefix(int start)
|
WebLink::DetectUrlWithPrefix(int start)
|
||||||
{
|
{
|
||||||
int pos = INT_MAX;
|
int pos = INT_MAX;
|
||||||
char* prefix = NULL;
|
const char* prefix = NULL;
|
||||||
const char* utf8 = fUtf8->String();
|
const char* utf8 = fUtf8->String();
|
||||||
|
|
||||||
// search prefix with smallest position
|
// search prefix with smallest position
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class WebLink : public Link {
|
|||||||
|
|
||||||
enum kind fKind;
|
enum kind fKind;
|
||||||
|
|
||||||
static char* fURLPrefix[];
|
static const char* fURLPrefix[];
|
||||||
|
|
||||||
bool IsValidStart(const char* cp);
|
bool IsValidStart(const char* cp);
|
||||||
bool IsValidChar(const char* cp);
|
bool IsValidChar(const char* cp);
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ status_t
|
|||||||
PDFWriter::DeclareFonts()
|
PDFWriter::DeclareFonts()
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
char *parameter_name;
|
const char *parameter_name;
|
||||||
|
|
||||||
for (int i = 0; i < fFonts->Length(); i++) {
|
for (int i = 0; i < fFonts->Length(); i++) {
|
||||||
FontFile* f = fFonts->At(i);
|
FontFile* f = fFonts->At(i);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ THE SOFTWARE.
|
|||||||
// static global variables
|
// static global variables
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
char *label;
|
const char *label;
|
||||||
float width;
|
float width;
|
||||||
float height;
|
float height;
|
||||||
} pageFormat[] =
|
} pageFormat[] =
|
||||||
@@ -78,7 +78,7 @@ static struct
|
|||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
char *label;
|
const char *label;
|
||||||
int32 orientation;
|
int32 orientation;
|
||||||
} orientation[] =
|
} orientation[] =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,15 +34,17 @@ THE SOFTWARE.
|
|||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
|
|
||||||
|
|
||||||
static const uint32 kCancelMsg = 'cncl';
|
static const uint32 kCancelMsg = 'cncl';
|
||||||
static const uint32 kProgressMsg = 'prgs';
|
static const uint32 kProgressMsg = 'prgs';
|
||||||
|
|
||||||
// --------------------------------------------------
|
|
||||||
StatusWindow::StatusWindow(int32 passes, int32 pages, PrinterDriver *pd)
|
StatusWindow::StatusWindow(int32 passes, int32 pages, PrinterDriver *pd)
|
||||||
: HWindow(BRect(100, 100, 700, 600), "PDF Writer",
|
:
|
||||||
B_TITLED_WINDOW,
|
HWindow(BRect(100, 100, 700, 600), "PDF Writer",
|
||||||
B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_NOT_CLOSABLE|B_FRAME_EVENTS,
|
B_TITLED_WINDOW,
|
||||||
B_CURRENT_WORKSPACE, kCancelMsg)
|
B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_NOT_CLOSABLE|B_FRAME_EVENTS,
|
||||||
|
B_CURRENT_WORKSPACE, kCancelMsg)
|
||||||
{
|
{
|
||||||
fPass = 0;
|
fPass = 0;
|
||||||
fPages = pages;
|
fPages = pages;
|
||||||
@@ -52,19 +54,20 @@ StatusWindow::StatusWindow(int32 passes, int32 pages, PrinterDriver *pd)
|
|||||||
fCloseSem = -1;
|
fCloseSem = -1;
|
||||||
int32 closeOption;
|
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;
|
fCloseOption = (CloseOption)closeOption;
|
||||||
|
|
||||||
BRect r(0, 0, Frame().Width(), Frame().Height());
|
BRect r(0, 0, Frame().Width(), Frame().Height());
|
||||||
|
|
||||||
// view for the background color
|
// view for the background color
|
||||||
BView *fPanel = new BBox(r, "top_panel", B_FOLLOW_ALL,
|
BView *fPanel = new BBox(r, "top_panel", B_FOLLOW_ALL,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
|
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
|
||||||
B_PLAIN_BORDER);
|
|
||||||
AddChild(fPanel);
|
AddChild(fPanel);
|
||||||
|
|
||||||
r.Set(10, 12, Frame().Width()-5, 22);
|
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);
|
fPanel->AddChild(fPageLabel);
|
||||||
|
|
||||||
r.Set(10, 15, 300-10, 10);
|
r.Set(10, 15, 300-10, 10);
|
||||||
@@ -76,8 +79,8 @@ StatusWindow::StatusWindow(int32 passes, int32 pages, PrinterDriver *pd)
|
|||||||
// add a "Cancel" button
|
// add a "Cancel" button
|
||||||
int32 x = 110;
|
int32 x = 110;
|
||||||
int32 y = 55;
|
int32 y = 55;
|
||||||
fCancel = new BButton(BRect(x, y, x + 100, y + 20), NULL, "Cancel",
|
fCancel = new BButton(BRect(x, y, x + 100, y + 20), NULL, "Cancel",
|
||||||
new BMessage(kCancelMsg), B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS);
|
new BMessage(kCancelMsg), B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS);
|
||||||
fCancel->ResizeToPreferred();
|
fCancel->ResizeToPreferred();
|
||||||
fPanel->AddChild(fCancel);
|
fPanel->AddChild(fCancel);
|
||||||
|
|
||||||
@@ -94,7 +97,7 @@ StatusWindow::StatusWindow(int32 passes, int32 pages, PrinterDriver *pd)
|
|||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------
|
|
||||||
void
|
void
|
||||||
StatusWindow::MessageReceived(BMessage *msg)
|
StatusWindow::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
@@ -108,7 +111,7 @@ StatusWindow::MessageReceived(BMessage *msg)
|
|||||||
release_sem(fCloseSem);
|
release_sem(fCloseSem);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kProgressMsg:
|
case kProgressMsg:
|
||||||
fPage = "";
|
fPage = "";
|
||||||
if (fPass == 0)
|
if (fPass == 0)
|
||||||
@@ -124,13 +127,16 @@ StatusWindow::MessageReceived(BMessage *msg)
|
|||||||
fPageStatus->Update(1);
|
fPageStatus->Update(1);
|
||||||
UpdateReport();
|
UpdateReport();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
inherited::MessageReceived(msg);
|
inherited::MessageReceived(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void StatusWindow::UpdateReport() {
|
void
|
||||||
|
StatusWindow::UpdateReport()
|
||||||
|
{
|
||||||
Report* r = Report::Instance();
|
Report* r = Report::Instance();
|
||||||
const int32 n = r->CountItems();
|
const int32 n = r->CountItems();
|
||||||
const bool update = fReportIndex < n;
|
const bool update = fReportIndex < n;
|
||||||
@@ -173,19 +179,24 @@ void StatusWindow::UpdateReport() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StatusWindow::NextPage() {
|
StatusWindow::NextPage()
|
||||||
|
{
|
||||||
PostMessage(kProgressMsg);
|
PostMessage(kProgressMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StatusWindow::WaitForClose() {
|
StatusWindow::WaitForClose()
|
||||||
|
{
|
||||||
fCloseSem = create_sem(0, "close_sem");
|
fCloseSem = create_sem(0, "close_sem");
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
Report* r = Report::Instance();
|
Report* r = Report::Instance();
|
||||||
char b[80];
|
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);
|
fPageLabel->SetText(b);
|
||||||
fCancel->SetLabel("Close");
|
fCancel->SetLabel("Close");
|
||||||
fCancel->SetEnabled(true);
|
fCancel->SetEnabled(true);
|
||||||
@@ -195,10 +206,11 @@ StatusWindow::WaitForClose() {
|
|||||||
bool hasErrorsOrWarnings = hasErrors || r->Count(kWarning);
|
bool hasErrorsOrWarnings = hasErrors || r->Count(kWarning);
|
||||||
bool hasErrorsWarningsOrInfo = hasErrorsOrWarnings || r->Count(kInfo);
|
bool hasErrorsWarningsOrInfo = hasErrorsOrWarnings || r->Count(kInfo);
|
||||||
|
|
||||||
if (fCloseOption == kAlways ||
|
if (fCloseOption == kAlways
|
||||||
fCloseOption == kNoErrors && !hasErrors ||
|
|| (fCloseOption == kNoErrors && !hasErrors)
|
||||||
fCloseOption == kNoErrorsOrWarnings && !hasErrorsOrWarnings ||
|
|| (fCloseOption == kNoErrorsOrWarnings && !hasErrorsOrWarnings)
|
||||||
fCloseOption == kNoErrorsWarningsOrInfo && !hasErrorsWarningsOrInfo) {
|
|| (fCloseOption == kNoErrorsWarningsOrInfo
|
||||||
|
&& !hasErrorsWarningsOrInfo)) {
|
||||||
PostMessage(kCancelMsg);
|
PostMessage(kCancelMsg);
|
||||||
}
|
}
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user