Skip to content

Commit f40f7b0

Browse files
committed
1.10: define ICONV_IMPLEMENTATION
1 parent 3dbc8b0 commit f40f7b0

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PROJECT := torrentcheck
2-
CFLAGS := -O
2+
CFLAGS := -O -DICONV_IMPLEMENTATION
33
OBJS := src/torrentcheck.o src/sha1.o
44
RM := rm -f
55

src/torrentcheck.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
#include <malloc.h>
1717
#include <string.h>
1818

19+
#ifdef ICONV_IMPLEMENTATION
1920
#include <iconv.h>
21+
#endif
2022

2123
// Begin required for SHA1
2224
typedef unsigned char *POINTER;
@@ -163,17 +165,17 @@ int beParseString(BYTE* benstr,int benstrLen,int benstrOffset,BYTE** stringBegin
163165

164166
//// Return offset of an element in a list, or -1 if not found
165167
//int beFindInList(BYTE* benstr,int benstrLen,int benstrOffset,int listIndex) {
166-
// int i;
167-
// if ((benstrOffset < 0)||(benstrOffset >= benstrLen)) return (-1);
168-
// if (benstr[benstrOffset] != 'l') return (-1);
169-
// benstrOffset++;
170-
// if (benstr[benstrOffset] == 'e') return (-1);
171-
// for(i=0;i<listIndex;i++) {
172-
// benstrOffset = beStepOver(benstr,benstrLen,benstrOffset);
173-
// if ((benstrOffset < 0)||(benstrOffset >= benstrLen)) return (-1);
174-
// }
175-
// if (benstr[benstrOffset] == 'e') return (-1);
176-
// return (benstrOffset);
168+
// int i;
169+
// if ((benstrOffset < 0)||(benstrOffset >= benstrLen)) return (-1);
170+
// if (benstr[benstrOffset] != 'l') return (-1);
171+
// benstrOffset++;
172+
// if (benstr[benstrOffset] == 'e') return (-1);
173+
// for(i=0;i<listIndex;i++) {
174+
// benstrOffset = beStepOver(benstr,benstrLen,benstrOffset);
175+
// if ((benstrOffset < 0)||(benstrOffset >= benstrLen)) return (-1);
176+
// }
177+
// if (benstr[benstrOffset] == 'e') return (-1);
178+
// return (benstrOffset);
177179
//}
178180

179181

@@ -442,7 +444,9 @@ int main(int argc,char* argv[])
442444
SHA_CTX sha1ctx;
443445
//
444446
char* encoding = NULL;
447+
#ifdef ICONV_IMPLEMENTATION
445448
iconv_t convDescriptor;
449+
#endif
446450
char *inPtr, *outPtr;
447451
size_t inBytesLeft, outBytesLeft;
448452
char filePathUTF8[1024];
@@ -709,6 +713,7 @@ int main(int argc,char* argv[])
709713
{
710714
inPtr = filePath, outPtr = filePathUTF8;
711715
inBytesLeft = strlen(filePath), outBytesLeft = 1024;
716+
#ifdef ICONV_IMPLEMENTATION
712717
if((convDescriptor = iconv_open("utf-8", encoding)) == (iconv_t)-1)
713718
{
714719
return -1;
@@ -738,6 +743,11 @@ int main(int argc,char* argv[])
738743
}
739744
memcpy(filePath, filePathUTF8, filePathUTF8Len);
740745
filePath[filePathUTF8Len] = '\0';
746+
#else
747+
outBytesLeft = inBytesLeft;
748+
outPtr = inPtr;
749+
filePathUTF8Len = filePath;
750+
#endif
741751
}
742752

743753
fileRecordList[currentFile].filePath = malloc(strlen(filePath)+1);

0 commit comments

Comments
 (0)