File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change 44
44
return node::THROW_ERR_OUT_OF_RANGE (env, " Index out of range" ); \
45
45
} while (0 ) \
46
46
47
- #define SLICE_START_END (env, start_arg, end_arg, end_max ) \
48
- size_t start = 0 ; \
49
- size_t end = 0 ; \
50
- THROW_AND_RETURN_IF_OOB (ParseArrayIndex(env, start_arg, 0 , &start)); \
51
- THROW_AND_RETURN_IF_OOB (ParseArrayIndex(env, end_arg, end_max, &end)); \
52
- if (end < start) end = start; \
53
- THROW_AND_RETURN_IF_OOB (Just(end <= end_max)); \
54
- size_t length = end - start;
55
-
56
47
namespace node {
57
48
namespace Buffer {
58
49
@@ -467,7 +458,13 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
467
458
if (buffer.length () == 0 )
468
459
return args.GetReturnValue ().SetEmptyString ();
469
460
470
- SLICE_START_END (env, args[0 ], args[1 ], buffer.length ())
461
+ size_t start = 0 ;
462
+ size_t end = 0 ;
463
+ THROW_AND_RETURN_IF_OOB (ParseArrayIndex (env, args[0 ], 0 , &start));
464
+ THROW_AND_RETURN_IF_OOB (ParseArrayIndex (env, args[1 ], buffer.length (), &end));
465
+ if (end < start) end = start;
466
+ THROW_AND_RETURN_IF_OOB (Just (end <= buffer.length ()));
467
+ size_t length = end - start;
471
468
472
469
Local<Value> error;
473
470
MaybeLocal<Value> ret =
You can’t perform that action at this time.
0 commit comments