summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cli.c4
-rw-r--r--src/compress.c8
-rw-r--r--src/crypto.c4
-rw-r--r--src/encoding.c4
-rw-r--r--src/io.c13
-rw-r--r--src/main.c6
6 files changed, 19 insertions, 20 deletions
diff --git a/src/cli.c b/src/cli.c
index b60454a..74adbb8 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -30,11 +30,11 @@
a trailing path delimiter. */
static void parse_output_path(const char *optarg, struct params *p) {
p->out_len = strlen(optarg);
- p->out = malloc(p->out_len + 2);
+ p->out = malloc(p->out_len + 2);
strcpy(p->out, optarg);
if (p->out[p->out_len - 1] != '/') {
p->out[p->out_len] = '/';
- p->out_len += 1;
+ p->out_len += 1;
}
}
diff --git a/src/compress.c b/src/compress.c
index 8cbf1e1..f9fa8ff 100644
--- a/src/compress.c
+++ b/src/compress.c
@@ -26,11 +26,11 @@
struct stream *stream_inflate(struct stream *s, size_t len,
size_t decompressed_len) {
z_stream strm;
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
strm.avail_in = 0;
- strm.next_in = Z_NULL;
+ strm.next_in = Z_NULL;
if (inflateInit(&strm) != Z_OK)
return NULL;
diff --git a/src/crypto.c b/src/crypto.c
index 3dad218..92c4032 100644
--- a/src/crypto.c
+++ b/src/crypto.c
@@ -67,7 +67,7 @@ uint8_t derive_initial(struct game_key k, uint64_t file_key) {
/* Generates a primary key for the given key structure and file key. */
uint8_t derive_primary(struct game_key k, uint64_t file_key) {
- uint32_t tmp = k.master ^ file_key;
- uint8_t primary = (tmp >> 24 ^ tmp >> 16 ^ tmp >> 8 ^ tmp) & 0xff;
+ uint32_t tmp = k.master ^ file_key;
+ uint8_t primary = (tmp >> 24 ^ tmp >> 16 ^ tmp >> 8 ^ tmp) & 0xff;
return primary == 0 ? k.fallback_primary : primary;
}
diff --git a/src/encoding.c b/src/encoding.c
index e83c79c..d50e503 100644
--- a/src/encoding.c
+++ b/src/encoding.c
@@ -22,8 +22,8 @@
/* Wrapper for iconv, using the conversion specified by `conv`. */
static void convert(char *in_buf, char *out_buf, size_t len, iconv_t conv) {
- size_t in_size = len, out_size = len;
- char *in_start = in_buf, *out_start = out_buf;
+ size_t in_size = len, out_size = len;
+ char *in_start = in_buf, *out_start = out_buf;
iconv(conv, &in_start, &in_size, &out_start, &out_size);
}
diff --git a/src/io.c b/src/io.c
index 1004251..0bb2dfb 100644
--- a/src/io.c
+++ b/src/io.c
@@ -29,10 +29,10 @@
structure pointing to it. */
struct stream *stream_new(size_t len) {
struct stream *new = malloc(sizeof(struct stream));
- new->len = len;
+ new->len = len;
new->_start = malloc(len);
- new->_cur = new->_start;
- new->_loc = HEAP;
+ new->_cur = new->_start;
+ new->_loc = HEAP;
return new;
}
@@ -41,8 +41,7 @@ struct stream *stream_new(size_t len) {
struct stream *stream_clone(struct stream *s, size_t n) {
struct stream *new = stream_new(n);
stream_write(new, s->_cur, n);
- stream_rewind(new); /* New! This fixes the only bug we've had so far! */
- /* Look for other shit like this! */
+ stream_rewind(new);
return new;
}
@@ -96,9 +95,9 @@ void stream_write(struct stream *s, void *src, size_t n) {
ptrdiff_t dist = (uintptr_t) s->_cur - (uintptr_t) s->_start;
switch(s->_loc) {
case HEAP:
- s->len *= 2;
+ s->len *= 2;
s->_start = realloc(s->_start, s->len);
- s->_cur = s->_start + dist;
+ s->_cur = s->_start + dist;
}
}
memcpy(s->_cur, src, n);
diff --git a/src/main.c b/src/main.c
index 95b4ae3..ca47067 100644
--- a/src/main.c
+++ b/src/main.c
@@ -89,7 +89,7 @@ void make_dirs(char *path) {
for (int i = 0; i < 0x100 && path[i] != '\0'; i++) {
if (path[i] == '/') {
*buf++ = '/';
- *buf = '\0';
+ *buf = '\0';
if (stat(buf_start, &tmp) == -1)
mkdir(buf_start, 0777);
} else {
@@ -152,8 +152,8 @@ static void extract(struct stream *s, struct table_entry *e, struct params p) {
}
struct game_key k = get_key(p.game);
- uint8_t initial = derive_initial(k, e->key);
- uint8_t primary = derive_primary(k, e->key);
+ uint8_t initial = derive_initial(k, e->key);
+ uint8_t primary = derive_primary(k, e->key);
stream_xor(segm_data, initial, primary);
stream_dump(fp, segm_data, segm_data->len);