Mail: some 64 bit fixes
This commit is contained in:
@@ -148,7 +148,7 @@ FilterHTMLTag(int32 &first, char **t, char *end)
|
||||
// check for some common entities (in ISO-Latin-1)
|
||||
if (first == '&') {
|
||||
// filter out and convert decimal values
|
||||
if (a[1] == '#' && sscanf(a + 2, "%ld;", &first) == 1) {
|
||||
if (a[1] == '#' && sscanf(a + 2, "%" B_SCNd32 ";", &first) == 1) {
|
||||
t[0] += strchr(a, ';') - a;
|
||||
return false;
|
||||
}
|
||||
@@ -932,11 +932,11 @@ TTextView::UpdateFont(const BFont* newFont)
|
||||
fFont = *newFont;
|
||||
|
||||
// update the text run array safely with new font
|
||||
text_run_array *runArray = RunArray(0, LONG_MAX);
|
||||
text_run_array *runArray = RunArray(0, INT32_MAX);
|
||||
for (int i = 0; i < runArray->count; i++)
|
||||
runArray->runs[i].font = *newFont;
|
||||
|
||||
SetRunArray(0, LONG_MAX, runArray);
|
||||
SetRunArray(0, INT32_MAX, runArray);
|
||||
FreeRunArray(runArray);
|
||||
}
|
||||
|
||||
@@ -1917,7 +1917,7 @@ TTextView::Open(hyper_text *enclosure)
|
||||
strcpy(baseName, enclosure->name ? enclosure->name : "enclosure");
|
||||
strcpy(name, baseName);
|
||||
for (int32 index = 0; dir.Contains(name); index++)
|
||||
sprintf(name, "%s_%ld", baseName, index);
|
||||
sprintf(name, "%s_%" B_PRId32, baseName, index);
|
||||
|
||||
BEntry entry(path.Path());
|
||||
entry_ref ref;
|
||||
|
||||
@@ -348,7 +348,7 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
fAccountMenu->AddItem(
|
||||
item = new BMenuItem(B_TRANSLATE("<none>"), NULL));
|
||||
item->SetEnabled(false);
|
||||
fAccountID = ~0UL;
|
||||
fAccountID = ~(int32)0;
|
||||
}
|
||||
// default account is invalid, set to marked
|
||||
// TODO: do this differently, no casting and knowledge
|
||||
@@ -1093,7 +1093,7 @@ QPopupMenu::AddPersonItem(const entry_ref *ref, ino_t node, BString &name,
|
||||
|
||||
if (!parentMenu->AddItem(newItem, index + 1)) {
|
||||
fprintf (stderr, "QPopupMenu::AddPersonItem: Unable to add menu "
|
||||
"item \"%s\" at index %ld.\n", sortKey.String(), index + 1);
|
||||
"item \"%s\" at index %" B_PRId32 ".\n", sortKey.String(), index + 1);
|
||||
delete newItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2396,7 +2396,7 @@ TMailWindow::Send(bool now)
|
||||
|
||||
char versionString[255];
|
||||
sprintf(versionString,
|
||||
"Mail/Haiku %ld.%ld.%ld",
|
||||
"Mail/Haiku %" B_PRIu32 ".%" B_PRIu32 ".%" B_PRIu32,
|
||||
info.major, info.middle, info.minor);
|
||||
fMail->SetHeaderField("X-Mailer", versionString);
|
||||
}
|
||||
@@ -2578,7 +2578,7 @@ TMailWindow::SaveAsDraft()
|
||||
if (status == B_OK)
|
||||
break;
|
||||
char appendix[B_FILE_NAME_LENGTH];
|
||||
sprintf(appendix, " %ld", i++);
|
||||
sprintf(appendix, " %" B_PRId32, i++);
|
||||
int32 pos = min_c(sizeof(fileName) - strlen(appendix),
|
||||
originalLength);
|
||||
sprintf(fileName + pos, "%s", appendix);
|
||||
@@ -2746,8 +2746,8 @@ TMailWindow::TrainMessageAs(const char *CommandWord)
|
||||
ErrorExit:
|
||||
beep();
|
||||
sprintf(errorString, "Unable to train the message file \"%s\" as %s. "
|
||||
"Possibly useful error code: %s (%ld).",
|
||||
filePath.Path(), CommandWord, strerror (errorCode), errorCode);
|
||||
"Possibly useful error code: %s (%" B_PRId32 ").",
|
||||
filePath.Path(), CommandWord, strerror(errorCode), errorCode);
|
||||
BAlert* alert = new BAlert("", errorString, B_TRANSLATE("OK"));
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go();
|
||||
@@ -2921,7 +2921,7 @@ TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding)
|
||||
// Put the addresses in the 'Save Address' Menu
|
||||
//
|
||||
BMenuItem *item;
|
||||
while ((item = fSaveAddrMenu->RemoveItem(0L)) != NULL)
|
||||
while ((item = fSaveAddrMenu->RemoveItem((int32)0)) != NULL)
|
||||
delete item;
|
||||
|
||||
// create the list of addresses
|
||||
@@ -2935,7 +2935,7 @@ TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding)
|
||||
BMessage *msg;
|
||||
|
||||
for (int32 i = addressList.CountItems(); i-- > 0;) {
|
||||
char *address = (char *)addressList.RemoveItem(0L);
|
||||
char *address = (char *)addressList.RemoveItem((int32)0);
|
||||
|
||||
// insert the new address in alphabetical order
|
||||
int32 index = 0;
|
||||
|
||||
@@ -338,7 +338,7 @@ TPrefsWindow::MessageReceived(BMessage* msg)
|
||||
|
||||
fNewFont->SetSize(old_size);
|
||||
if (revert) {
|
||||
sprintf(label, "%ld", old_size);
|
||||
sprintf(label, "%" B_PRId32, old_size);
|
||||
item = fSizeMenu->FindItem(label);
|
||||
if (item != NULL)
|
||||
item->SetMarked(true);
|
||||
@@ -759,7 +759,7 @@ TPrefsWindow::_BuildSizeMenu(BFont* font)
|
||||
for (loop = 0; loop < sizeof(sizes) / sizeof(int32); loop++) {
|
||||
msg = new BMessage(P_SIZE);
|
||||
msg->AddInt32("size", sizes[loop]);
|
||||
sprintf(label, "%ld", sizes[loop]);
|
||||
sprintf(label, "%" B_PRId32, sizes[loop]);
|
||||
menu->AddItem(item = new BMenuItem(label, msg));
|
||||
if (sizes[loop] == (int32)size)
|
||||
item->SetMarked(true);
|
||||
|
||||
@@ -369,7 +369,7 @@ TSignatureWindow::Save()
|
||||
|
||||
fFile = new BFile();
|
||||
while(true) {
|
||||
sprintf(name, "signature_%ld", index++);
|
||||
sprintf(name, "signature_%" B_PRId32, index++);
|
||||
if ((result = dir.CreateFile(name, fFile, true)) == B_NO_ERROR)
|
||||
break;
|
||||
if (result != EEXIST)
|
||||
|
||||
@@ -165,7 +165,7 @@ TStatusWindow::MessageReceived(BMessage* msg)
|
||||
break;
|
||||
if (result != EEXIST)
|
||||
goto err_exit;
|
||||
sprintf(newName, "%s_%ld", name, index++);
|
||||
sprintf(newName, "%s_%" B_PRId32, name, index++);
|
||||
}
|
||||
dir.FindEntry(newName, &entry);
|
||||
node = new BNodeInfo(&file);
|
||||
|
||||
@@ -320,7 +320,7 @@ BSimpleMailAttachment::SetToRFC822(BPositionIO *data, size_t length,
|
||||
BMailComponent::SetToRFC822(data, length, parseNow);
|
||||
|
||||
// this actually happens...
|
||||
if (data->Position() - position > length)
|
||||
if (data->Position() - position > (off_t)length)
|
||||
return B_ERROR;
|
||||
|
||||
length -= (data->Position() - position);
|
||||
@@ -519,8 +519,8 @@ BAttributedMailAttachment::SetTo(BFile *file, bool deleteFileWhenDone)
|
||||
// Also, we have the make up the boundary out of whole cloth
|
||||
// This is likely to give a completely random string
|
||||
BString boundary;
|
||||
boundary << "BFile--" << (int32(file) ^ time(NULL)) << "-"
|
||||
<< ~((int32)file ^ (int32)&fStatus ^ (int32)&_attributes) << "--";
|
||||
boundary << "BFile--" << ((long)file ^ time(NULL)) << "-"
|
||||
<< ~((long)file ^ (long)&fStatus ^ (long)&_attributes) << "--";
|
||||
fContainer->SetBoundary(boundary.String());
|
||||
|
||||
return fStatus = B_OK;
|
||||
@@ -558,8 +558,8 @@ BAttributedMailAttachment::SetTo(entry_ref *ref)
|
||||
buffer[i] = '_';
|
||||
}
|
||||
buffer[32] = '\0';
|
||||
boundary << "BFile-" << buffer << "--" << ((int32)_data ^ time(NULL))
|
||||
<< "-" << ~((int32)_data ^ (int32)&buffer ^ (int32)&_attributes)
|
||||
boundary << "BFile-" << buffer << "--" << ((long)_data ^ time(NULL))
|
||||
<< "-" << ~((long)_data ^ (long)&buffer ^ (long)&_attributes)
|
||||
<< "--";
|
||||
fContainer->SetBoundary(boundary.String());
|
||||
|
||||
|
||||
@@ -425,8 +425,10 @@ status_t BMIMEMultipartMailContainer::RenderToRFC822(BPositionIO *render_to) {
|
||||
ssize_t amountWritten, length;
|
||||
message_part *part = (message_part *)_components_in_raw.ItemAt(i);
|
||||
|
||||
for (off_t begin = part->start; begin < part->end; begin += sizeof(buffer)) {
|
||||
length = ((part->end - begin) >= sizeof(buffer)) ? sizeof(buffer) : (part->end - begin);
|
||||
for (off_t begin = part->start; begin < part->end;
|
||||
begin += sizeof(buffer)) {
|
||||
length = (((off_t)part->end - begin) >= (off_t)sizeof(buffer))
|
||||
? sizeof(buffer) : (part->end - begin);
|
||||
|
||||
_io_data->ReadAt(begin,buffer,length);
|
||||
amountWritten = render_to->Write(buffer,length);
|
||||
|
||||
@@ -122,7 +122,7 @@ BEmailMessage::ReplyMessage(mail_reply_to_mode replyTo, bool accountFromMail,
|
||||
BString cc;
|
||||
|
||||
for (int32 i = list.CountItems(); i-- > 0;) {
|
||||
char *address = (char *)list.RemoveItem(0L);
|
||||
char *address = (char *)list.RemoveItem((int32)0);
|
||||
|
||||
// add everything which is not the sender and not already in the list
|
||||
if (sender.ICompare(address) && cc.FindFirst(address) < 0) {
|
||||
@@ -731,7 +731,7 @@ BEmailMessage::RenderToRFC822(BPositionIO *file)
|
||||
|
||||
BString recipients;
|
||||
for (int32 i = recipientList.CountItems(); i-- > 0;) {
|
||||
char *address = (char *)recipientList.RemoveItem(0L);
|
||||
char *address = (char *)recipientList.RemoveItem((int32)0);
|
||||
|
||||
recipients << '<' << address << '>';
|
||||
if (i)
|
||||
|
||||
@@ -681,7 +681,7 @@ utf8_to_rfc2047 (char **bufp, ssize_t length, uint32 charset, char encoding)
|
||||
}
|
||||
}
|
||||
|
||||
while ((currentWord = (struct word *)words.RemoveItem(0L)) != NULL) {
|
||||
while ((currentWord = (struct word *)words.RemoveItem((int32)0)) != NULL) {
|
||||
if ((encoding != quoted_printable && encoding != base64) ||
|
||||
!currentWord->needsEncoding) {
|
||||
rfc2047.Append (currentWord->convertedWord);
|
||||
|
||||
Reference in New Issue
Block a user