Skip to content

Commit

Permalink
Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
lexrus committed Aug 26, 2016
1 parent 344ef26 commit 7d14b1d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions MMDB/maxminddb.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ typedef struct record_info_s {
/* --prototypes automatically generated by dev-bin/regen-prototypes.pl - don't remove this comment */
LOCAL int map_file(MMDB_s *const mmdb);
LOCAL const uint8_t *find_metadata(const uint8_t *file_content,
ssize_t file_size, uint32_t *metadata_size);
ssize_t file_size, long *metadata_size);
LOCAL int read_metadata(MMDB_s *mmdb);
LOCAL MMDB_s make_fake_metadata_db(MMDB_s *mmdb);
LOCAL int value_for_key_as_uint16(MMDB_entry_s *start, char *key,
Expand Down Expand Up @@ -249,7 +249,7 @@ int MMDB_open(const char *const filename, uint32_t flags, MMDB_s *const mmdb)
WSAStartup(MAKEWORD(2, 2), &wsa);
#endif

uint32_t metadata_size = 0;
long metadata_size = 0;
const uint8_t *metadata = find_metadata(mmdb->file_content, mmdb->file_size,
&metadata_size);
if (NULL == metadata) {
Expand All @@ -270,7 +270,7 @@ int MMDB_open(const char *const filename, uint32_t flags, MMDB_s *const mmdb)
goto cleanup;
}

uint32_t search_tree_size = mmdb->metadata.node_count *
long search_tree_size = mmdb->metadata.node_count *
mmdb->full_record_byte_size;

mmdb->data_section = mmdb->file_content + search_tree_size
Expand Down Expand Up @@ -390,7 +390,7 @@ LOCAL int map_file(MMDB_s *const mmdb)
#endif

LOCAL const uint8_t *find_metadata(const uint8_t *file_content,
ssize_t file_size, uint32_t *metadata_size)
ssize_t file_size, long *metadata_size)
{
const ssize_t marker_len = sizeof(METADATA_MARKER) - 1;
ssize_t max_size = file_size >
Expand Down
4 changes: 2 additions & 2 deletions MMDB/maxminddb.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ typedef struct MMDB_s {
ssize_t file_size;
const uint8_t *file_content;
const uint8_t *data_section;
uint32_t data_section_size;
long data_section_size;
const uint8_t *metadata_section;
uint32_t metadata_section_size;
long metadata_section_size;
uint16_t full_record_byte_size;
uint16_t depth;
MMDB_ipv4_start_node_s ipv4_start_node;
Expand Down
Empty file removed Package.swift
Empty file.
14 changes: 7 additions & 7 deletions Sources/MMDB.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ public struct MMDBCountry: CustomStringConvertible {
s += " \"continent\": {\n"
s += " \"code\": \"" + (self.continent.code ?? "") + "\",\n"
s += " \"names\": {\n"
var i = self.continent.names?.count ?? 0
self.continent.names?.forEach {
var i = continent.names?.count ?? 0
continent.names?.forEach {
s += " \""
+ $0.0 + ": \""
+ $0.1 + "\""
+ (i > 1 ? "," : "")
+ "\n"
i--
i -= 1
}
s += " }\n"
s += " },\n"
s += " \"isoCode\": \"" + self.isoCode + "\",\n"
s += " \"names\": {\n"
i = self.names.count
self.names.forEach {
i = names.count
names.forEach {
s += " \""
+ $0.0 + ": \""
+ $0.1 + "\""
+ (i > 1 ? "," : "")
+ "\n"
i--
i -= 1
}
s += " }\n}"
return s
Expand Down Expand Up @@ -152,7 +152,7 @@ final public class MMDB {

list = list.memory.next
list = dumpList(list, toS: toS)
size--
size -= 1
}
toS.memory += "},"
break
Expand Down

0 comments on commit 7d14b1d

Please sign in to comment.