summaryrefslogtreecommitdiff
blob: d87b1f6db86844b7dac2f22f8d12fdcd42c61045 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
diff -c -r -N ../Ice-3.3.0/cpp/include/IceUtil/StringUtil.h ./cpp/include/IceUtil/StringUtil.h
*** ../Ice-3.3.0/cpp/include/IceUtil/StringUtil.h	2008-05-16 14:54:00.000000000 -0230
--- ./cpp/include/IceUtil/StringUtil.h	2008-10-30 12:51:39.000000000 -0230
***************
*** 65,70 ****
--- 65,82 ----
  #else
  ICE_UTIL_API std::string errorToString(int);
  #endif
+ 
+ //
+ // Functions to convert to to all lower/upper case
+ //
+ ICE_UTIL_API std::string toLower(const std::string&);
+ ICE_UTIL_API std::string toUpper(const std::string&);
+ 
+ //
+ // Remove all whitespace from a string
+ //
+ ICE_UTIL_API std::string removeWhitespace(const std::string&);
+ 
  }
  
  #endif
diff -c -r -N ../Ice-3.3.0/cpp/src/IcePatch2/Calc.cpp ./cpp/src/IcePatch2/Calc.cpp
*** ../Ice-3.3.0/cpp/src/IcePatch2/Calc.cpp	2008-05-16 14:54:00.000000000 -0230
--- ./cpp/src/IcePatch2/Calc.cpp	2008-10-30 13:04:19.000000000 -0230
***************
*** 42,48 ****
  
          for(string::size_type i = 0; i < lhs.path.size(); ++i)
          {
!             if(::tolower(lhs.path[i]) != ::tolower(rhs.path[i]))
              {
                  return false;
              }
--- 42,48 ----
  
          for(string::size_type i = 0; i < lhs.path.size(); ++i)
          {
!             if(::tolower(static_cast<unsigned char>(lhs.path[i])) != ::tolower(static_cast<unsigned char>(rhs.path[i])))
              {
                  return false;
              }
***************
*** 59,69 ****
      {
          for(string::size_type i = 0; i < lhs.path.size() && i < rhs.path.size(); ++i)
          {
!             if(::tolower(lhs.path[i]) < ::tolower(rhs.path[i]))
              {
                  return true;
              }
!             else if(::tolower(lhs.path[i]) > ::tolower(rhs.path[i]))
              {
                  return false;
              }
--- 59,70 ----
      {
          for(string::size_type i = 0; i < lhs.path.size() && i < rhs.path.size(); ++i)
          {
!             if(::tolower(static_cast<unsigned char>(lhs.path[i])) < ::tolower(static_cast<unsigned char>(rhs.path[i])))
              {
                  return true;
              }
!             else if(::tolower(static_cast<unsigned char>(lhs.path[i])) > 
!                     ::tolower(static_cast<unsigned char>(rhs.path[i])))
              {
                  return false;
              }
diff -c -r -N ../Ice-3.3.0/cpp/src/IcePatch2/Client.cpp ./cpp/src/IcePatch2/Client.cpp
*** ../Ice-3.3.0/cpp/src/IcePatch2/Client.cpp	2008-05-16 14:54:00.000000000 -0230
--- ./cpp/src/IcePatch2/Client.cpp	2008-10-30 12:58:41.000000000 -0230
***************
*** 8,13 ****
--- 8,14 ----
  // **********************************************************************
  
  #include <IceUtil/Options.h>
+ #include <IceUtil/StringUtil.h>
  #include <Ice/Application.h>
  #include <IcePatch2/Util.h>
  #include <IcePatch2/ClientUtil.h>
***************
*** 54,60 ****
          {
              cout << "Do a thorough patch? (yes/no)" << endl;
              cin >> answer;
!             transform(answer.begin(), answer.end(), answer.begin(), ::tolower);
              if(answer == "no")
              {
                  return false;
--- 55,61 ----
          {
              cout << "Do a thorough patch? (yes/no)" << endl;
              cin >> answer;
!             answer = IceUtilInternal::toLower(answer);
              if(answer == "no")
              {
                  return false;
diff -c -r -N ../Ice-3.3.0/cpp/src/IcePatch2/Util.cpp ./cpp/src/IcePatch2/Util.cpp
*** ../Ice-3.3.0/cpp/src/IcePatch2/Util.cpp	2008-05-16 14:54:00.000000000 -0230
--- ./cpp/src/IcePatch2/Util.cpp	2008-10-30 13:01:05.000000000 -0230
***************
*** 280,286 ****
      }
  
      if(result == "/." ||
!        (result.size() == 4 && isalpha(result[0]) && result[1] == ':' && result[2] == '/' && result[3] == '.'))
      {
         return result.substr(0, result.size() - 1);
      }
--- 280,287 ----
      }
  
      if(result == "/." ||
!        (result.size() == 4 && isalpha(static_cast<unsigned char>(result[0])) && result[1] == ':' && 
!         result[2] == '/' && result[3] == '.'))
      {
         return result.substr(0, result.size() - 1);
      }
***************
*** 290,296 ****
          result.erase(result.size() - 2, 2);
      }
  
!     if(result == "/" || (result.size() == 3 && isalpha(result[0]) && result[1] == ':' && result[2] == '/'))
      {
          return result;
      }
--- 291,298 ----
          result.erase(result.size() - 2, 2);
      }
  
!     if(result == "/" || (result.size() == 3 && isalpha(static_cast<unsigned char>(result[0])) && 
!        result[1] == ':' && result[2] == '/'))
      {
          return result;
      }
***************
*** 317,328 ****
      }
  
      unsigned i = 0;
!     while(isspace(pa[i]))
      {
          ++i;
      }
  #ifdef _WIN32
!     return pa[i] == '\\' || pa[i] == '/' || pa.size() > i + 1 && isalpha(pa[i]) && pa[i + 1] == ':';
  #else
      return pa[i] == '/';
  #endif
--- 319,331 ----
      }
  
      unsigned i = 0;
!     while(isspace(static_cast<unsigned char>(pa[i])))
      {
          ++i;
      }
  #ifdef _WIN32
!     return pa[i] == '\\' || pa[i] == '/' || pa.size() > i + 1 && 
!            isalpha(static_cast<unsigned char>(pa[i])) && pa[i + 1] == ':';
  #else
      return pa[i] == '/';
  #endif
***************
*** 333,339 ****
  {
      string path = simplify(pa);
  #ifdef _WIN32
!     return path == "/" || path.size() == 3 && isalpha(path[0]) && path[1] == ':' && path[2] == '/';
  #else
      return path == "/";
  #endif
--- 336,343 ----
  {
      string path = simplify(pa);
  #ifdef _WIN32
!     return path == "/" || path.size() == 3 && isalpha(static_cast<unsigned char>(path[0])) && 
!            path[1] == ':' && path[2] == '/';
  #else
      return path == "/";
  #endif
diff -c -r -N ../Ice-3.3.0/cpp/src/IceUtil/StringUtil.cpp ./cpp/src/IceUtil/StringUtil.cpp
*** ../Ice-3.3.0/cpp/src/IceUtil/StringUtil.cpp	2008-05-16 14:54:01.000000000 -0230
--- ./cpp/src/IceUtil/StringUtil.cpp	2008-10-30 12:55:40.000000000 -0230
***************
*** 687,690 ****
--- 687,726 ----
      return errorToString(errno);
  }
  
+ string
+ IceUtilInternal::toLower(const std::string& s)
+ {
+     string result;
+     for(unsigned int i = 0; i < s.length(); ++ i)
+     {
+          result += tolower(static_cast<unsigned char>(s[i]));
+     }
+     return result;
+ }
+ 
+ string
+ IceUtilInternal::toUpper(const std::string& s)
+ {
+     string result;
+     for(unsigned int i = 0; i < s.length(); ++ i)
+     {
+          result += toupper(static_cast<unsigned char>(s[i]));
+     }
+     return result;
+ }
+ 
+ string
+ IceUtilInternal::removeWhitespace(const std::string& s)
+ {
+     string result;
+     for(unsigned int i = 0; i < s.length(); ++ i)
+     {
+          if(!isspace(static_cast<unsigned char>(s[i])))
+          {
+              result += s[i];
+          }
+     }
+     return result;
+ }
+ 
  #endif