* Now uses BTextView::FreeTextRunArray() instead of just free() where appropriate.

* When reading/writing int32, the type of the variable should match.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16699 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-03-11 12:48:38 +00:00
parent d51ecfd248
commit 5b14ba1a07

View File

@ -93,6 +93,7 @@ StyledEditView::GetStyledText(BPositionIO* stream)
bytesRead = node->ReadAttr("be:encoding", 0, 0, &encoding, sizeof(encoding));
if (bytesRead == (ssize_t)sizeof(encoding)) {
if (encoding == 65535) {
// UTF-8
fEncoding = 0;
} else {
const BCharacterSet* characterSet
@ -103,10 +104,10 @@ StyledEditView::GetStyledText(BPositionIO* stream)
}
// restore alignment
alignment align;
int32 align;
bytesRead = node->ReadAttr("alignment", 0, 0, &align, sizeof(align));
if (bytesRead == (ssize_t)sizeof(align))
SetAlignment(align);
SetAlignment((alignment)align);
// restore wrapping
bool wrap;
@ -166,7 +167,7 @@ StyledEditView::GetStyledText(BPositionIO* stream)
// ... and here we restore it
SetRunArray(0, length, runArray);
free(runArray);
FreeRunArray(runArray);
}
return result;
@ -222,7 +223,7 @@ StyledEditView::WriteStyledEditFile(BFile* file)
}
}
alignment align = Alignment();
int32 align = Alignment();
bytes = file->WriteAttr("alignment", B_INT32_TYPE, 0, &align, sizeof(align));
if (bytes < 0)
return bytes;