GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: do not get string_view from temp string · nodejs/node@3ab8aba

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • path.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/path.cc‎

Copy file name to clipboardExpand all lines: src/path.cc
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ std::string PathResolve(Environment* env,
269269
void ToNamespacedPath(Environment* env, BufferValue* path) {
270270
#ifdef _WIN32
271271
if (path->length() == 0) return;
272-
auto resolved_path = node::PathResolve(env, {path->ToStringView()});
272+
std::string resolved_path = node::PathResolve(env, {path->ToStringView()});
273273
if (resolved_path.size() <= 2) {
274274
return;
275275
}
@@ -282,14 +282,13 @@ void ToNamespacedPath(Environment* env, BufferValue* path) {
282282
if (resolved_path[2] != '?' && resolved_path[2] != '.') {
283283
// Matched non-long UNC root, convert the path to a long UNC path
284284
std::string_view unc_prefix = R"(\\?\UNC\)";
285-
std::string_view resolved_path2 = resolved_path.substr(2);
286-
size_t new_length = unc_prefix.size() + resolved_path2.size();
285+
size_t new_length = unc_prefix.size() + resolved_path.size() - 2;
287286
path->AllocateSufficientStorage(new_length + 1);
288287
path->SetLength(new_length);
289288
memcpy(path->out(), unc_prefix.data(), unc_prefix.size());
290289
memcpy(path->out() + unc_prefix.size(),
291290
resolved_path.c_str() + 2,
292-
resolved_path2.size() + 1);
291+
resolved_path.size() - 2 + 1);
293292
return;
294293
}
295294
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.