aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p@janouch.name>2018-10-02 23:17:15 +0200
committerPřemysl Janouch <p@janouch.name>2018-10-02 23:17:15 +0200
commit160f09ecc32f72c7c63227bb8a5036302d27bda0 (patch)
treecf4a2f29eee2f790dd2b5392f72ffcc9b070dfa9
parent2d3fd3317bbb0f002ba484bf63814ef899d55ef5 (diff)
downloadpdf-simple-sign-160f09ecc32f72c7c63227bb8a5036302d27bda0.tar.gz
pdf-simple-sign-160f09ecc32f72c7c63227bb8a5036302d27bda0.tar.xz
pdf-simple-sign-160f09ecc32f72c7c63227bb8a5036302d27bda0.zip
Fix octal escapes
-rw-r--r--pdf-simple-sign.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/pdf-simple-sign.cpp b/pdf-simple-sign.cpp
index 36afcf4..9366daa 100644
--- a/pdf-simple-sign.cpp
+++ b/pdf-simple-sign.cpp
@@ -136,12 +136,11 @@ struct pdf_lexer {
if (eat_newline(ch))
continue;
std::string octal;
- if (*p && strchr(oct_alphabet, *p)) octal += *p++;
- if (*p && strchr(oct_alphabet, *p)) octal += *p++;
- if (*p && strchr(oct_alphabet, *p)) octal += *p++;
- if (!octal.empty()) {
- value += char(std::stoi(octal, nullptr, 8));
- continue;
+ if (ch && strchr(oct_alphabet, ch)) {
+ octal += ch;
+ if (*p && strchr(oct_alphabet, *p)) octal += *p++;
+ if (*p && strchr(oct_alphabet, *p)) octal += *p++;
+ ch = std::stoi(octal, nullptr, 8);
}
}
}