From 4bdfb08b95ede33d41ad4c722f039b957c0dc612 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Thu, 25 Nov 2021 15:26:14 +0100
Subject: Fix typos found by codespell

---
 Makefile.inc                       | 2 +-
 build/cmake/CMakeLists.txt         | 2 +-
 examples/compress_functions.c      | 2 +-
 examples/dictionaryRandomAccess.md | 2 +-
 examples/frameCompress.c           | 2 +-
 lib/Makefile                       | 2 +-
 lib/lz4frame.c                     | 2 +-
 lib/lz4frame.h                     | 2 +-
 lib/lz4hc.c                        | 4 ++--
 lib/lz4hc.h                        | 2 +-
 ossfuzz/decompress_fuzzer.c        | 2 +-
 ossfuzz/fuzz_helpers.h             | 2 +-
 programs/lz4io.c                   | 8 ++++----
 tests/README.md                    | 2 +-
 tests/frametest.c                  | 2 +-
 15 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/Makefile.inc b/Makefile.inc
index 89bb151..e78298c 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -85,7 +85,7 @@ else
 POSIX_ENV = No
 endif
 
-# Avoid symlinks when targetting Windows or building on a Windows host
+# Avoid symlinks when targeting Windows or building on a Windows host
 ifeq ($(WINBASED),yes)
 LN_SF = cp -p
 else
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
index dacc213..0c15ab5 100644
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -13,7 +13,7 @@
 set(LZ4_TOP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
 
 option(LZ4_BUILD_CLI "Build lz4 program" ON)
-option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c progam with legacy argument support" ON)
+option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c program with legacy argument support" ON)
 
 # Parse version information
 file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" LZ4_VERSION_MAJOR REGEX "^#define LZ4_VERSION_MAJOR +([0-9]+) +.*$")
diff --git a/examples/compress_functions.c b/examples/compress_functions.c
index 7fd6775..e27c612 100644
--- a/examples/compress_functions.c
+++ b/examples/compress_functions.c
@@ -35,7 +35,7 @@
  *
  *               LZ4_decompress_safe
  *                 This is the recommended function for decompressing data.  It is considered safe because the caller specifies
- *                 both the size of the compresssed buffer to read as well as the maximum size of the output (decompressed) buffer
+ *                 both the size of the compressed buffer to read as well as the maximum size of the output (decompressed) buffer
  *                 instead of just the latter.
  *               LZ4_decompress_fast
  *                 Again, despite its name it's not a "fast" version of decompression.  It simply frees the caller of sending the
diff --git a/examples/dictionaryRandomAccess.md b/examples/dictionaryRandomAccess.md
index 53d825d..fb1fade 100644
--- a/examples/dictionaryRandomAccess.md
+++ b/examples/dictionaryRandomAccess.md
@@ -7,7 +7,7 @@ Please note that the output file is not compatible with lz4frame and is platform
 
 ## What's the point of this example ?
 
- - Dictionary based compression for homogenous files.
+ - Dictionary based compression for homogeneous files.
  - Random access to compressed blocks.
 
 
diff --git a/examples/frameCompress.c b/examples/frameCompress.c
index 4a88b50..9eaa4da 100644
--- a/examples/frameCompress.c
+++ b/examples/frameCompress.c
@@ -139,7 +139,7 @@ compress_file(FILE* f_in, FILE* f_out)
                                         src, IN_CHUNK_SIZE,
                                         outbuff, outbufCapacity);
     } else {
-        printf("error : ressource allocation failed \n");
+        printf("error : resource allocation failed \n");
     }
 
     LZ4F_freeCompressionContext(ctx);   /* supports free on NULL */
diff --git a/lib/Makefile b/lib/Makefile
index 5e4c711..06503cb 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -187,7 +187,7 @@ install: lib liblz4.pc
 	$(INSTALL_DATA) lz4frame_static.h $(DESTDIR)$(includedir)/lz4frame_static.h
   endif
   ifeq ($(BUILD_SHARED),yes)
