| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without | 
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are | 
| 4 // met: | 4 // met: | 
| 5 // | 5 // | 
| 6 //     * Redistributions of source code must retain the above copyright | 6 //     * Redistributions of source code must retain the above copyright | 
| 7 //       notice, this list of conditions and the following disclaimer. | 7 //       notice, this list of conditions and the following disclaimer. | 
| 8 //     * Redistributions in binary form must reproduce the above | 8 //     * Redistributions in binary form must reproduce the above | 
| 9 //       copyright notice, this list of conditions and the following | 9 //       copyright notice, this list of conditions and the following | 
| 10 //       disclaimer in the documentation and/or other materials provided | 10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 74       return false; | 74       return false; | 
| 75     } | 75     } | 
| 76   } | 76   } | 
| 77   buffer_[length_] = c; | 77   buffer_[length_] = c; | 
| 78   buffer_[length_ + 1] = '\0'; | 78   buffer_[length_ + 1] = '\0'; | 
| 79   length_++; | 79   length_++; | 
| 80   return true; | 80   return true; | 
| 81 } | 81 } | 
| 82 | 82 | 
| 83 | 83 | 
|  | 84 void StringStream::Remove(unsigned num_of_chars) { | 
|  | 85   unsigned to_remove = num_of_chars*2; | 
|  | 86   to_remove = (to_remove>length_) ? length_ : num_of_chars; | 
|  | 87   length_ -= to_remove; | 
|  | 88 } | 
|  | 89 | 
|  | 90 | 
| 84 // A control character is one that configures a format element.  For | 91 // A control character is one that configures a format element.  For | 
| 85 // instance, in %.5s, .5 are control characters. | 92 // instance, in %.5s, .5 are control characters. | 
| 86 static bool IsControlChar(char c) { | 93 static bool IsControlChar(char c) { | 
| 87   switch (c) { | 94   switch (c) { | 
| 88   case '0': case '1': case '2': case '3': case '4': case '5': | 95   case '0': case '1': case '2': case '3': case '4': case '5': | 
| 89   case '6': case '7': case '8': case '9': case '.': case '-': | 96   case '6': case '7': case '8': case '9': case '.': case '-': | 
| 90     return true; | 97     return true; | 
| 91   default: | 98   default: | 
| 92     return false; | 99     return false; | 
| 93   } | 100   } | 
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 584 | 591 | 
| 585 // Only grow once to the maximum allowable size. | 592 // Only grow once to the maximum allowable size. | 
| 586 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 593 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 
| 587   ASSERT(size_ >= *bytes); | 594   ASSERT(size_ >= *bytes); | 
| 588   *bytes = size_; | 595   *bytes = size_; | 
| 589   return space_; | 596   return space_; | 
| 590 } | 597 } | 
| 591 | 598 | 
| 592 | 599 | 
| 593 } }  // namespace v8::internal | 600 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|