aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-10-02 14:44:52 +0000
committerMax Horn2009-10-02 14:44:52 +0000
commit0041502ee7751ef843392cc527fa091e852fc76d (patch)
tree9682fbf735e9710967f5687030fbd061824b918e
parentf54e82e4880767f6e71c83840bff1ae8e0feda3d (diff)
downloadscummvm-rg350-0041502ee7751ef843392cc527fa091e852fc76d.tar.gz
scummvm-rg350-0041502ee7751ef843392cc527fa091e852fc76d.tar.bz2
scummvm-rg350-0041502ee7751ef843392cc527fa091e852fc76d.zip
Release resources properly; fix code formatting
svn-id: r44540
-rw-r--r--tools/convbdf.c34
-rw-r--r--tools/skycpt/cptcompiler.cpp1
2 files changed, 13 insertions, 22 deletions
diff --git a/tools/convbdf.c b/tools/convbdf.c
index 393a7ebc46..4341eac2e7 100644
--- a/tools/convbdf.c
+++ b/tools/convbdf.c
@@ -141,8 +141,7 @@ void warning(const char *s, ...) {
}
void
-usage(void)
-{
+usage(void) {
char help[] = {
"Usage: convbdf [options] [input-files]\n"
" convbdf [options] [-o output-file] [single-input-file]\n"
@@ -156,8 +155,7 @@ usage(void)
}
/* parse command line options*/
-void getopts(int *pac, char ***pav)
-{
+void getopts(int *pac, char ***pav) {
const char *p;
char **av;
int ac;
@@ -225,8 +223,7 @@ void getopts(int *pac, char ***pav)
}
/* remove directory prefix and file suffix from full path*/
-char *basename(char *path)
-{
+char *basename(char *path) {
char *p, *b;
static char base[256];
@@ -246,8 +243,7 @@ char *basename(char *path)
return base;
}
-int convbdf(char *path)
-{
+int convbdf(char *path) {
struct font* pf;
int ret = 0;
@@ -265,8 +261,7 @@ int convbdf(char *path)
return ret;
}
-int main(int ac, char *av[])
-{
+int main(int ac, char *av[]) {
int ret = 0;
++av; --ac; /* skip av[0]*/
@@ -290,8 +285,7 @@ int main(int ac, char *av[])
}
/* free font structure*/
-void free_font(struct font* pf)
-{
+void free_font(struct font* pf) {
if (!pf)
return;
free(pf->name);
@@ -303,8 +297,7 @@ void free_font(struct font* pf)
}
/* build incore structure from .bdf file*/
-struct font* bdf_read_font(char *path)
-{
+struct font* bdf_read_font(char *path) {
FILE *fp;
struct font* pf;
@@ -340,8 +333,7 @@ struct font* bdf_read_font(char *path)
}
/* read bdf font header information, return 0 on error*/
-int bdf_read_header(FILE *fp, struct font* pf)
-{
+int bdf_read_header(FILE *fp, struct font* pf) {
int encoding;
int nchars, maxwidth;
int firstchar = 65535;
@@ -476,8 +468,7 @@ int bdf_read_header(FILE *fp, struct font* pf)
}
/* read bdf font bitmaps, return 0 on error*/
-int bdf_read_bitmaps(FILE *fp, struct font* pf)
-{
+int bdf_read_bitmaps(FILE *fp, struct font* pf) {
long ofs = 0;
int maxwidth = 0;
int i, k, encoding, width;
@@ -675,8 +666,7 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf)
}
/* read the next non-comment line, returns buf or NULL if EOF*/
-char *bdf_getline(FILE *fp, char *buf, int len)
-{
+char *bdf_getline(FILE *fp, char *buf, int len) {
int c;
char *b;
@@ -722,8 +712,7 @@ bitmap_t bdf_hexval(unsigned char *buf) {
}
/* generate C source from in-core font*/
-int gen_c_source(struct font* pf, char *path)
-{
+int gen_c_source(struct font* pf, char *path) {
FILE *ofp;
int h, i;
int did_defaultchar = 0;
@@ -936,6 +925,7 @@ int gen_c_source(struct font* pf, char *path)
fprintf(ofp, "DEFINE_FONT(g_sysfont)\n");
fprintf(ofp, "#endif\n");
fprintf(ofp, "\n} // End of namespace Graphics\n");
+ fclose(ofp);
return 0;
}
diff --git a/tools/skycpt/cptcompiler.cpp b/tools/skycpt/cptcompiler.cpp
index cac009a662..ec9f185a85 100644
--- a/tools/skycpt/cptcompiler.cpp
+++ b/tools/skycpt/cptcompiler.cpp
@@ -524,6 +524,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
fwrite(diff, 2, 2 * diffPos, debOutf);
printf("diff v0.0%03d: 2 * 2 * %d\n", gameVers[cnt], diffPos);
}
+ free(buf288);
} else {
printf("Creating CPT file with Dummy reset data @ %ld\n", ftell(debOutf));
uint16 resetFields16 = 4;