-# Traditionnally, one installs the DLLs in the bin directory as programs
+# Traditionally, one installs the DLLs in the bin directory as programs
 # search them first in their directory. This allows to not pollute system
 # directories (like c:/windows/system32), nor modify the PATH variable.
     ifeq ($(WINBASED),yes)
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index 9069717..73f21fc 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -143,7 +143,7 @@ static int g_debuglog_enable = 1;
 #endif
 
 
-/* unoptimized version; solves endianess & alignment issues */
+/* unoptimized version; solves endianness & alignment issues */
 static U32 LZ4F_readLE32 (const void* src)
 {
     const BYTE* const srcPtr = (const BYTE*)src;
diff --git a/lib/lz4frame.h b/lib/lz4frame.h
index 9ac849f..05b8d1d 100644
--- a/lib/lz4frame.h
+++ b/lib/lz4frame.h
@@ -257,7 +257,7 @@ LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctx);
 
 /*----    Compression    ----*/
 
-#define LZ4F_HEADER_SIZE_MIN  7   /* LZ4 Frame header size can vary, depending on selected paramaters */
+#define LZ4F_HEADER_SIZE_MIN  7   /* LZ4 Frame header size can vary, depending on selected parameters */
 #define LZ4F_HEADER_SIZE_MAX 19
 
 /* Size in bytes of a block header in little-endian format. Highest bit indicates if block data is uncompressed */
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 91fd2b0..e71ce94 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -201,7 +201,7 @@ LZ4HC_countPattern(const BYTE* ip, const BYTE* const iEnd, U32 const pattern32)
 
 /* LZ4HC_reverseCountPattern() :
  * pattern must be a sample of repetitive pattern of length 1, 2 or 4 (but not 3!)
- * read using natural platform endianess */
+ * read using natural platform endianness */
 static unsigned
 LZ4HC_reverseCountPattern(const BYTE* ip, const BYTE* const iLow, U32 pattern)
 {
@@ -211,7 +211,7 @@ LZ4HC_reverseCountPattern(const BYTE* ip, const BYTE* const iLow, U32 pattern)
         if (LZ4_read32(ip-4) != pattern) break;
         ip -= 4;
     }
-    {   const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianess */
+    {   const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianness */
         while (likely(ip>iLow)) {
             if (ip[-1] != *bytePtr) break;
             ip--; bytePtr--;
diff --git a/lib/lz4hc.h b/lib/lz4hc.h
index b423990..f4afc9b 100644
--- a/lib/lz4hc.h
+++ b/lib/lz4hc.h
@@ -305,7 +305,7 @@ LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionL
  * They should not be linked from DLL,
  * as there is no guarantee of API stability yet.
  * Prototypes will be promoted to "stable" status
- * after successfull usage in real-life scenarios.
+ * after successful usage in real-life scenarios.
  ***************************************************/
 #ifdef LZ4_HC_STATIC_LINKING_ONLY   /* protection macro */
 #ifndef LZ4_HC_SLO_098092834
diff --git a/ossfuzz/decompress_fuzzer.c b/ossfuzz/decompress_fuzzer.c
index 6f48e30..a9a197c 100644
--- a/ossfuzz/decompress_fuzzer.c
+++ b/ossfuzz/decompress_fuzzer.c
@@ -39,7 +39,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
     /* No dictionary. */
     LZ4_decompress_safe_usingDict((char const*)data, dst, size,
                                   dstCapacity, NULL, 0);
-    /* Small external dictonary. */
+    /* Small external dictionary. */
     LZ4_decompress_safe_usingDict((char const*)data, dst, size,
                                   dstCapacity, smallDict, smallDictSize);
     /* Large external dictionary. */
diff --git a/ossfuzz/fuzz_helpers.h b/ossfuzz/fuzz_helpers.h
index c4a8645..aae359e 100644
--- a/ossfuzz/fuzz_helpers.h
+++ b/ossfuzz/fuzz_helpers.h
@@ -81,7 +81,7 @@ FUZZ_STATIC uint32_t FUZZ_rand(uint32_t *state) {
     return rand32 >> 5;
 }
 
-/* Returns a random numer in the range [min, max]. */
+/* Returns a random number in the range [min, max]. */
 FUZZ_STATIC uint32_t FUZZ_rand32(uint32_t *state, uint32_t min, uint32_t max) {
     uint32_t random = FUZZ_rand(state);
     return min + (random % (max - min + 1));
diff --git a/programs/lz4io.c b/programs/lz4io.c
index 2d69d6c..c01374b 100644
--- a/programs/lz4io.c
+++ b/programs/lz4io.c
@@ -377,7 +377,7 @@ static FILE* LZ4IO_openDstFile(const char* dstFileName, const LZ4IO_prefs_t* con
 *   Legacy Compression
 ***************************************/
 
-/* unoptimized version; solves endianess & alignment issues */
+/* unoptimized version; solves endianness & alignment issues */
 static void LZ4IO_writeLE32 (void* p, unsigned value32)
 {
     unsigned char* const dstPtr = (unsigned char*)p;
@@ -1387,7 +1387,7 @@ static const char * LZ4IO_frameTypeNames[] = {"LZ4Frame", "LegacyFrame", "Skippa
 /* Read block headers and skip block data
    Return total blocks size for this frame including block headers,
    block checksums and content checksums.
-   returns 0 in case it can't succesfully skip block data.
+   returns 0 in case it can't successfully skip block data.
    Assumes SEEK_CUR after frame header.
  */
 static unsigned long long
@@ -1427,7 +1427,7 @@ LZ4IO_skipBlocksData(FILE* finput,
 /* For legacy frames only.
    Read block headers and skip block data.
    Return total blocks size for this frame including block headers.
-   or 0 in case it can't succesfully skip block data.
+   or 0 in case it can't successfully skip block data.
    This works as long as legacy block header size = magic number size.
    Assumes SEEK_CUR after frame header.
  */
@@ -1445,7 +1445,7 @@ static unsigned long long LZ4IO_skipLegacyBlocksData(FILE* finput)
             if ( nextCBlockSize == LEGACY_MAGICNUMBER ||
                     nextCBlockSize == LZ4IO_MAGICNUMBER ||
                     LZ4IO_isSkippableMagicNumber(nextCBlockSize)) {
-                /* Rewind back. we want cursor at the begining of next frame.*/
+                /* Rewind back. we want cursor at the beginning of next frame.*/
                 if (fseek(finput, -LZIO_LEGACY_BLOCK_HEADER_SIZE, SEEK_CUR) != 0) {
                     return 0;
                 }
diff --git a/tests/README.md b/tests/README.md
index 37d7d72..6b8302c 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -13,7 +13,7 @@ This directory contains the following programs and scripts:
 #### `test-lz4-versions.py` - script for testing lz4 interoperability between versions
 
 This script creates `versionsTest` directory to which lz4 repository is cloned.
-Then all taged (released) versions of lz4 are compiled.
+Then all tagged (released) versions of lz4 are compiled.
 In the following step interoperability between lz4 versions is checked.
 
 
diff --git a/tests/frametest.c b/tests/frametest.c
index b3b4df8..e0fff0e 100644
--- a/tests/frametest.c
+++ b/tests/frametest.c
@@ -51,7 +51,7 @@
 #include "xxhash.h"     /* XXH64 */
 
 
-/* unoptimized version; solves endianess & alignment issues */
+/* unoptimized version; solves endianness & alignment issues */
 static void FUZ_writeLE32 (void* dstVoidPtr, U32 value32)
 {
     BYTE* dstPtr = (BYTE*)dstVoidPtr;
-- 
cgit v0.12