[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Announce GWorkspace-0.4pre1
From: |
Yen-Ju Chen |
Subject: |
Re: Announce GWorkspace-0.4pre1 |
Date: |
Thu, 19 Sep 2002 13:15:14 -0400 |
This patch works better.
Sorry for the previous one.
Yen-Ju
*** RtfViewer.m.orig Thu Sep 19 11:01:11 2002
--- RtfViewer.m Thu Sep 19 12:32:49 2002
***************
*** 28,34 ****
#include "RtfViewer.h"
#include "GNUstep.h"
! #define MAXDATA 3000
@implementation RtfViewer
--- 28,34 ----
#include "RtfViewer.h"
#include "GNUstep.h"
! #define MAXDATA 1000
@implementation RtfViewer
***************
*** 142,153 ****
fileAttributesAtPath: path traverseLink:
YES];
int nbytes = nbytes = [[dict objectForKey: NSFileSize] intValue];
NSFileHandle *handle = [NSFileHandle fileHandleForReadingAtPath:
path];
! data = [handle readDataOfLength: ((nbytes >= MAXDATA) ? MAXDATA :
nbytes)];
! [handle closeFile];
s = [[NSString alloc] initWithData: data
! encoding: NSNonLossyASCIIStringEncoding];
attrstr = [[NSAttributedString alloc] initWithString: s];
RELEASE (s);
AUTORELEASE (attrstr);
--- 142,160 ----
fileAttributesAtPath: path traverseLink:
YES];
int nbytes = nbytes = [[dict objectForKey: NSFileSize] intValue];
NSFileHandle *handle = [NSFileHandle fileHandleForReadingAtPath:
path];
+ int maxbytes = 0;
+ data = [NSMutableData new];
! do {
! maxbytes += MAXDATA;
!
! [(NSMutableData *)data appendData: [handle readDataOfLength: ((nbytes
>= MAXDATA) ? MAXDATA : nbytes)]];
s = [[NSString alloc] initWithData: data
! encoding: [NSString
defaultCStringEncoding]];
! } while ((s == nil) && (maxbytes < nbytes));
! [handle closeFile];
! RELEASE(data);
attrstr = [[NSAttributedString alloc] initWithString: s];
RELEASE (s);
AUTORELEASE (attrstr);
_________________________________________________________________
Join the worlds largest e-mail service with MSN Hotmail.
http://www.hotmail.com