Fixed if condition, Win64 _fseeki64, trivial constructors C++11 (#1883)

This commit is contained in:
Herman Semenov
2022-08-18 21:16:46 +03:00
committed by GitHub
parent fbb46b99e2
commit e65f28e61a
4 changed files with 17 additions and 5 deletions
+7 -1
View File
@@ -42,7 +42,13 @@ inline simdjson_result<size_t> parser::read_file(const std::string &path) noexce
}
// Get the file size
if(std::fseek(fp, 0, SEEK_END) < 0) {
int ret;
#if defined(SIMDJSON_VISUAL_STUDIO) && !SIMDJSON_IS_32BITS
ret = _fseeki64(fp, 0, SEEK_END);
#else
ret = std::fseek(fp, 0, SEEK_END);
#endif // _WIN64
if(ret < 0) {
std::fclose(fp);
return IO_ERROR;
}
+8 -2
View File
@@ -45,7 +45,7 @@ inline char *allocate_padded_buffer(size_t length) noexcept {
} // namespace internal
inline padded_string::padded_string() noexcept {}
inline padded_string::padded_string() noexcept = default;
inline padded_string::padded_string(size_t length) noexcept
: viable_size(length), data_ptr(internal::allocate_padded_buffer(length)) {
}
@@ -127,7 +127,13 @@ inline simdjson_result<padded_string> padded_string::load(std::string_view filen
}
// Get the file size
if(std::fseek(fp, 0, SEEK_END) < 0) {
int ret;
#if defined(SIMDJSON_VISUAL_STUDIO) && !SIMDJSON_IS_32BITS
ret = _fseeki64(fp, 0, SEEK_END);
#else
ret = std::fseek(fp, 0, SEEK_END);
#endif // _WIN64
if(ret < 0) {
std::fclose(fp);
return IO_ERROR;
}
+1 -1
View File
@@ -96,7 +96,7 @@ private:
*/
class json_scanner {
public:
json_scanner() {}
json_scanner() = default;
simdjson_inline json_block next(const simd::simd8x64<uint8_t>& in);
// Returns either UNCLOSED_STRING or SUCCESS
simdjson_inline error_code finish();
+1 -1
View File
@@ -173,7 +173,7 @@ using namespace simd;
"We support one, two or four chunks per 64-byte block.");
if(simd8x64<uint8_t>::NUM_CHUNKS == 1) {
this->check_utf8_bytes(input.chunks[0], this->prev_input_block);
} if(simd8x64<uint8_t>::NUM_CHUNKS == 2) {
} else if(simd8x64<uint8_t>::NUM_CHUNKS == 2) {
this->check_utf8_bytes(input.chunks[0], this->prev_input_block);
this->check_utf8_bytes(input.chunks[1], input.chunks[0]);
} else if(simd8x64<uint8_t>::NUM_CHUNKS == 4) {