| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 152c5ef commit dfd4962
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -346,17 +346,19 @@ inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate, | |||
| 346 | 346 | std::string_view str); | |
| 347 | 347 | ||
| 348 | 348 | // Used to be a macro, hence the uppercase name. | |
| 349 | - template <int N> | ||
| 350 | - inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING( | ||
| 351 | - v8::Isolate* isolate, | ||
| 352 | - const char(&data)[N]) { | ||
| 349 | + template <std::size_t N> | ||
| 350 | + requires(N > 0) | ||
| 351 | + inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING(v8::Isolate* isolate, | ||
| 352 | + const char (&data)[N]) { | ||
| 353 | + CHECK_EQ(data[N - 1], '\0'); | ||
| 353 | 354 | return OneByteString(isolate, data, N - 1); | |
| 354 | 355 | } | |
| 355 | 356 | ||
| 356 | 357 | template <std::size_t N> | |
| 358 | + requires(N > 0) | ||
| 357 | 359 | inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING( | |
| 358 | - v8::Isolate* isolate, | ||
| 359 | - const std::array<char, N>& arr) { | ||
| 360 | + v8::Isolate* isolate, const std::array<char, N>& arr) { | ||
| 361 | + CHECK_EQ(arr[N - 1], '\0'); | ||
| 360 | 362 | return OneByteString(isolate, arr.data(), N - 1); | |
| 361 | 363 | } | |
| 362 | 364 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments