unlimited-storage

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit d80d1b79e1f7c463df6669ec73fbeaef640c9300
parent c32dd518384f2446acbd5a84981c5879f7f02f27
Author: Andrew Laack <andrew@laack.co>
Date:   Wed, 16 Jul 2025 22:05:18 -0500

Created encoder/decoder logic. I now need to update the header logic because we currently don't know the number of characters we will write at the start.... should think about how to resolve this issue.

Diffstat:
MMakefile | 6++++--
Msrc/chunk.cpp | 4++--
Asrc/decode.cpp | 20++++++++++++++++++++
Msrc/encode.cpp | 2--
4 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,8 +1,10 @@ debug: - g++ -Wall -oO src/chunk.cpp src/encode.cpp -o build/debug.out -DDEBUG + g++ -Wall -oO src/chunk.cpp src/encode.cpp -o build/debugEncode.out -DDEBUG + g++ -Wall -oO src/chunk.cpp src/decode.cpp -o build/debugDecode.out -DDEBUG release: - g++ -Wall -O2 src/chunk.cpp src/encode.cpp -o build/release.out -DRELEASE + g++ -Wall -O2 src/chunk.cpp src/encode.cpp -o build/encode.out -DRELEASE + g++ -Wall -O2 src/chunk.cpp src/decode.cpp -o build/decode.out -DRELEASE clean: rm -rf build/* diff --git a/src/chunk.cpp b/src/chunk.cpp @@ -220,8 +220,8 @@ void Chunk::writeImage(std::string filename, uint chunkNumber, std::string origi // todo: // create function for this. - for (std::size_t i = 0; i < filename.size(); ++i) { - filenameEncoded += std::bitset<8>(filename.c_str()[i]).to_string(); + for (std::size_t i = 0; i < originalFilename.size(); ++i) { + filenameEncoded += std::bitset<8>(originalFilename.c_str()[i]).to_string(); } LOG(filenameEncoded) diff --git a/src/decode.cpp b/src/decode.cpp @@ -0,0 +1,20 @@ +#include "../include/chunk.h" +#include "iostream" +#include "../include/debug.h" + + +int main(int argc, char* argv[]) { + + if (argc < 2) { + std::cout << "usage: [filename]" << std::endl; + return 10; + } + + std::string filename = argv[1]; + + + Chunk chunk = Chunk(filename); + chunk.writeChunk(); + + return 0; +} diff --git a/src/encode.cpp b/src/encode.cpp @@ -1,5 +1,3 @@ -#include <vector> -#include <fstream> #include "../include/chunk.h" #include "iostream" #include "../include/debug.h"