From 8759c47161717168697e5f4eaed605fe895341dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 21 Aug 2009 14:05:45 +0000 Subject: [PATCH] * We need to cast to BFile instead of BNode, as BNode is not a subclass of BPositionIO. This fixes ticket #4299. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32568 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/translators/rtf/convert.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/add-ons/translators/rtf/convert.cpp b/src/add-ons/translators/rtf/convert.cpp index a590b6b7f3..74f5a178ad 100644 --- a/src/add-ons/translators/rtf/convert.cpp +++ b/src/add-ons/translators/rtf/convert.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -588,7 +588,7 @@ convert_to_stxt(RTF::Header &header, BDataIO &target) status = swap_data(B_UINT32_TYPE, &styleHeader, sizeof(styleHeader), B_SWAP_HOST_TO_BENDIAN); - if (status != B_OK) + if (status != B_OK) return status; written = target.Write(&styleHeader, sizeof(styleHeader)); @@ -617,12 +617,12 @@ convert_to_plain_text(RTF::Header &header, BPositionIO &target) void *flattenedRuns = NULL; int32 flattenedSize = 0; - // ToDo: this is not really nice, we should adopt the BPositionIO class + // TODO: this is not really nice, we should adopt the BPositionIO class // from Dano/Zeta which has meta data support - BNode *node = dynamic_cast(&target); + BFile *file = dynamic_cast(&target); try { - TextOutput output(header, &target, node != NULL); + TextOutput output(header, &target, file != NULL); output.Work(); flattenedRuns = output.FlattenedRunArray(flattenedSize); @@ -630,16 +630,17 @@ convert_to_plain_text(RTF::Header &header, BPositionIO &target) return status; } - if (node == NULL) { + if (file == NULL) { // we can't write the styles return B_OK; } // put out styles - ssize_t written = node->WriteAttr("styles", B_RAW_TYPE, 0, flattenedRuns, flattenedSize); + ssize_t written = file->WriteAttr("styles", B_RAW_TYPE, 0, flattenedRuns, + flattenedSize); if (written >= B_OK && written != flattenedSize) - node->RemoveAttr("styles"); + file->RemoveAttr("styles"); free(flattenedRuns); return B_OK;