<commit_before>/*
Copyright 2011 Google Inc. All Rights Reserved.
Copyright 2016 Mr_KrzYch00. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Author: <EMAIL> (<NAME>)
Author: <EMAIL> (<NAME>)
*/

/*
Zopfli compressor program. It can output gzip-, zlib- or deflate-compatible
data. By default it creates a .gz file. This tool can only compress, not
decompress. Decompression can be done by any standard gzip, zlib or deflate
decompressor.
*/

#define _XOPEN_SOURCE 500
#define _FILE_OFFSET_BITS 64

#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <dirent.h>
#include <sys/stat.h>
#include <string.h>
#include <time.h>
/* Windows priority setter & stdout fix. */
#if _WIN32
#include <fcntl.h>
#include <windows.h>
static void IdlePriority() {
 if(SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS)==0) {
  fprintf(stderr,"ERROR! Failed setting priority!\n\n");
 } else {
  fprintf(stderr,"INFO: Idle priority successfully set.\n\n");
 }
}
#else
#include <sys/resource.h>
static void IdlePriority() {
 if(setpriority(PRIO_PROCESS, 0, 19)==-1) {
  fprintf(stderr,"ERROR! Failed setting priority!\n\n");
 } else {
  fprintf(stderr,"INFO: Idle priority successfully set.\n\n");
 }
}
#endif

#include "zopfli_bin.h"
#include "util.h"
#include "inthandler.h"
#include "deflate.h"

#include "adler.h"
#include "crc32.h"
#include "blocksplitter.h"

static const char tempfileext[8] = { '.' , 'z' , 'o' , 'p' , 'f' , 'l' , 'i', 0 };

void intHandler(int exit_code);

static void InitCDIR(ZipCDIR *zipcdir) {
  zipcdir->data = NULL;
  zipcdir->size = 0;
  zipcdir->offset = 0;
  zipcdir->fileid = 0;
  zipcdir->fullsize = 0;
}

static void CleanCDIR(ZipCDIR *zipcdir) {
  free(zipcdir->data);
}

static void ZopfliInitBinOptions(ZopfliBinOptions* options) {
  options->usescandir = 0;
  options->blocksize = 0;
  options->numblocks = 0;
  options->custblocksplit = NULL;
  options->dumpsplitsfile = NULL;
  options->legacy = 1;
}

static size_t ceilz(double num) {
    size_t inum = (size_t)num;
    if (num == (double)inum) {
        return inum;
    }
    return inum + 1;
}

static int exists(const char* file) {
  FILE* ofile;
  if((ofile = fopen(file, "r")) != NULL) {
    fclose(ofile);
    return 1;
  }
  return 0;
}

/*
Similar to original Zopfli but with support for larger files (especially
for 64 bit compilations), offset reading, applying ZOPFLI_MASTER_BLOCK_SIZE limiter.
*/<commit_msg>Fix one uninitialized ZopfliBinOptions struct val<commit_after>/*
Copyright 2011 Google Inc. All Rights Reserved.
Copyright 2016 Mr_KrzYch00. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Author: <EMAIL> (<NAME>)
Author: <EMAIL> (<NAME>)
*/

/*
Zopfli compressor program. It can output gzip-, zlib- or deflate-compatible
data. By default it creates a .gz file. This tool can only compress, not
decompress. Decompression can be done by any standard gzip, zlib or deflate
decompressor.
*/

#define _XOPEN_SOURCE 500
#define _FILE_OFFSET_BITS 64

#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <dirent.h>
#include <sys/stat.h>
#include <string.h>
#include <time.h>
/* Windows priority setter & stdout fix. */
#if _WIN32
#include <fcntl.h>
#include <windows.h>
static void IdlePriority() {
 if(SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS)==0) {
  fprintf(stderr,"ERROR! Failed setting priority!\n\n");
 } else {
  fprintf(stderr,"INFO: Idle priority successfully set.\n\n");
 }
}
#else
#include <sys/resource.h>
static void IdlePriority() {
 if(setpriority(PRIO_PROCESS, 0, 19)==-1) {
  fprintf(stderr,"ERROR! Failed setting priority!\n\n");
 } else {
  fprintf(stderr,"INFO: Idle priority successfully set.\n\n");
 }
}
#endif

#include "zopfli_bin.h"
#include "util.h"
#include "inthandler.h"
#include "deflate.h"

#include "adler.h"
#include "crc32.h"
#include "blocksplitter.h"

static const char tempfileext[8] = { '.' , 'z' , 'o' , 'p' , 'f' , 'l' , 'i', 0 };

void intHandler(int exit_code);

static void InitCDIR(ZipCDIR *zipcdir) {
  zipcdir->data = NULL;
  zipcdir->size = 0;
  zipcdir->offset = 0;
  zipcdir->fileid = 0;
  zipcdir->fullsize = 0;
}

static void CleanCDIR(ZipCDIR *zipcdir) {
  free(zipcdir->data);
}

static void ZopfliInitBinOptions(ZopfliBinOptions* options) {
  options->usescandir = 0;
  options->blocksize = 0;
  options->numblocks = 0;
  options->custblocksplit = NULL;
  options->dumpsplitsfile = NULL;
  options->legacy = 1;
  options->additionalautosplits = 0;
}

static size_t ceilz(double num) {
    size_t inum = (size_t)num;
    if (num == (double)inum) {
        return inum;
    }
    return inum + 1;
}

static int exists(const char* file) {
  FILE* ofile;
  if((ofile = fopen(file, "r")) != NULL) {
    fclose(ofile);
    return 1;
  }
  return 0;
}

/*
Similar to original Zopfli but with support for larger files (especially
for 64 bit compilations), offset reading, applying ZOPFLI_MASTER_BLOCK_SIZE limiter.
*/
{'fraction_non_alphanumeric': 0.12569879722175165, 'fraction_numerical': 0.014738268676943927, 'mean_word_length': 4.299820466786356, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 56, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6476581', 'n_tokens_mistral': 2132, 'n_tokens_neox': 2029, 'n_words': 637}