Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/tgl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVysheng <mail@vysheng.ru>2014-11-19 15:11:39 +0300
committerVysheng <mail@vysheng.ru>2014-11-19 15:11:39 +0300
commitb79a6fcc99553f5303d3f32cbc48ca61de7bd333 (patch)
treec88160f45c26cb71a25ee5fa090f44dcdfc7a0c1 /tg-mime-types.c
parent805c1d748dde3deba6da2066515948f2146e0429 (diff)
small fixes
Diffstat (limited to 'tg-mime-types.c')
-rw-r--r--tg-mime-types.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/tg-mime-types.c b/tg-mime-types.c
index 849c15f..43c26c3 100644
--- a/tg-mime-types.c
+++ b/tg-mime-types.c
@@ -2,8 +2,10 @@
#include <assert.h>
#define MAX_MIME_TYPES_NUM 10000
-extern char _binary_mime_types_start[];
-extern char _binary_mime_types_end[];
+extern char _binary_auto_mime_types_start[];
+extern char _binary_auto_mime_types_end[];
+static char *start = _binary_auto_mime_types_start;
+static char *end = _binary_auto_mime_types_start;
char *tg_mime_by_filename (const char *filename) {
int l = strlen (filename);
@@ -19,40 +21,40 @@ char *tg_mime_by_filename (const char *filename) {
static char *mime_type_extensions[MAX_MIME_TYPES_NUM];
if (!mime_initialized) {
mime_initialized = 1;
- char *c = _binary_mime_types_start;
- while (c < _binary_mime_types_end) {
+ char *c = start;
+ while (c < end) {
if (*c == '#') {
- while (c < _binary_mime_types_end && *c != '\n') {
+ while (c < end && *c != '\n') {
c ++;
}
- if (c < _binary_mime_types_end) {
+ if (c < end) {
c ++;
}
} else {
- while (*c <= ' ' && *c != '\n' && c < _binary_mime_types_end) {
+ while (*c <= ' ' && *c != '\n' && c < end) {
c ++;
}
- assert (*c > ' ' && *c != '\n' && c < _binary_mime_types_end);
+ assert (*c > ' ' && *c != '\n' && c < end);
char *name = c;
- while (*c > ' ' && *c != '\n' && c < _binary_mime_types_end) {
+ while (*c > ' ' && *c != '\n' && c < end) {
c ++;
}
- assert (*c <= ' ' && *c != '\n' && c < _binary_mime_types_end);
+ assert (*c <= ' ' && *c != '\n' && c < end);
*c = 0;
c ++;
while (1) {
- while (*c <= ' ' && *c != '\n' && c < _binary_mime_types_end) {
+ while (*c <= ' ' && *c != '\n' && c < end) {
c ++;
}
- if (*c == '\n' || c == _binary_mime_types_end) {
+ if (*c == '\n' || c == end) {
if (*c == '\n') { c ++; }
break;
}
char *ext = c;
- while (*c > ' ' && *c != '\n' && c < _binary_mime_types_end) {
+ while (*c > ' ' && *c != '\n' && c < end) {
c ++;
}
- assert (c != _binary_mime_types_end);
+ assert (c != end);
int br = (*c == '\n');
*c = 0;
c ++;