if (!buf) return 0;  char* cstring = mString.ToNewCString();  CharImpl chars(&cstring, mString.Length()); chars.Seek(PR_SEEK_SET, mOffset);  PRInt32 result = chars.write(buf,count); mLastResult = chars.get_result();  chars.Seek(PR_SEEK_SET, 0); size_t newLength; chars.Available(&newLength); mString.Assign(cstring, newLength);  delete [] (char*)mConstString; mConstString = cstring; return result;
NS_ASSERTION(PR_FALSE, "Write to a const string"); mLastResult = NS_FILE_RESULT(PR_ILLEGAL_ACCESS_ERROR); return -1;
        virtual PRInt32                 write(const char* buf, PRUint32 count)                                        {                                            if (!buf)                                                return 0;                                            // Clone our string as chars                                            char* cstring = mString.ToNewCString();                                            // Make a CharImpl and do the write                                            CharImpl chars(&cstring, mString.Length());                                            chars.Seek(PR_SEEK_SET, mOffset);                                            // Get the bytecount and result from the CharImpl                                            PRInt32 result = chars.write(buf,count);                                            mLastResult = chars.get_result();                                            // Set our string to match the new chars                                            chars.Seek(PR_SEEK_SET, 0);                                            size_t newLength;                                            chars.Available(&newLength);                                            mString.Assign(cstring, newLength);                                            // Set our const string also...                                            delete [] (char*)mConstString;                                            mConstString = cstring;                                            return result;                                        }