Created utils file
This commit is contained in:
parent
0ad4331a77
commit
987a708303
@ -3,4 +3,4 @@ project(caff_previewer C)
|
|||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
|
||||||
add_executable(caff_previewer src/main.c src/magic_memory.c src/magic_memory.h src/ciff_tools.h src/ciff_tools.c src/libtarga.c src/libtarga.h src/pixeldata_utils.c src/pixeldata_utils.h)
|
add_executable(caff_previewer src/main.c src/magic_memory.c src/magic_memory.h src/ciff_tools.h src/ciff_tools.c src/libtarga.c src/libtarga.h src/pixeldata_utils.c src/pixeldata_utils.h src/utils.c src/utils.h)
|
@ -3,17 +3,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "ciff_tools.h"
|
#include "ciff_tools.h"
|
||||||
#include "stdbool.h"
|
#include "utils.h"
|
||||||
|
|
||||||
uint8_t contains(const uint8_t* data, uint64_t data_len, uint8_t what) {
|
|
||||||
for (uint64_t i = 0; i < data_len; i++) {
|
|
||||||
if (data[i] == what) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t parse_ciff_from_mem(const uint8_t* data, uint64_t data_len, uint64_t* width, uint64_t* height, uint64_t* pixel_data_starts) {
|
uint8_t parse_ciff_from_mem(const uint8_t* data, uint64_t data_len, uint64_t* width, uint64_t* height, uint64_t* pixel_data_starts) {
|
||||||
/**
|
/**
|
||||||
|
14
src/utils.c
Normal file
14
src/utils.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//
|
||||||
|
// Created by marcsello on 05/11/2020.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
bool contains(const uint8_t* data, uint64_t data_len, uint8_t what) {
|
||||||
|
for (uint64_t i = 0; i < data_len; i++) {
|
||||||
|
if (data[i] == what) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
14
src/utils.h
Normal file
14
src/utils.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//
|
||||||
|
// Created by marcsello on 05/11/2020.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CAFF_PREVIEWER_UTILS_H
|
||||||
|
#define CAFF_PREVIEWER_UTILS_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
bool contains(const uint8_t *data, uint64_t data_len, uint8_t what);
|
||||||
|
|
||||||
|
|
||||||
|
#endif //CAFF_PREVIEWER_UTILS_H
|
Loading…
Reference in New Issue
Block a user