#include <stdio.h>
#include <string.h>
#include <stdarg.h>
+#include <stdlib.h>
#include "gmqcc.h"
{
qc_program *prog;
prog_header header;
- FILE *file = fs_file_open(filename, "rb");
+ FILE *file = fs_file_open(filename, "rb");
if (!file)
return NULL;
vec_free(prog->entitydata);
vec_free(prog->entitypool);
mem_d(prog);
+
+ fs_file_close(file);
return NULL;
}
/* cast for return required for C++ */
if (str < 0 || str >= (qcint)vec_size(prog->strings))
return "<<<invalid string>>>";
-
+
return prog->strings + str;
}
size_t len1, len2;
qcany *str1, *str2;
qcany out;
-
+
const char *cstr1;
const char *cstr2;
const char *cstr1;
const char *cstr2;
-
+
if (prog->argc != 2 && prog->argc != 3) {
fprintf(stderr, "ERROR: invalid number of arguments for strcmp/strncmp: %i, expected 2 or 3\n",
prog->argc);
static const char *arg0 = NULL;
-static void version() {
+static void version(void) {
printf("GMQCC-QCVM %d.%d.%d Built %s %s\n",
GMQCC_VERSION_MAJOR,
GMQCC_VERSION_MINOR,
);
}
-static void usage() {
+static void usage(void) {
printf("usage: %s [options] [parameters] file\n", arg0);
printf("options:\n");
printf(" -h, --help print this message\n"
char c;
while ((c = *(src++))) {
switch(c) {
- case '\t':
+ case '\t':
*(dest++) = '\\', *(dest++) = 't';
break;
- case '\n':
+ case '\n':
*(dest++) = '\\', *(dest++) = 'n';
break;
- case '\r':
+ case '\r':
*(dest++) = '\\', *(dest++) = 'r';
break;
- case '\\':
+ case '\\':
*(dest++) = '\\', *(dest++) = '\\';
break;
- case '\"':
+ case '\"':
*(dest++) = '\\', *(dest++) = '\"';
break;
default: