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:
Wim van der Meer
2010-06-27 06:20:23 +00:00
parent 8bef36786e
commit 0b392e0ec9
5 changed files with 39 additions and 27 deletions
@@ -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
+1 -1
View File
@@ -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,15 +34,17 @@ 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",
B_TITLED_WINDOW,
B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_NOT_CLOSABLE|B_FRAME_EVENTS,
B_CURRENT_WORKSPACE, kCancelMsg)
:
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)
{
fPass = 0;
fPages = pages;
@@ -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);
@@ -76,8 +79,8 @@ StatusWindow::StatusWindow(int32 passes, int32 pages, PrinterDriver *pd)
// add a "Cancel" button
int32 x = 110;
int32 y = 55;
fCancel = new BButton(BRect(x, y, x + 100, y + 20), NULL, "Cancel",
new BMessage(kCancelMsg), B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS);
fCancel = new BButton(BRect(x, y, x + 100, y + 20), NULL, "Cancel",
new BMessage(kCancelMsg), B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS);
fCancel->ResizeToPreferred();
fPanel->AddChild(fCancel);
@@ -94,7 +97,7 @@ StatusWindow::StatusWindow(int32 passes, int32 pages, PrinterDriver *pd)
Show();
}
// --------------------------------------------------
void
StatusWindow::MessageReceived(BMessage *msg)
{
@@ -108,7 +111,7 @@ StatusWindow::MessageReceived(BMessage *msg)
release_sem(fCloseSem);
}
break;
case kProgressMsg:
fPage = "";
if (fPass == 0)
@@ -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();