Skip to content

Commit

Permalink
use getline, remove target char limit
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Jan 3, 2024
1 parent 814bfd4 commit 9a13fe6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ Source and target must have the same number of lines. No validation checks are m

Duplication checks are only made on the source content. If you want to check for duplicates on the target, simply switch the order of the parameters.

Target lines must be less than 4096 characters in length.

## Build

```bash
Expand Down
6 changes: 4 additions & 2 deletions dedup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ std::tuple<std::string, std::string, size_t> dedup(const std::string &src, const
throw std::runtime_error("Unable to open " + src);
}

DWORD file_size = GetFileSize(file_handle, NULL);
LARGE_INTEGER li;
GetFileSizeEx(file_handle, &li);
SIZE_T file_size = li.QuadPart;
HANDLE file_mapping = CreateFileMapping(file_handle, NULL, PAGE_READONLY, 0, 0, NULL);
if (file_mapping == NULL) {
CloseHandle(file_handle);
Expand Down Expand Up @@ -41,7 +43,7 @@ std::tuple<std::string, std::string, size_t> dedup(const std::string &src, const

std::unordered_multimap<std::uint32_t, std::string_view> lines;

std::ifstream tgt_is(tgt);
std::ifstream tgt_is(tgt, std::ios_base::in | std::ios_base::binary);
if (!tgt_is.is_open()) throw std::runtime_error("Cannot open " + tgt);

std::string src_out = src + ".dedup";
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def build_extension(self, ext: CMakeExtension) -> None:

setup(
name="removedup",
version="1.0.5",
version="1.0.6",
author="Piero Toffanin",
author_email="pt@masseranolabs.com",
url="https://github.com/LibreTranslate/RemoveDUP",
Expand Down

0 comments on commit 9a13fe6

Please sign in to comment.