projects
/
AXE.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b5cf1c3
)
A few small bug fixes.
author
arjen
<arjen>
Sat, 28 Sep 2002 06:42:11 +0000
(06:42 +0000)
committer
arjen
<arjen>
Sat, 28 Sep 2002 06:42:11 +0000
(06:42 +0000)
src/string.cpp
patch
|
blob
|
history
diff --git
a/src/string.cpp
b/src/string.cpp
index
6221f2f
..
6a23007
100644
(file)
--- a/
src/string.cpp
+++ b/
src/string.cpp
@@
-5,7
+5,7
@@
***********************
** FILE NAME : string.cpp
** SYSTEM NAME : Andromeda X-Windows Encapsulation
***********************
** FILE NAME : string.cpp
** SYSTEM NAME : Andromeda X-Windows Encapsulation
-** VERSION NUMBER : $Revision: 1.
1
$
+** VERSION NUMBER : $Revision: 1.
2
$
**
** DESCRIPTION : String class implementation.
**
**
** DESCRIPTION : String class implementation.
**
@@
-23,12
+23,15
@@
/*****************************
$Log: string.cpp,v $
/*****************************
$Log: string.cpp,v $
- Revision 1.1 2002-07-25 08:01:27 arjen
+ Revision 1.2 2002-09-28 06:42:11 arjen
+ A few small bug fixes.
+
+ Revision 1.1 2002/07/25 08:01:27 arjen
First checkin, AXE release 0.2
*****************************/
First checkin, AXE release 0.2
*****************************/
-static const char RCSID[] = "$Id: string.cpp,v 1.
1 2002-07-25 08:01:27
arjen Exp $";
+static const char RCSID[] = "$Id: string.cpp,v 1.
2 2002-09-28 06:42:11
arjen Exp $";
#include <stdio.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
@@
-351,14
+354,14
@@
String& substring::operator=(const String &x)
/* Input and output */
/* Input and output */
-
ostream& operator<<(
ostream& s, const String& x)
+
std::ostream& operator<<(std::
ostream& s, const String& x)
{
if (x.p->s)
s << x.p->s;
return s;
}
{
if (x.p->s)
s << x.p->s;
return s;
}
-
istream& operator>>(
istream& s, String& x)
+
std::istream& operator>>(std::
istream& s, String& x)
{
char buf[1024];
int i;
{
char buf[1024];
int i;
@@
-369,8
+372,11
@@
istream& operator>>(istream& s, String& x)
i++;
s.get(buf[i]);
}
i++;
s.get(buf[i]);
}
- while (buf[i] != '\n');
- buf[i] = '\0';
+ while (s && buf[i] != '\n');
+ if (buf[i] == '\n')
+ {
+ buf[i] = '\0';
+ }
x = buf;
return s;
}
x = buf;
return s;
}