-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
・[misc] 接続モニターのタイトルバーに表示されるアップロードとダウンロード速度のテキストにパッティングを追加
- Loading branch information
Showing
28 changed files
with
16,341 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ | |
#endif | ||
|
||
/// アプリケーションのバージョン | ||
#define APP_VERSION _T("2.3") | ||
#define APP_VERSION _T("2.4") | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "stdafx.h" | ||
#include "ZstdDecompressor.h" | ||
#include <assert.h> | ||
#include "Logger.h" | ||
#include "CodeConvert.h" | ||
|
||
#pragma comment(lib, "zstd.lib") | ||
|
||
CZstdDecompressor::CZstdDecompressor() | ||
{ | ||
m_dctx = ::ZSTD_createDCtx(); | ||
assert(m_dctx); | ||
|
||
m_bufferOutSize = ZSTD_DStreamOutSize(); | ||
assert(m_bufferOutSize); | ||
m_bufferOut.reset(new BYTE[m_bufferOutSize]); | ||
} | ||
|
||
CZstdDecompressor::~CZstdDecompressor() | ||
{ | ||
::ZSTD_freeDCtx(m_dctx); | ||
} | ||
|
||
void CZstdDecompressor::feed(const std::string& data) | ||
{ | ||
// sample: https://github.com/facebook/zstd/blob/dev/examples/streaming_decompression.c | ||
ZSTD_inBuffer input = { static_cast<const void*>(data.data()), data.length(), 0 }; | ||
while (input.pos < input.size) { | ||
ZSTD_outBuffer output = { static_cast<void*>(m_bufferOut.get()), m_bufferOutSize, 0 }; | ||
|
||
size_t const ret = ::ZSTD_decompressStream(m_dctx, &output, &input); | ||
if (ZSTD_isError(ret)) { | ||
const char* errorMessage = ZSTD_getErrorName(ret); | ||
WARN_LOG << L"CZstdDecompressor::feed - ZSTD_decompressStream error: " << CodeConvert::UTF16fromUTF8(errorMessage); | ||
assert(false); | ||
return; | ||
} | ||
m_output.write(static_cast<const char*>(output.dst), output.pos); | ||
} | ||
} | ||
|
||
void CZstdDecompressor::dump() | ||
{ | ||
} | ||
|
||
std::string CZstdDecompressor::read() | ||
{ | ||
std::string out = m_output.str(); | ||
m_output.str(""); | ||
return out; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
|
||
#include "Decompressor.h" | ||
#include <sstream> | ||
#include <memory> | ||
#include <zstd.h> | ||
|
||
class CZstdDecompressor : public IDecompressor | ||
{ | ||
public: | ||
CZstdDecompressor(); | ||
~CZstdDecompressor(); | ||
|
||
// overrides | ||
virtual void feed(const std::string& data) override; | ||
virtual void dump() override; | ||
virtual std::string read() override; | ||
|
||
private: | ||
ZSTD_DCtx* m_dctx; | ||
|
||
size_t m_bufferOutSize; | ||
std::unique_ptr<BYTE[]> m_bufferOut; | ||
|
||
std::stringstream m_output; | ||
|
||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# ZSTD Windows binary package | ||
|
||
## The package contents | ||
|
||
- `zstd.exe` : Command Line Utility, supporting gzip-like arguments | ||
- `dll\libzstd.dll` : The ZSTD dynamic library (DLL) | ||
- `dll\libzstd.lib` : The import library of the ZSTD dynamic library (DLL) for Visual C++ | ||
- `example\` : The example of usage of the ZSTD library | ||
- `include\` : Header files required by the ZSTD library | ||
- `static\libzstd_static.lib` : The static ZSTD library (LIB) | ||
|
||
## Usage of Command Line Interface | ||
|
||
Command Line Interface (CLI) supports gzip-like arguments. | ||
By default CLI takes an input file and compresses it to an output file: | ||
|
||
Usage: zstd [arg] [input] [output] | ||
|
||
The full list of commands for CLI can be obtained with `-h` or `-H`. The ratio can | ||
be improved with commands from `-3` to `-16` but higher levels also have slower | ||
compression. CLI includes in-memory compression benchmark module with compression | ||
levels starting from `-b` and ending with `-e` with iteration time of `-i` seconds. | ||
CLI supports aggregation of parameters i.e. `-b1`, `-e18`, and `-i1` can be joined | ||
into `-b1e18i1`. | ||
|
||
## The example of usage of static and dynamic ZSTD libraries with gcc/MinGW | ||
|
||
Use `cd example` and `make` to build `fullbench-dll` and `fullbench-lib`. | ||
`fullbench-dll` uses a dynamic ZSTD library from the `dll` directory. | ||
`fullbench-lib` uses a static ZSTD library from the `lib` directory. | ||
|
||
## Using ZSTD DLL with gcc/MinGW | ||
|
||
The header files from `include\` and the dynamic library `dll\libzstd.dll` | ||
are required to compile a project using gcc/MinGW. | ||
The dynamic library has to be added to linking options. | ||
It means that if a project that uses ZSTD consists of a single `test-dll.c` | ||
file it should be linked with `dll\libzstd.dll`. For example: | ||
|
||
gcc $(CFLAGS) -Iinclude\ test-dll.c -o test-dll dll\libzstd.dll | ||
|
||
The compiled executable will require ZSTD DLL which is available at `dll\libzstd.dll`. | ||
|
||
## The example of usage of static and dynamic ZSTD libraries with Visual C++ | ||
|
||
Open `example\fullbench-dll.sln` to compile `fullbench-dll` that uses a | ||
dynamic ZSTD library from the `dll` directory. The solution works with Visual C++ | ||
2010 or newer. When one will open the solution with Visual C++ newer than 2010 | ||
then the solution will be upgraded to the current version. | ||
|
||
## Using ZSTD DLL with Visual C++ | ||
|
||
The header files from `include\` and the import library `dll\libzstd.lib` | ||
are required to compile a project using Visual C++. | ||
|
||
1. The path to header files should be added to `Additional Include Directories` that can | ||
be found in project properties `C/C++` then `General`. | ||
2. The import library has to be added to `Additional Dependencies` that can | ||
be found in project properties `Linker` then `Input`. | ||
If one will provide only the name `libzstd.lib` without a full path to the library | ||
the directory has to be added to `Linker\General\Additional Library Directories`. | ||
|
||
The compiled executable will require ZSTD DLL which is available at `dll\libzstd.dll`. |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# ################################################################ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under both the BSD-style license (found in the | ||
# LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
# in the COPYING file in the root directory of this source tree). | ||
# You may select, at your option, one of the above-listed licenses. | ||
# ################################################################ | ||
|
||
VOID := /dev/null | ||
ZSTDDIR := ../include | ||
LIBDIR := ../static | ||
DLLDIR := ../dll | ||
|
||
CFLAGS ?= -O3 # can select custom flags. For example : CFLAGS="-O2 -g" make | ||
CFLAGS += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \ | ||
-Wdeclaration-after-statement -Wstrict-prototypes \ | ||
-Wpointer-arith -Wstrict-aliasing=1 | ||
CFLAGS += $(MOREFLAGS) | ||
CPPFLAGS:= -I$(ZSTDDIR) -DXXH_NAMESPACE=ZSTD_ | ||
FLAGS := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
|
||
|
||
# Define *.exe as extension for Windows systems | ||
ifneq (,$(filter Windows%,$(OS))) | ||
EXT =.exe | ||
else | ||
EXT = | ||
endif | ||
|
||
.PHONY: default fullbench-dll fullbench-lib | ||
|
||
|
||
default: all | ||
|
||
all: fullbench-dll fullbench-lib | ||
|
||
|
||
fullbench-lib: fullbench.c datagen.c | ||
$(CC) $(FLAGS) $^ -o $@$(EXT) $(LIBDIR)/libzstd_static.lib | ||
|
||
fullbench-dll: fullbench.c datagen.c | ||
$(CC) $(FLAGS) $^ -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(DLLDIR)/libzstd.dll | ||
|
||
clean: | ||
@$(RM) fullbench-dll$(EXT) fullbench-lib$(EXT) \ | ||
@echo Cleaning completed |
Oops, something went wrong.