ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/gclib/GStr.cpp
(Generate patch)
# Line 106 | Line 106
106  
107   GStr::GStr():my_data(&null_data) {
108   fTokenDelimiter=NULL;
109 + fTokenizeMode=tkCharSet;
110   fLastTokenStart=0;
111   readbuf=NULL;
112 + readbufsize=0;
113   }
114  
115   GStr::GStr(const GStr& s): my_data(&null_data){
116   fTokenDelimiter=NULL;
117 + fTokenizeMode=tkCharSet;
118   fLastTokenStart=0;
119   readbuf=NULL;
120 + readbufsize=0;
121   replace_data(s.my_data);
122   }
123  
124   GStr::GStr(const char *s): my_data(&null_data) {
125    fTokenDelimiter=NULL;
126 +  fTokenizeMode=tkCharSet;
127    fLastTokenStart=0;
128    readbuf=NULL;
129 +  readbufsize=0;
130    my_data=new_data(s);
131    my_data->ref_count = 1;
132   }
133  
134   GStr::GStr(const int i): my_data(&null_data) {
135   fTokenDelimiter=NULL;
136 + fTokenizeMode=tkCharSet;
137   fLastTokenStart=0;
138   readbuf=NULL;
139 + readbufsize=0;
140   char buf[20];
141   sprintf(buf,"%d",i);
142   const int len = ::strlen(buf);
# Line 138 | Line 146
146  
147   GStr::GStr(const double f): my_data(&null_data) {
148   fTokenDelimiter=NULL;
149 + fTokenizeMode=tkCharSet;
150   fLastTokenStart=0;
151   readbuf=NULL;
152 + readbufsize=0;
153   char buf[20];
154   sprintf(buf,"%f",f);
155   const int len = ::strlen(buf);
# Line 149 | Line 159
159  
160   GStr::GStr(char c, int n): my_data(&null_data) {
161    fTokenDelimiter=NULL;
162 +  fTokenizeMode=tkCharSet;
163    fLastTokenStart=0;
164    readbuf=NULL;
165 +  readbufsize=0;
166    replace_data(n); ::memset(chrs(), c, n);
167    }
168  
# Line 1089 | Line 1101
1101  
1102   void GStr::startTokenize(const char* delimiter, enTokenizeMode tokenizemode) {
1103   GFREE(fTokenDelimiter);
1104 < GMALLOC(fTokenDelimiter,strlen(delimiter)+1);
1105 < strcpy(fTokenDelimiter, delimiter);
1104 > if (delimiter) {
1105 >    GMALLOC(fTokenDelimiter,strlen(delimiter)+1);
1106 >    strcpy(fTokenDelimiter, delimiter);
1107 >    }
1108   fLastTokenStart=0;
1109   fTokenizeMode=tokenizemode;
1110   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines