Cleaning in the make process
This commit is contained in:
parent
7e72b94eb8
commit
e5ff011958
|
@ -1,4 +1,3 @@
|
|||
bin_PROGRAMS = caesiumclt
|
||||
caesiumclt_SOURCES = main.c jpeg.c compresshelper.c utils.c png.c lodepng.c
|
||||
caesiumclt_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64 -std=c99
|
||||
caesiumclt_LDADD = -ljpeg -lturbojpeg -lm -lzopflipng
|
||||
caesiumclt_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64 -std=c99
|
|
@ -103,7 +103,7 @@ am_caesiumclt_OBJECTS = caesiumclt-main.$(OBJEXT) \
|
|||
caesiumclt-utils.$(OBJEXT) caesiumclt-png.$(OBJEXT) \
|
||||
caesiumclt-lodepng.$(OBJEXT)
|
||||
caesiumclt_OBJECTS = $(am_caesiumclt_OBJECTS)
|
||||
caesiumclt_DEPENDENCIES =
|
||||
caesiumclt_LDADD = $(LDADD)
|
||||
caesiumclt_LINK = $(CCLD) $(caesiumclt_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
|
@ -255,7 +255,6 @@ top_builddir = @top_builddir@
|
|||
top_srcdir = @top_srcdir@
|
||||
caesiumclt_SOURCES = main.c jpeg.c compresshelper.c utils.c png.c lodepng.c
|
||||
caesiumclt_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64 -std=c99
|
||||
caesiumclt_LDADD = -ljpeg -lturbojpeg -lm -lzopflipng
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
|
|
@ -150,7 +150,6 @@ void cclt_jpeg_compress(char* output_file, unsigned char* image_buffer, cclt_com
|
|||
FILE* fp;
|
||||
tjhandle tjCompressHandle;
|
||||
unsigned char* output_buffer;
|
||||
int status;
|
||||
unsigned long output_size = 0;
|
||||
|
||||
fp = fopen(output_file, "wb");
|
||||
|
@ -166,7 +165,8 @@ void cclt_jpeg_compress(char* output_file, unsigned char* image_buffer, cclt_com
|
|||
tjCompressHandle = tjInitCompress();
|
||||
|
||||
//TODO Scale must be a power of 2. Can we resolve it?
|
||||
status = tjCompress2(tjCompressHandle,
|
||||
//TODO Error checks
|
||||
tjCompress2(tjCompressHandle,
|
||||
image_buffer,
|
||||
pars->width,
|
||||
0,
|
||||
|
@ -178,7 +178,6 @@ void cclt_jpeg_compress(char* output_file, unsigned char* image_buffer, cclt_com
|
|||
pars->quality,
|
||||
pars->dct_method);
|
||||
|
||||
|
||||
fwrite(output_buffer, 1, output_size, fp);
|
||||
|
||||
fclose(fp);
|
||||
|
|
12
src/utils.c
12
src/utils.c
|
@ -1,3 +1,4 @@
|
|||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -102,9 +103,10 @@ char** scan_folder(char* basedir, int* n, int recur) {
|
|||
char** fileList = NULL;
|
||||
|
||||
char absolute_path[PATH_MAX];
|
||||
realpath(basedir, absolute_path);
|
||||
char* ptr = realpath(basedir, absolute_path);
|
||||
|
||||
dir = opendir(absolute_path);
|
||||
|
||||
dir = opendir(ptr);
|
||||
|
||||
if (dir != NULL) {
|
||||
while ((ent = readdir(dir)) != NULL) {
|
||||
|
@ -115,8 +117,8 @@ char** scan_folder(char* basedir, int* n, int recur) {
|
|||
|
||||
//TODO allocate for this entry
|
||||
//Basedir + filename + separator
|
||||
entpath = realloc(entpath, (strlen(absolute_path) + strlen(ent->d_name) + 1) * sizeof(char));
|
||||
strcpy(entpath, absolute_path);
|
||||
entpath = realloc(entpath, (strlen(ptr) + strlen(ent->d_name) + 1) * sizeof(char));
|
||||
strcpy(entpath, ptr);
|
||||
//Append separator
|
||||
strcat(entpath, "/");
|
||||
//Append the name
|
||||
|
@ -156,7 +158,7 @@ char** scan_folder(char* basedir, int* n, int recur) {
|
|||
enum image_type detect_image_type(char* path) {
|
||||
//Open the file
|
||||
FILE* fp;
|
||||
unsigned char* type_buffer = valloc(2);
|
||||
unsigned char* type_buffer = (unsigned char*) malloc(2);
|
||||
|
||||
fp = fopen(path, "r");
|
||||
|
||||
|
|
Loading…
Reference in New Issue