Author: sebor
Date: Wed Aug 29 12:06:25 2007
New Revision: 570897
URL: http://svn.apache.org/viewvc?rev=570897&view=rev
Log:
2007-08-29 Everton Araujo <[EMAIL PROTECTED]>
Martin Sebor <[EMAIL PROTECTED]>
STDCXX-522
* fstream.cc (overflow): Prevented writing junk to file when
the argument is EOF and the internal buffer is empty.
Modified:
incubator/stdcxx/trunk/include/fstream.cc
Modified: incubator/stdcxx/trunk/include/fstream.cc
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/fstream.cc?rev=570897&r1=570896&r2=570897&view=diff
==============================================================================
--- incubator/stdcxx/trunk/include/fstream.cc (original)
+++ incubator/stdcxx/trunk/include/fstream.cc Wed Aug 29 12:06:25 2007
@@ -7,22 +7,23 @@
*
***************************************************************************
*
- * Copyright 2005-2006 The Apache Software Foundation or its licensors,
- * as applicable.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at
*
- * Copyright 1994-2006 Rogue Wave Software.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 1997-2006 Rogue Wave Software, Inc.
*
**************************************************************************/
@@ -351,8 +352,14 @@
_RWSTD_STREAMSIZE __nchars;
if (__unbuf) {
- __buf = &__c_to_char;
- __nchars = 1;
+ if (this->_C_is_eof (__c)){
+ __buf = 0;
+ __nchars = 0;
+ }
+ else {
+ __buf = &__c_to_char;
+ __nchars = 1;
+ }
}
else {
// call xsputn() with a special value to have it flush