<commit_before>#include "Log.h"
#include "Platform.h"
#include "MemoryBuffer.h"

#define STB_IMAGE_IMPLEMENTATION
#define STBI_ONLY_JPEG
#define STBI_ONLY_PNG

void* _malloc(size_t size);
void* _realloc(void *ptr, size_t size);
void _free(void *ptr);

#define STBI_MALLOC(sz)    _malloc(sz)
#define STBI_REALLOC(p,sz) _realloc(p,sz)
#define STBI_FREE(p)       _free(p)

#include "stb_image.h"

using namespace std;

void* _malloc(size_t size)
{
  LOGI << "malloc " << size << endl;
  return malloc(size);
}

void* _realloc(void *ptr, size_t size)
{
  LOGI << "realloc " << size << endl;
  return realloc(ptr, size);
}

void _free(void *ptr)
{
  LOGI << "free" << endl;
  free(ptr);
}

int main(int argc, const char *argv[])
{
  for (int i = 0; i < argc; i++)
  {
    LOGI << "{" << argv[i] << "}" << endl;
  }

  // ---

  fs::path path1 = "sub/credits.txt";
  fs::path path2 = "2008.547.1crop_4.jpg";

  if (chr::hasMemoryResources())
  {
    auto memoryBuffer1 = chr::getResourceBuffer(path1);

    if (memoryBuffer1)
    {
      LOGI << "[" << string(reinterpret_cast<const char*>(memoryBuffer1->data()), memoryBuffer1->size()) << "]" << endl;
    }
    else
    {
      LOGE << "ERROR WITH" << path1 << endl;
    }

    // ---

    auto memoryBuffer2 = chr::getResourceBuffer(path2);

    if (memoryBuffer2)
    {
      int x, y, comp;
      stbi_uc *data = stbi_load_from_memory(reinterpret_cast<const stbi_uc*>(memoryBuffer2->data()), memoryBuffer2->size(), &x, &y, &comp, 0);

      if (data)
      {
        LOGI << x << "x" << y << " (" << comp << ")" << endl;
        stbi_image_free(data);
      }
      else
      {
        LOGE << "stbi ERROR WITH " << path2 << endl;
      }
    }
    else
    {
      LOGE << "ERROR WITH " << path2 << endl;
    }<commit_msg>SIMPLIFICATION...<commit_after>#include "Log.h"
#include "Platform.h"
#include "MemoryBuffer.h"

#define STB_IMAGE_IMPLEMENTATION
#define STBI_ONLY_JPEG
#define STBI_ONLY_PNG

#include "stb_image.h"

using namespace std;

int main(int argc, const char *argv[])
{
  for (int i = 0; i < argc; i++)
  {
    LOGI << "{" << argv[i] << "}" << endl;
  }

  // ---

  fs::path path1 = "sub/credits.txt";
  fs::path path2 = "2008.547.1crop_4.jpg";

  if (chr::hasMemoryResources())
  {
    auto memoryBuffer1 = chr::getResourceBuffer(path1);

    if (memoryBuffer1)
    {
      LOGI << "[" << string(reinterpret_cast<const char*>(memoryBuffer1->data()), memoryBuffer1->size()) << "]" << endl; // TODO: TRY WITH string_view
    }
    else
    {
      LOGE << "ERROR WITH" << path1 << endl;
    }

    // ---

    auto memoryBuffer2 = chr::getResourceBuffer(path2);

    if (memoryBuffer2)
    {
      int x, y, comp;
      stbi_uc *data = stbi_load_from_memory(reinterpret_cast<const stbi_uc*>(memoryBuffer2->data()), memoryBuffer2->size(), &x, &y, &comp, 0);

      if (data)
      {
        LOGI << x << "x" << y << " (" << comp << ")" << endl;
        stbi_image_free(data);
      }
      else
      {
        LOGE << "stbi ERROR WITH " << path2 << endl;
      }
    }
    else
    {
      LOGE << "ERROR WITH " << path2 << endl;
    }
{'fraction_non_alphanumeric': 0.1796194775878749, 'fraction_numerical': 0.01676878426314092, 'mean_word_length': 2.7691373025516404, 'pattern_counts': {'":': 0, '<': 121, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4538801', 'n_tokens_mistral': 1194, 'n_tokens_neox': 1160, 'n_words': 246}