Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: include/v8.h

Issue 20081: Add explicit null checks after string conversions in the shells. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | samples/shell.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 static Local<String> NewUndetectable(const uint16_t* data, int length = -1); 852 static Local<String> NewUndetectable(const uint16_t* data, int length = -1);
853 853
854 /** 854 /**
855 * Converts an object to a utf8-encoded character array. Useful if 855 * Converts an object to a utf8-encoded character array. Useful if
856 * you want to print the object. 856 * you want to print the object.
857 */ 857 */
858 class EXPORT Utf8Value { 858 class EXPORT Utf8Value {
859 public: 859 public:
860 explicit Utf8Value(Handle<v8::Value> obj); 860 explicit Utf8Value(Handle<v8::Value> obj);
861 ~Utf8Value(); 861 ~Utf8Value();
862 char* operator*() { return str_; } 862 char* operator*() const { return str_; }
863 int length() { return length_; } 863 int length() { return length_; }
864 private: 864 private:
865 char* str_; 865 char* str_;
866 int length_; 866 int length_;
867 867
868 // Disallow copying and assigning. 868 // Disallow copying and assigning.
869 Utf8Value(const Utf8Value&); 869 Utf8Value(const Utf8Value&);
870 void operator=(const Utf8Value&); 870 void operator=(const Utf8Value&);
871 }; 871 };
872 872
873 /** 873 /**
874 * Converts an object to an ascii string. 874 * Converts an object to an ascii string.
875 * Useful if you want to print the object. 875 * Useful if you want to print the object.
876 */ 876 */
877 class EXPORT AsciiValue { 877 class EXPORT AsciiValue {
878 public: 878 public:
879 explicit AsciiValue(Handle<v8::Value> obj); 879 explicit AsciiValue(Handle<v8::Value> obj);
880 ~AsciiValue(); 880 ~AsciiValue();
881 char* operator*() { return str_; } 881 char* operator*() const { return str_; }
882 int length() { return length_; } 882 int length() { return length_; }
883 private: 883 private:
884 char* str_; 884 char* str_;
885 int length_; 885 int length_;
886 886
887 // Disallow copying and assigning. 887 // Disallow copying and assigning.
888 AsciiValue(const AsciiValue&); 888 AsciiValue(const AsciiValue&);
889 void operator=(const AsciiValue&); 889 void operator=(const AsciiValue&);
890 }; 890 };
891 891
892 /** 892 /**
893 * Converts an object to a two-byte string. 893 * Converts an object to a two-byte string.
894 */ 894 */
895 class EXPORT Value { 895 class EXPORT Value {
896 public: 896 public:
897 explicit Value(Handle<v8::Value> obj); 897 explicit Value(Handle<v8::Value> obj);
898 ~Value(); 898 ~Value();
899 uint16_t* operator*() { return str_; } 899 uint16_t* operator*() const { return str_; }
900 int length() { return length_; } 900 int length() { return length_; }
901 private: 901 private:
902 uint16_t* str_; 902 uint16_t* str_;
903 int length_; 903 int length_;
904 904
905 // Disallow copying and assigning. 905 // Disallow copying and assigning.
906 Value(const Value&); 906 Value(const Value&);
907 void operator=(const Value&); 907 void operator=(const Value&);
908 }; 908 };
909 }; 909 };
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 2463
2464 } // namespace v8 2464 } // namespace v8
2465 2465
2466 2466
2467 #undef EXPORT 2467 #undef EXPORT
2468 #undef EXPORT_INLINE 2468 #undef EXPORT_INLINE
2469 #undef TYPE_CHECK 2469 #undef TYPE_CHECK
2470 2470
2471 2471
2472 #endif // V8_H_ 2472 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | samples/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698