From c92efcc0eb27d1d330b57ecc4fe0523828e0c015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 7 May 2010 07:48:17 +0000 Subject: [PATCH] * Adapted to Ingo's suggestions: used a more descriptive attribute name, got rid of the superfluous fSaveMessage check in LoadAttrs(). * Also made the attribute name a proper const variable, and renamed it to kInfoAttributeName. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36705 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/stylededit/StyledEditWindow.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index 0f9e23eae4..810479d3bd 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -47,8 +47,8 @@ using namespace BPrivate; const float kLineViewWidth = 30.0; +const char* kInfoAttributeName = "StyledEdit-info"; -#define ATTRNAME_SE_INFO "se-info" #undef TR_CONTEXT #define TR_CONTEXT "StyledEditWindow" @@ -348,9 +348,6 @@ StyledEditWindow::InitWindow(uint32 encoding) void StyledEditWindow::LoadAttrs() { - if (!fSaveMessage) - return; - entry_ref dir; const char* name; if (fSaveMessage->FindRef("directory", &dir) != B_OK @@ -365,7 +362,7 @@ StyledEditWindow::LoadAttrs() return; BRect newFrame; - ssize_t bytesRead = documentNode.ReadAttr(ATTRNAME_SE_INFO, B_RECT_TYPE, + ssize_t bytesRead = documentNode.ReadAttr(kInfoAttributeName, B_RECT_TYPE, 0, &newFrame, sizeof(BRect)); if (bytesRead != sizeof(BRect)) return; @@ -404,7 +401,7 @@ StyledEditWindow::SaveAttrs() BRect frame(Frame()); swap_data(B_RECT_TYPE, &frame, sizeof(BRect), B_SWAP_HOST_TO_BENDIAN); - documentNode.WriteAttr(ATTRNAME_SE_INFO, B_RECT_TYPE, 0, &frame, + documentNode.WriteAttr(kInfoAttributeName, B_RECT_TYPE, 0, &frame, sizeof(BRect)); }