git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
moved from mkvideo.c
[swftools.git]
/
src
/
swfc.c
diff --git
a/src/swfc.c
b/src/swfc.c
index
d2ef74d
..
aa8fe6b
100644
(file)
--- a/
src/swfc.c
+++ b/
src/swfc.c
@@
-619,7
+619,7
@@
void s_font(char*name, char*filename)
int f;
SWF swf;
SWFFONT* font;
int f;
SWF swf;
SWFFONT* font;
- f = open(filename,O_RDONLY);
+ f = open(filename,O_RDONLY|O_BINARY);
if (f<0) {
warning("Couldn't open file \"%s\": %s", filename, strerror(errno));
font = (SWFFONT*)malloc(sizeof(SWFFONT));
if (f<0) {
warning("Couldn't open file \"%s\": %s", filename, strerror(errno));
font = (SWFFONT*)malloc(sizeof(SWFFONT));
@@
-1051,11
+1051,18
@@
int parseInt(char*str)
}
int parseTwip(char*str)
{
}
int parseTwip(char*str)
{
- char*dot = strchr(str, '.');
+ char*dot;
+ int sign=1;
+ if(str[0]=='+' || str[0]=='-') {
+ if(str[0]=='-')
+ sign = -1;
+ str++;
+ }
+ dot = strchr(str, '.');
if(!dot) {
int l=strlen(str);
int t;
if(!dot) {
int l=strlen(str);
int t;
- return parseInt(str)*20;
+ return sign*parseInt(str)*20;
} else {
int l=strlen(++dot);
char*s;
} else {
int l=strlen(++dot);
char*s;
@@
-1072,11
+1079,11
@@
int parseTwip(char*str)
l=2;
}
if(l==0)
l=2;
}
if(l==0)
- return atoi(str)*20;
+ return sign*atoi(str)*20;
if(l==1)
if(l==1)
- return atoi(str)*20+atoi(dot)*2;
+ return sign*atoi(str)*20+atoi(dot)*2;
if(l==2)
if(l==2)
- return atoi(str)*20+atoi(dot)/5;
+ return sign*atoi(str)*20+atoi(dot)/5;
}
return 0;
}
}
return 0;
}