@@ -238,20 +238,27 @@ class GenericUri {
238
238
239
239
// Allocate one block containing each part of the URI (5) plus base plus full URI, all null terminated.
240
240
// Order: scheme, auth, path, query, frag, base, uri
241
+ // Note need to set, increment, assign in 3 stages to avoid compiler warning bug.
241
242
size_t total = (3 * len + 7 ) * sizeof (Ch);
242
243
scheme_ = static_cast <Ch*>(allocator_->Malloc (total));
243
244
*scheme_ = ' \0 ' ;
244
- auth_ = scheme_ + 1 ;
245
+ auth_ = scheme_;
246
+ auth_++;
245
247
*auth_ = ' \0 ' ;
246
- path_ = auth_ + 1 ;
248
+ path_ = auth_;
249
+ path_++;
247
250
*path_ = ' \0 ' ;
248
- query_ = path_ + 1 ;
251
+ query_ = path_;
252
+ query_++;
249
253
*query_ = ' \0 ' ;
250
- frag_ = query_ + 1 ;
254
+ frag_ = query_;
255
+ frag_++;
251
256
*frag_ = ' \0 ' ;
252
- base_ = frag_ + 1 ;
257
+ base_ = frag_;
258
+ base_++;
253
259
*base_ = ' \0 ' ;
254
- uri_ = base_ + 1 ;
260
+ uri_ = base_;
261
+ uri_++;
255
262
*uri_ = ' \0 ' ;
256
263
return total;
257
264
}
@@ -293,7 +300,9 @@ class GenericUri {
293
300
}
294
301
}
295
302
// Look for auth (//([^/?#]*))?
296
- auth_ = scheme_ + GetSchemeStringLength () + 1 ;
303
+ // Note need to set, increment, assign in 3 stages to avoid compiler warning bug.
304
+ auth_ = scheme_ + GetSchemeStringLength ();
305
+ auth_++;
297
306
*auth_ = ' \0 ' ;
298
307
if (start < len - 1 && uri[start] == ' /' && uri[start + 1 ] == ' /' ) {
299
308
pos2 = start + 2 ;
@@ -308,7 +317,9 @@ class GenericUri {
308
317
start = pos2;
309
318
}
310
319
// Look for path ([^?#]*)
311
- path_ = auth_ + GetAuthStringLength () + 1 ;
320
+ // Note need to set, increment, assign in 3 stages to avoid compiler warning bug.
321
+ path_ = auth_ + GetAuthStringLength ();
322
+ path_++;
312
323
*path_ = ' \0 ' ;
313
324
if (start < len) {
314
325
pos2 = start;
@@ -326,7 +337,9 @@ class GenericUri {
326
337
}
327
338
}
328
339
// Look for query (\?([^#]*))?
329
- query_ = path_ + GetPathStringLength () + 1 ;
340
+ // Note need to set, increment, assign in 3 stages to avoid compiler warning bug.
341
+ query_ = path_ + GetPathStringLength ();
342
+ query_++;
330
343
*query_ = ' \0 ' ;
331
344
if (start < len && uri[start] == ' ?' ) {
332
345
pos2 = start + 1 ;
@@ -341,7 +354,9 @@ class GenericUri {
341
354
}
342
355
}
343
356
// Look for fragment (#(.*))?
344
- frag_ = query_ + GetQueryStringLength () + 1 ;
357
+ // Note need to set, increment, assign in 3 stages to avoid compiler warning bug.
358
+ frag_ = query_ + GetQueryStringLength ();
359
+ frag_++;
345
360
*frag_ = ' \0 ' ;
346
361
if (start < len && uri[start] == ' #' ) {
347
362
std::memcpy (frag_, &uri[start], (len - start) * sizeof (Ch));
0 commit comments