fix(3p/nix): fix clang-tidy for int-string appends
Change-Id: I276de7a5fd1c705c87d35dd616e5980c747190aa Reviewed-on: https://cl.tvl.fyi/c/depot/+/1597 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
parent
418f98fe72
commit
b15b447fcb
1 changed files with 6 additions and 3 deletions
9
third_party/nix/src/libstore/derivations.cc
vendored
9
third_party/nix/src/libstore/derivations.cc
vendored
|
@ -3,6 +3,7 @@
|
|||
#include <absl/strings/match.h>
|
||||
#include <absl/strings/str_split.h>
|
||||
#include <absl/strings/string_view.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include "libstore/fs-accessor.hh"
|
||||
#include "libstore/globals.hh"
|
||||
|
@ -97,7 +98,7 @@ static std::string parseString(std::istream& str) {
|
|||
std::string res;
|
||||
expect(str, "\"");
|
||||
int c;
|
||||
while ((c = str.get()) != '"') {
|
||||
while ((c = str.get()) != '"' && c != EOF) {
|
||||
if (c == '\\') {
|
||||
c = str.get();
|
||||
if (c == 'n') {
|
||||
|
@ -106,11 +107,13 @@ static std::string parseString(std::istream& str) {
|
|||
res += '\r';
|
||||
} else if (c == 't') {
|
||||
res += '\t';
|
||||
} else if (c == EOF) {
|
||||
throw FormatError("unexpected EOF while parsing C-style escape");
|
||||
} else {
|
||||
res += c;
|
||||
res += static_cast<char>(c);
|
||||
}
|
||||
} else {
|
||||
res += c;
|
||||
res += static_cast<char>(c);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
Loading…
Reference in a new issue