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