More WriteAttr -> WriteAttrString cleanup across the tree.
Some of these were correct as they were ... but most weren't. There are a variety of other correct ones I didn't change over yet that someone else probably should (GCI task?).
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2009 Adrien Destugues, [email protected]. All rights reserved.
|
* Copyright 2009 Adrien Destugues, [email protected]. All rights reserved.
|
||||||
** Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <PlainTextCatalog.h>
|
#include <PlainTextCatalog.h>
|
||||||
|
|
||||||
@@ -354,16 +354,12 @@ PlainTextCatalog::UpdateAttributes(BFile& catalogFile)
|
|||||||
kCatMimeType, strlen(kCatMimeType)+1);
|
kCatMimeType, strlen(kCatMimeType)+1);
|
||||||
}
|
}
|
||||||
if (catalogFile.ReadAttr(BLocaleRoster::kCatLangAttr, B_STRING_TYPE, 0,
|
if (catalogFile.ReadAttr(BLocaleRoster::kCatLangAttr, B_STRING_TYPE, 0,
|
||||||
&buf, bufSize) <= 0
|
&buf, bufSize) <= 0 || fLanguageName != buf) {
|
||||||
|| fLanguageName != buf) {
|
catalogFile.WriteAttrString(BLocaleRoster::kCatLangAttr, &fLanguageName);
|
||||||
catalogFile.WriteAttr(BLocaleRoster::kCatLangAttr, B_STRING_TYPE, 0,
|
|
||||||
fLanguageName.String(), fLanguageName.Length()+1);
|
|
||||||
}
|
}
|
||||||
if (catalogFile.ReadAttr(BLocaleRoster::kCatSigAttr, B_STRING_TYPE, 0,
|
if (catalogFile.ReadAttr(BLocaleRoster::kCatSigAttr, B_STRING_TYPE, 0,
|
||||||
&buf, bufSize) <= 0
|
&buf, bufSize) <= 0 || fSignature != buf) {
|
||||||
|| fSignature != buf) {
|
catalogFile.WriteAttrString(BLocaleRoster::kCatSigAttr, &fSignature);
|
||||||
catalogFile.WriteAttr(BLocaleRoster::kCatSigAttr, B_STRING_TYPE, 0,
|
|
||||||
fSignature.String(), fSignature.Length()+1);
|
|
||||||
}
|
}
|
||||||
if (catalogFile.ReadAttr(BLocaleRoster::kCatFingerprintAttr, B_UINT32_TYPE,
|
if (catalogFile.ReadAttr(BLocaleRoster::kCatFingerprintAttr, B_UINT32_TYPE,
|
||||||
0, &temp, sizeof(uint32)) <= 0) {
|
0, &temp, sizeof(uint32)) <= 0) {
|
||||||
|
|||||||
@@ -125,11 +125,9 @@ SpamFilter::_CheckForSpam(BFile& file)
|
|||||||
delete[] stringBuffer;
|
delete[] stringBuffer;
|
||||||
|
|
||||||
// write attributes
|
// write attributes
|
||||||
const char *classificationString;
|
BString classificationString = spamRatio >= fSpamCutoffRatio ? "Spam"
|
||||||
classificationString = spamRatio >= fSpamCutoffRatio ? "Spam"
|
|
||||||
: spamRatio < fGenuineCutoffRatio ? "Genuine" : "Uncertain";
|
: spamRatio < fGenuineCutoffRatio ? "Genuine" : "Uncertain";
|
||||||
file.WriteAttr("MAIL:classification", B_STRING_TYPE, 0 /* offset */,
|
file.WriteAttrString("MAIL:classification", &classificationString);
|
||||||
classificationString, strlen(classificationString) + 1);
|
|
||||||
|
|
||||||
// Store the spam ratio in an attribute called MAIL:ratio_spam,
|
// Store the spam ratio in an attribute called MAIL:ratio_spam,
|
||||||
// attached to the eventual output file.
|
// attached to the eventual output file.
|
||||||
@@ -303,8 +301,7 @@ SpamFilter::_AddSpamToSubject(BNode& file, float spamRatio)
|
|||||||
newSubjectString << buffer;
|
newSubjectString << buffer;
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
|
|
||||||
if (file.WriteAttr("Subject", B_STRING_TYPE, 0, newSubjectString.String(),
|
if (file.WriteAttrString("Subject", &newSubjectString) < 0)
|
||||||
newSubjectString.Length()) < 0)
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -228,8 +228,8 @@ POP3Protocol::SyncMessages()
|
|||||||
}
|
}
|
||||||
ReportProgress(1, 0);
|
ReportProgress(1, 0);
|
||||||
|
|
||||||
if (file.WriteAttr("MAIL:unique_id", B_STRING_TYPE, 0, uid,
|
const BString uidStr(uid);
|
||||||
strlen(uid)) < 0)
|
if (file.WriteAttrString("MAIL:unique_id", &uidStr) < 0)
|
||||||
error = B_ERROR;
|
error = B_ERROR;
|
||||||
|
|
||||||
file.WriteAttr("MAIL:size", B_INT32_TYPE, 0, &size, sizeof(int32));
|
file.WriteAttr("MAIL:size", B_INT32_TYPE, 0, &size, sizeof(int32));
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <Resources.h>
|
#include <Resources.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
#include <String.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
#include <TranslationUtils.h>
|
#include <TranslationUtils.h>
|
||||||
#include <TranslatorFormats.h>
|
#include <TranslatorFormats.h>
|
||||||
@@ -678,8 +679,8 @@ BTranslationUtils::WriteStyledEditFile(BTextView* view, BFile* file, const char
|
|||||||
outText += length;
|
outText += length;
|
||||||
} while (sourceLength > 0);
|
} while (sourceLength > 0);
|
||||||
|
|
||||||
file->WriteAttr("be:encoding", B_STRING_TYPE, 0,
|
BString encodingStr(encoding);
|
||||||
encoding, strlen(encoding));
|
file->WriteAttrString("be:encoding", &encodingStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// truncate any extra text
|
// truncate any extra text
|
||||||
|
|||||||
@@ -185,7 +185,8 @@ Keymap::Save(const entry_ref& ref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
file.WriteAttr("keymap:name", B_STRING_TYPE, 0, fName, strlen(fName));
|
const BString name(fName);
|
||||||
|
file.WriteAttrString("keymap:name", &name);
|
||||||
// Failing would be non-fatal
|
// Failing would be non-fatal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -330,8 +330,10 @@ InputServer::_SaveKeymap(bool isDefault)
|
|||||||
// don't bother reporting an error if this fails, since this isn't fatal
|
// don't bother reporting an error if this fails, since this isn't fatal
|
||||||
// the keymap will still be functional, and will just be identified as (Current) in prefs instead of its
|
// the keymap will still be functional, and will just be identified as (Current) in prefs instead of its
|
||||||
// actual name
|
// actual name
|
||||||
if (isDefault)
|
if (isDefault) {
|
||||||
file.WriteAttr("keymap:name", B_STRING_TYPE, 0, kSystemKeymapName, strlen(kSystemKeymapName));
|
const BString systemKeymapName(kSystemKeymapName);
|
||||||
|
file.WriteAttrString("keymap:name", &systemKeymapName);
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user