This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 76277f09b9ea5b7884309cfe4625ed82811cdfb9 (commit) from 3568538bbc1602c05313b9224c1884a42a411ad6 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/76277f09b9ea5b7884309cfe4625ed82811cd...
commit 76277f09b9ea5b7884309cfe4625ed82811cdfb9 Author: Cyril Hrubis metan@ucw.cz Date: Mon Jun 16 00:42:12 2014 +0200
loaders: Remove now unused ByteUtils
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/build/syms/Loaders_symbols.txt b/build/syms/Loaders_symbols.txt index 2654ae54..24d0e037 100644 --- a/build/syms/Loaders_symbols.txt +++ b/build/syms/Loaders_symbols.txt @@ -1,4 +1,3 @@ -GP_FWrite
GP_MatchJPG GP_ReadJPG diff --git a/include/loaders/GP_ByteUtils.h b/include/loaders/GP_ByteUtils.h deleted file mode 100644 index 92b2fec7..00000000 --- a/include/loaders/GP_ByteUtils.h +++ /dev/null @@ -1,41 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - - /* - - Utils to read/write values with specified endianity. - - */ - -#ifndef LOADERS_GP_BYTE_UTILS_H -#define LOADERS_GP_BYTE_UTILS_H - -#include <stdio.h> - -/* - * Printf-like function to write file headers. - * - * Returns number of items sucessfully written. - */ -int GP_FWrite(FILE *f, const char *fmt, ...); - -#endif /* LOADERS_GP_BYTE_UTILS_H */ diff --git a/libs/loaders/GP_BMP.c b/libs/loaders/GP_BMP.c index 24aa2b04..efb4c9f3 100644 --- a/libs/loaders/GP_BMP.c +++ b/libs/loaders/GP_BMP.c @@ -40,7 +40,6 @@ #include "core/GP_Pixel.h" #include "core/GP_GetPutPixel.h"
-#include "loaders/GP_ByteUtils.h" #include "loaders/GP_LineConvert.h" #include "loaders/GP_BMP.h"
diff --git a/libs/loaders/GP_ByteUtils.c b/libs/loaders/GP_ByteUtils.c deleted file mode 100644 index 4a83d5d1..00000000 --- a/libs/loaders/GP_ByteUtils.c +++ /dev/null @@ -1,270 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include <stdarg.h> - -#include "core/GP_ByteOrder.h" -#include "core/GP_Debug.h" -#include "core/GP_Common.h" - -#include "loaders/GP_ByteUtils.h" - -enum fmt_type { - BYTE_ARRAY, - BIG_ENDIAN_VAR, - LITTLE_ENDIAN_VAR, - IGNORE, - CONST_BYTE, -}; - -static int ctoi(char c, int *i) -{ - switch (c) { - case '0' ... '9': - *i = c - '0'; - break; - default: - return 1; - } - - return 0; -} - -static int ctoh(char c, int *i) -{ - switch (c) { - case '0' ... '9': - *i += c - '0'; - break; - case 'a' ... 'f': - *i += c - 'a' + 10; - break; - case 'A' ... 'F': - *i += c - 'A' + 10; - break; - case '0': - GP_BUG("Unexpected end of the format string"); - return 1; - default: - GP_BUG("Expected [0-9]|[a-f][A-F] in hex constant, got '%c'", c); - return 1; - } - - return 0; -} - -static const char *get_hex(const char *fmt, int *type, int *val) -{ - *type = CONST_BYTE; - - *val = 0; - - if (fmt[0] != 'x') { - GP_BUG("Expected x after 0 in hex constant"); - return NULL; - } - - if (ctoh(fmt[1], val)) - return NULL; - - (*val)<<=4; - - if (ctoh(fmt[2], val)) - return NULL; - - return fmt + 3; -} - -static const char *get_int(const char *fmt, int *val) -{ - int i = 0, add = 0; - - *val = 0; - - if (ctoi(fmt[i++], val)) - return fmt; - - while (!ctoi(fmt[i], &add)) { - *val *= 10; - *val += add; - i++; - } - - return fmt + i; -} - -static const char *get_array(const char *fmt, int *type, int *val) -{ - *type = BYTE_ARRAY; - - fmt = get_int(fmt, val); - - /* array for one element "%a" */ - if (*val == 0) - *val = 1; - - return fmt; -} - -static const char *get_lb_size(const char *fmt, int *val) -{ - if (ctoi(fmt[0], val)) { - GP_WARN("Expected number got '%c'", fmt[0]); - return NULL; - } - - switch (*val) { - case 1: - case 2: - case 4: - return fmt + 1; - } - - GP_BUG("Invalid little/big endian variable size '%i'", *val); - return NULL; -} - -static const char *get_next(const char *fmt, int *type, int *val) -{ - /* Eat spaces */ - while (fmt[0] == ' ') - fmt++; - - switch (fmt[0]) { - /* Byte array */ - case 'A': - return get_array(fmt + 1, type, val); - break; - /* Hexadecimal constant */ - case '0': - return get_hex(fmt + 1, type, val); - break; - /* 1, 2, 4 bytes long variable in defined endianity */ - case 'L': - *type = LITTLE_ENDIAN_VAR; - return get_lb_size(fmt + 1, val); - break; - case 'B': - *type = BIG_ENDIAN_VAR; - return get_lb_size(fmt + 1, val); - break; - case 'I': - *type = IGNORE; - return get_int(fmt + 1, val); - break; - case '0': - return NULL; - break; - } - - GP_BUG("Unexpected character in format string '%c'", fmt[0]); - return NULL; -} - -static void swap_bytes(void *ptr, int len, int type) -{ - if (__BYTE_ORDER == __LITTLE_ENDIAN && type == LITTLE_ENDIAN_VAR) - return; - - if (__BYTE_ORDER == __BIG_ENDIAN && type == BIG_ENDIAN_VAR) - return; - - char *buf = ptr; - - switch (len) { - case 1: - break; - case 2: - GP_SWAP(buf[0], buf[1]); - break; - case 4: - GP_SWAP(buf[0], buf[3]); - GP_SWAP(buf[1], buf[2]); - break; - default: - GP_BUG("Invalid size %i", len); - } -} - -int GP_FWrite(FILE *f, const char *fmt, ...) -{ - int type, val, ret = 0; - va_list va; - uint8_t u8; - uint16_t u16; - uint32_t u32; - - va_start(va, fmt); - - for (;;) { - fmt = get_next(fmt, &type, &val); - - /* end of the string or error */ - if (fmt == NULL) - goto end; - - switch (type) { - case BYTE_ARRAY: - if (fwrite(va_arg(va, void*), val, 1, f) != 1) - goto end; - break; - case CONST_BYTE: - if (fwrite(&val, 1, 1, f) != 1) - goto end; - break; - case LITTLE_ENDIAN_VAR: - case BIG_ENDIAN_VAR: - switch (val) { - case 1: - u8 = va_arg(va, int); - if (fwrite(&u8, 1, 1, f) != 1) - goto end; - break; - case 2: - u16 = va_arg(va, int); - - swap_bytes(&u16, 2, type); - - if (fwrite(&u16, 2, 1, f) != 1) - goto end; - break; - case 4: - u32 = va_arg(va, int); - - swap_bytes(&u32, 4, type); - - if (fwrite(&u32, 4, 1, f) != 1) - goto end; - break; - } - break; - default: - GP_BUG("Wrong format type for writing (%i)", type); - goto end; - } - - ret++; - } -end: - va_end(va); - return ret; -} diff --git a/libs/loaders/GP_ZIP.c b/libs/loaders/GP_ZIP.c index 55d1cdaa..728f3841 100644 --- a/libs/loaders/GP_ZIP.c +++ b/libs/loaders/GP_ZIP.c @@ -37,7 +37,6 @@ #include <core/GP_Common.h> #include <core/GP_Debug.h>
-#include <loaders/GP_ByteUtils.h> #include <loaders/GP_Loader.h> #include <loaders/GP_IOZlib.h> #include "loaders/GP_ZIP.h"
-----------------------------------------------------------------------
Summary of changes: build/syms/Loaders_symbols.txt | 1 - include/loaders/GP_ByteUtils.h | 41 ------ libs/loaders/GP_BMP.c | 1 - libs/loaders/GP_ByteUtils.c | 270 ---------------------------------------- libs/loaders/GP_ZIP.c | 1 - 5 files changed, 0 insertions(+), 314 deletions(-) delete mode 100644 include/loaders/GP_ByteUtils.h delete mode 100644 libs/loaders/GP_ByteUtils.c
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.