summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-09-24 22:57:06 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-09-24 22:57:06 +0200
commit1a33991574062e711fd73a747920a348c4fd8a81 (patch)
tree6ebf93ae3974fa442daed0b56f4419baae32652d
parentmoved gstreamer utility functions to seperate file (diff)
removed useless parse hex string
-rw-r--r--src/datatypes.h6
-rw-r--r--src/options.c49
-rw-r--r--src/options.h2
-rw-r--r--src/utils.c1
4 files changed, 1 insertions, 57 deletions
diff --git a/src/datatypes.h b/src/datatypes.h
index 4bcc175..6481eb8 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -38,10 +38,4 @@
#include <stdint.h>
-struct buffer_struct {
- uint32_t length_;
- uint8_t* buf_;
-};
-typedef struct buffer_struct buffer_t;
-
#endif
diff --git a/src/options.c b/src/options.c
index 60ee6e5..84d5840 100644
--- a/src/options.c
+++ b/src/options.c
@@ -91,24 +91,6 @@
i++; \
}
-#define PARSE_HEXSTRING_PARAM_SEC(SHORT, LONG, VALUE) \
- else if(!strcmp(str,SHORT) || !strcmp(str,LONG)) \
- { \
- if(argc < 1 || argv[i+1][0] == '-') \
- return i; \
- int ret; \
- ret = options_parse_hex_string(argv[i+1], &VALUE); \
- if(ret > 0) \
- return i+1; \
- else if(ret < 0) \
- return ret; \
- size_t j; \
- for(j=0; j < strlen(argv[i+1]); ++j) \
- argv[i+1][j] = '#'; \
- argc--; \
- i++; \
- }
-
#define PARSE_STRING_LIST(SHORT, LONG, LIST) \
else if(!strcmp(str,SHORT) || !strcmp(str,LONG)) \
{ \
@@ -140,37 +122,6 @@
i++; \
}
-int options_parse_hex_string(const char* hex, buffer_t* buffer)
-{
- if(!hex || !buffer)
- return -1;
-
- u_int32_t hex_len = strlen(hex);
- if(hex_len%2)
- return 1;
-
- if(buffer->buf_)
- free(buffer->buf_);
-
- buffer->length_ = hex_len/2;
- buffer->buf_ = malloc(buffer->length_);
- if(!buffer->buf_) {
- buffer->length_ = 0;
- return -2;
- }
-
- const char* ptr = hex;
- int i;
- for(i=0;i<buffer->length_;++i) {
- u_int32_t tmp;
- sscanf(ptr, "%2X", &tmp);
- buffer->buf_[i] = (u_int8_t)tmp;
- ptr += 2;
- }
-
- return 0;
-}
-
int options_parse(options_t* opt, int argc, char* argv[])
{
diff --git a/src/options.h b/src/options.h
index a6f1067..36c5aa4 100644
--- a/src/options.h
+++ b/src/options.h
@@ -74,8 +74,6 @@ struct options_struct {
};
typedef struct options_struct options_t;
-int options_parse_hex_string(const char* hex, buffer_t* buffer);
-
int options_parse(options_t* opt, int argc, char* argv[]);
void options_parse_post(options_t* opt);
void options_default(options_t* opt);
diff --git a/src/utils.c b/src/utils.c
index 6511a52..e9466fa 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -33,6 +33,7 @@
* GPL license sydra is covered by.
*/
+#include "datatypes.h"
#include "utils.h"
#include "log.h"
#include <gst/gst.h>