aboutsummaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'libraries')
-rw-r--r--libraries/README.md26
-rw-r--r--libraries/katabasis/README.md6
-rw-r--r--libraries/katabasis/acknowledgements.md38
-rw-r--r--libraries/murmur2/src/MurmurHash2.cpp172
-rw-r--r--libraries/murmur2/src/MurmurHash2.h39
-rw-r--r--libraries/tomlc99/README.md25
6 files changed, 169 insertions, 137 deletions
diff --git a/libraries/README.md b/libraries/README.md
index 37f53385..8e4bd61b 100644
--- a/libraries/README.md
+++ b/libraries/README.md
@@ -3,6 +3,7 @@
This folder has third-party or otherwise external libraries needed for other parts to work.
## classparser
+
A simplistic parser for Java class files.
This library has served as a base for some (much more full-featured and advanced) work under NDA for AVG. It, however, should NOT be confused with that work.
@@ -15,24 +16,22 @@ A performance optimization daemon.
See [github repo](https://github.com/FeralInteractive/gamemode).
-BSD licensed
+BSD-3-Clause licensed
## hoedown
+
Hoedown is a revived fork of Sundown, the Markdown parser based on the original code of the Upskirt library by Natacha Porté.
See [github repo](https://github.com/hoedown/hoedown).
-## iconfix
-This was originally part of the razor-qt project and the Qt toolkit, respecitvely. Its sole purpose is to reimplement Qt's icon loading logic to prevent it from using any platform plugins that could break icon loading.
-
-Licensed under LGPL 2.1
-
## javacheck
+
Simple Java tool that prints the JVM details - version and platform bitness.
Do what you want with it. It is so trivial that noone cares.
## Katabasis
+
Oauth2 library customized for Microsoft authentication.
This is a fork of the [O2 library](https://github.com/pipacs/o2).
@@ -40,9 +39,11 @@ This is a fork of the [O2 library](https://github.com/pipacs/o2).
MIT licensed.
## launcher
+
Java launcher part for Minecraft.
It:
+
* Starts a process
* Waits for a launch script on stdin
* Consumes the launch script you feed it
@@ -56,6 +57,7 @@ A `legacy` and `onesix` launchers are available.
* `onesix` can handle launching any Minecraft version, at the cost of some extra features `legacy` enables (custom window icon and title).
Example (some parts have been censored):
+
```
mod legacyjavafixer-1.0
mainClass net.minecraft.launchwrapper.Launch
@@ -136,6 +138,7 @@ launcher onesix
Available under `GPL-3.0-only` (with classpath exception), sublicensed from its original `Apache-2.0` codebase
## libnbtplusplus
+
libnbt++ is a free C++ library for Minecraft's file format Named Binary Tag (NBT). It can read and write compressed and uncompressed NBT files and provides a code interface for working with NBT data.
See [github repo](https://github.com/ljfa-ag/libnbtplusplus).
@@ -143,6 +146,7 @@ See [github repo](https://github.com/ljfa-ag/libnbtplusplus).
Available either under LGPL version 3 or later.
## LocalPeer
+
Library for making only one instance of the application run at all times.
BSD licensed, derived from [QtSingleApplication](https://github.com/qtproject/qt-solutions/tree/master/qtsingleapplication).
@@ -157,18 +161,19 @@ Public domain (the author disclaimed the copyright).
## quazip
-A zip manipulation library, forked for MultiMC's use.
+A zip manipulation library.
-LGPL 2.1
+LGPL 2.1 with linking exception.
## rainbow
+
Color functions extracted from [KGuiAddons](https://inqlude.org/libraries/kguiaddons.html). Used for adaptive text coloring.
Available either under LGPL version 2.1 or later.
## systeminfo
-A MultiMC-specific library for probing system information.
+A PolyMC-specific library for probing system information.
Apache 2.0
@@ -182,7 +187,6 @@ Licenced under the MIT licence.
## xz-embedded
-Tiny implementation of LZMA2 de/compression. This format is only used by Forge to save bandwidth.
+Tiny implementation of LZMA2 de/compression. This format was only used by Forge to save bandwidth.
Public domain.
-
diff --git a/libraries/katabasis/README.md b/libraries/katabasis/README.md
index 08f3c9d1..621446e1 100644
--- a/libraries/katabasis/README.md
+++ b/libraries/katabasis/README.md
@@ -8,9 +8,9 @@ It may be possible to backport some of the changes to O2 in the future, but for
Notes to contributors:
- * Please follow the coding style of the existing source, where reasonable
- * Code contributions are released under Simplified BSD License, as specified in LICENSE. Do not contribute if this license does not suit your code
- * If you are interested in working on this, come to the PolyMC Discord server and talk first
+* Please follow the coding style of the existing source, where reasonable
+* Code contributions are released under Simplified BSD License, as specified in LICENSE. Do not contribute if this license does not suit your code
+* If you are interested in working on this, come to the PolyMC Discord server and talk first
## Installation
diff --git a/libraries/katabasis/acknowledgements.md b/libraries/katabasis/acknowledgements.md
index c1c8a3d4..ccc7c263 100644
--- a/libraries/katabasis/acknowledgements.md
+++ b/libraries/katabasis/acknowledgements.md
@@ -1,4 +1,4 @@
-# O2 library by Akos Polster and contributors
+## O2 library by Akos Polster and contributors
[The origin of this fork.](https://github.com/pipacs/o2)
@@ -26,17 +26,16 @@
> OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# SimpleCrypt by Andre Somers
+## SimpleCrypt by Andre Somers
Cryptographic methods for Qt.
> Copyright (c) 2011, Andre Somers
> All rights reserved.
->
+>
> Redistribution and use in source and binary forms, with or without
> modification, are permitted provided that the following conditions are met:
->
+>
> * Redistributions of source code must retain the above copyright
> notice, this list of conditions and the following disclaimer.
> * Redistributions in binary form must reproduce the above copyright
@@ -45,7 +44,7 @@ Cryptographic methods for Qt.
> * Neither the name of the Rathenau Instituut, Andre Somers nor the
> names of its contributors may be used to endorse or promote products
> derived from this software without specific prior written permission.
->
+>
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
> ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -57,54 +56,53 @@ Cryptographic methods for Qt.
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Mandeep Sandhu <mandeepsandhu.chd@gmail.com>
+## Mandeep Sandhu <mandeepsandhu.chd@gmail.com>
Configurable settings storage, Twitter XAuth specialization, new demos, cleanups.
> "Hi Akos,
->
+>
> I'm writing this mail to confirm that my contributions to the O2 library, available here https://github.com/pipacs/o2, can be freely distributed according to the project's license (as shown in the LICENSE file).
->
+>
> Regards,
> -mandeep"
-# Sergey Gavrushkin <https://github.com/ncux>
+## Sergey Gavrushkin <https://github.com/ncux>
FreshBooks specialization
-# Theofilos Intzoglou <https://github.com/parapente>
+## Theofilos Intzoglou <https://github.com/parapente>
Hubic specialization
-# Dimitar
+## Dimitar
SurveyMonkey specialization
-# David Brooks <https://github.com/dbrnz>
+## David Brooks <https://github.com/dbrnz>
CMake related fixes and improvements.
-# Lukas Vogel <https://github.com/lukedirtwalker>
+## Lukas Vogel <https://github.com/lukedirtwalker>
Spotify support
-# Alan Garny <https://github.com/agarny>
+## Alan Garny <https://github.com/agarny>
Windows DLL build support
-# MartinMikita <https://github.com/MartinMikita>
+## MartinMikita <https://github.com/MartinMikita>
Bug fixes
-# Larry Shaffer <https://github.com/dakcarto>
+## Larry Shaffer <https://github.com/dakcarto>
Versioning, shared lib, install target and header support
-# Gilmanov Ildar <https://github.com/gilmanov-ildar>
+## Gilmanov Ildar <https://github.com/gilmanov-ildar>
Bug fixes, support for ```qml``` module
-# Fabian Vogt <https://github.com/Vogtinator>
+## Fabian Vogt <https://github.com/Vogtinator>
Bug fixes, support for building without Qt keywords enabled
-
diff --git a/libraries/murmur2/src/MurmurHash2.cpp b/libraries/murmur2/src/MurmurHash2.cpp
index 3e52e6d1..b625efb1 100644
--- a/libraries/murmur2/src/MurmurHash2.cpp
+++ b/libraries/murmur2/src/MurmurHash2.cpp
@@ -1,86 +1,110 @@
//-----------------------------------------------------------------------------
// MurmurHash2 was written by Austin Appleby, and is placed in the public
// domain. The author hereby disclaims copyright to this source code.
-
-// Note - This code makes a few assumptions about how your machine behaves -
-
-// 1. We can read a 4-byte value from any address without crashing
-// 2. sizeof(int) == 4
-
-// And it has a few limitations -
-
-// 1. It will not work incrementally.
-// 2. It will not produce the same results on little-endian and big-endian
-// machines.
+//
+// This was modified as to possibilitate it's usage incrementally.
+// Those modifications are also placed in the public domain, and the author of
+// such modifications hereby disclaims copyright to this source code.
#include "MurmurHash2.h"
//-----------------------------------------------------------------------------
-// Platform-specific functions and macros
-
-// Microsoft Visual Studio
-
-#if defined(_MSC_VER)
-
-#define BIG_CONSTANT(x) (x)
-// Other compilers
+// 'm' and 'r' are mixing constants generated offline.
+// They're not really 'magic', they just happen to work well.
+const uint32_t m = 0x5bd1e995;
+const int r = 24;
-#else // defined(_MSC_VER)
-
-#define BIG_CONSTANT(x) (x##LLU)
-
-#endif // !defined(_MSC_VER)
-
-//-----------------------------------------------------------------------------
-
-uint64_t MurmurHash2 ( const void* key, int len, uint32_t seed )
+uint32_t MurmurHash2(std::ifstream&& file_stream, std::size_t buffer_size, std::function<bool(char)> filter_out)
{
- // 'm' and 'r' are mixing constants generated offline.
- // They're not really 'magic', they just happen to work well.
-
- const uint32_t m = 0x5bd1e995;
- const int r = 24;
-
- // Initialize the hash to a 'random' value
-
- uint32_t h = seed ^ len;
-
- // Mix 4 bytes at a time into the hash
- const auto* data = (const unsigned char*) key;
- while(len >= 4)
- {
- uint32_t k = *(uint32_t*)data;
-
- k *= m;
- k ^= k >> r;
- k *= m;
-
- h *= m;
- h ^= k;
-
- data += 4*sizeof(char);
- len -= 4;
- }
-
- // Handle the last few bytes of the input array
-
- switch(len)
- {
- case 3: h ^= data[2] << 16;
- case 2: h ^= data[1] << 8;
- case 1: h ^= data[0];
- h *= m;
- };
-
- // Do a few final mixes of the hash to ensure the last few
- // bytes are well-incorporated.
-
- h ^= h >> 13;
- h *= m;
- h ^= h >> 15;
-
- return h;
-}
+ auto* buffer = new char[buffer_size];
+ char data[4];
+
+ int read = 0;
+ uint32_t size = 0;
+
+ // We need the size without the filtered out characters before actually calculating the hash,
+ // to setup the initial value for the hash.
+ do {
+ file_stream.read(buffer, buffer_size);
+ read = file_stream.gcount();
+ for (int i = 0; i < read; i++) {
+ if (!filter_out(buffer[i]))
+ size += 1;
+ }
+ } while (!file_stream.eof());
+
+ file_stream.clear();
+ file_stream.seekg(0, file_stream.beg);
+
+ int index = 0;
+
+ // This forces a seed of 1.
+ IncrementalHashInfo info{ (uint32_t)1 ^ size, (uint32_t)size };
+ do {
+ file_stream.read(buffer, buffer_size);
+ read = file_stream.gcount();
+ for (int i = 0; i < read; i++) {
+ char c = buffer[i];
+
+ if (filter_out(c))
+ continue;
+
+ data[index] = c;
+ index = (index + 1) % 4;
+
+ // Mix 4 bytes at a time into the hash
+ if (index == 0)
+ FourBytes_MurmurHash2((unsigned char*)&data, info);
+ }
+ } while (!file_stream.eof());
+
+ // Do one last bit shuffle in the hash
+ FourBytes_MurmurHash2((unsigned char*)&data, info);
+
+ delete[] buffer;
+
+ file_stream.close();
+ return info.h;
+}
+
+void FourBytes_MurmurHash2(const unsigned char* data, IncrementalHashInfo& prev)
+{
+ if (prev.len >= 4) {
+ // Not the final mix
+ uint32_t k = *(uint32_t*)data;
+
+ k *= m;
+ k ^= k >> r;
+ k *= m;
+
+ prev.h *= m;
+ prev.h ^= k;
+
+ prev.len -= 4;
+ } else {
+ // The final mix
+
+ // Handle the last few bytes of the input array
+ switch (prev.len) {
+ case 3:
+ prev.h ^= data[2] << 16;
+ case 2:
+ prev.h ^= data[1] << 8;
+ case 1:
+ prev.h ^= data[0];
+ prev.h *= m;
+ };
+
+ // Do a few final mixes of the hash to ensure the last few
+ // bytes are well-incorporated.
+
+ prev.h ^= prev.h >> 13;
+ prev.h *= m;
+ prev.h ^= prev.h >> 15;
+
+ prev.len = 0;
+ }
+}
//-----------------------------------------------------------------------------
diff --git a/libraries/murmur2/src/MurmurHash2.h b/libraries/murmur2/src/MurmurHash2.h
index c7b83bca..dc2c9681 100644
--- a/libraries/murmur2/src/MurmurHash2.h
+++ b/libraries/murmur2/src/MurmurHash2.h
@@ -1,30 +1,33 @@
//-----------------------------------------------------------------------------
-// MurmurHash2 was written by Austin Appleby, and is placed in the public
-// domain. The author hereby disclaims copyright to this source code.
+// The original MurmurHash2 was written by Austin Appleby, and is placed in the
+// public domain. The author hereby disclaims copyright to this source code.
+//
+// This was modified as to possibilitate it's usage incrementally.
+// Those modifications are also placed in the public domain, and the author of
+// such modifications hereby disclaims copyright to this source code.
#pragma once
-//-----------------------------------------------------------------------------
-// Platform-specific functions and macros
-
-// Microsoft Visual Studio
-
-#if defined(_MSC_VER) && (_MSC_VER < 1600)
+#include <cstdint>
+#include <fstream>
-typedef unsigned char uint8_t;
-typedef unsigned int uint32_t;
-typedef unsigned __int64 uint64_t;
+#include <functional>
-// Other compilers
-
-#else // defined(_MSC_VER)
+//-----------------------------------------------------------------------------
-#include <stdint.h>
+#define KiB 1024
+#define MiB 1024*KiB
-#endif // !defined(_MSC_VER)
+uint32_t MurmurHash2(
+ std::ifstream&& file_stream,
+ std::size_t buffer_size = 4*MiB,
+ std::function<bool(char)> filter_out = [](char) { return false; });
-//-----------------------------------------------------------------------------
+struct IncrementalHashInfo {
+ uint32_t h;
+ uint32_t len;
+};
-uint64_t MurmurHash2 ( const void* key, int len, uint32_t seed = 1 );
+void FourBytes_MurmurHash2(const unsigned char* data, IncrementalHashInfo& prev);
//-----------------------------------------------------------------------------
diff --git a/libraries/tomlc99/README.md b/libraries/tomlc99/README.md
index 6715b5be..e5fe9480 100644
--- a/libraries/tomlc99/README.md
+++ b/libraries/tomlc99/README.md
@@ -10,7 +10,6 @@ If you are looking for a C++ library, you might try this wrapper: [https://githu
[iarna/toml-spec-tests](https://github.com/iarna/toml-spec-tests).
* Provides very simple and intuitive interface.
-
## Usage
Please see the `toml.h` file for details. What follows is a simple example that
@@ -18,8 +17,8 @@ parses this config file:
```toml
[server]
- host = "www.example.com"
- port = [ 8080, 8181, 8282 ]
+ host = "www.example.com"
+ port = [ 8080, 8181, 8282 ]
```
The steps for getting values from our file is usually :
@@ -96,13 +95,14 @@ int main()
}
```
-#### Accessing Table Content
+### Accessing Table Content
TOML tables are dictionaries where lookups are done using string keys. In
general, all access functions on tables are named `toml_*_in(...)`.
In the normal case, you know the key and its content type, and retrievals can be done
using one of these functions:
+
```c
toml_string_in(tab, key);
toml_bool_in(tab, key);
@@ -114,6 +114,7 @@ toml_array_in(tab, key);
```
You can also interrogate the keys in a table using an integer index:
+
```c
toml_table_t* tab = toml_parse_file(...);
for (int i = 0; ; i++) {
@@ -123,16 +124,18 @@ for (int i = 0; ; i++) {
}
```
-#### Accessing Array Content
+### Accessing Array Content
TOML arrays can be deref-ed using integer indices. In general, all access methods on arrays are named `toml_*_at()`.
To obtain the size of an array:
+
```c
int size = toml_array_nelem(arr);
```
To obtain the content of an array, use a valid index and call one of these functions:
+
```c
toml_string_at(arr, idx);
toml_bool_at(arr, idx);
@@ -143,7 +146,7 @@ toml_table_at(arr, idx);
toml_array_at(arr, idx);
```
-#### toml_datum_t
+### toml_datum_t
Some `toml_*_at` and `toml_*_in` functions return a toml_datum_t
structure. The `ok` flag in the structure indicates if the function
@@ -151,15 +154,16 @@ call was successful. If so, you may proceed to read the value
corresponding to the type of the content.
For example:
-```
+
+```c
toml_datum_t host = toml_string_in(tab, "host");
if (host.ok) {
- printf("host: %s\n", host.u.s);
- free(host.u.s); /* FREE applies to string and timestamp types only */
+ printf("host: %s\n", host.u.s);
+ free(host.u.s); /* FREE applies to string and timestamp types only */
}
```
-** IMPORTANT: if the accessed value is a string or a timestamp, you must call `free(datum.u.s)` or `free(datum.u.ts)` respectively after usage. **
+**IMPORTANT: if the accessed value is a string or a timestamp, you must call `free(datum.u.s)` or `free(datum.u.ts)` respectively after usage.**
## Building and installing
@@ -183,7 +187,6 @@ To test against the standard test set provided by BurntSushi/toml-test:
% bash run.sh # this will run the test suite
```
-
To test against the standard test set provided by iarna/toml:
```sh