diff options
Diffstat (limited to 'source')
-rw-r--r--source/parsing.c2
-rw-r--r--source/shared.c8
-rw-r--r--source/shared.h4
-rw-r--r--source/ui-blame.c2
-rw-r--r--source/ui-blob.c6
-rw-r--r--source/ui-diff.c16
-rw-r--r--source/ui-log.c4
-rw-r--r--source/ui-plain.c2
-rw-r--r--source/ui-shared.c4
-rw-r--r--source/ui-shared.h2
-rw-r--r--source/ui-snapshot.c2
-rw-r--r--source/ui-tree.c22
12 files changed, 37 insertions, 37 deletions
diff --git a/source/parsing.c b/source/parsing.c
index 8aa0ee4..da09b2b 100644
--- a/source/parsing.c
+++ b/source/parsing.c
@@ -238,7 +238,7 @@ struct taginfo *cgit_parse_tag(struct tag *tag)
{
void *data;
enum object_type type;
- unsigned long size;
+ size_t size;
const char *p;
struct taginfo *info = NULL;
diff --git a/source/shared.c b/source/shared.c
index 3191742..51c92d4 100644
--- a/source/shared.c
+++ b/source/shared.c
@@ -384,14 +384,14 @@ void cgit_diff_tree_cb(struct diff_queue_struct *q, struct diff_options *options
}
int cgit_diff_files(const struct object_id *old_oid, const struct object_id *new_oid,
- unsigned long *old_size, unsigned long *new_size, int *binary, int context, int ignorews,
+ size_t *old_size, size_t *new_size, int *binary, int context, int ignorews,
linediff_fn fn)
{
mmfile_t old_file, new_file;
xpparam_t diff_params;
xdemitconf_t emit_params;
xdemitcb_t emit_cb;
- unsigned long old_bytes = 0, new_bytes = 0;
+ size_t old_bytes = 0, new_bytes = 0;
// Read the object headers first so an oversized blob is never inflated
// into memory just to be diffed. Reporting it as binary suppresses
@@ -448,9 +448,9 @@ int cgit_diff_files(const struct object_id *old_oid, const struct object_id *new
return 0;
}
-int cgit_blob_too_large(unsigned long size)
+int cgit_blob_too_large(size_t size)
{
- return ctx.cfg.max_blob_size && size / 1024 > (unsigned long)ctx.cfg.max_blob_size;
+ return ctx.cfg.max_blob_size && size / 1024 > (size_t)ctx.cfg.max_blob_size;
}
void cgit_diff_limit_path(struct diff_options *opt, const char *prefix)
diff --git a/source/shared.h b/source/shared.h
index df18772..10aa659 100644
--- a/source/shared.h
+++ b/source/shared.h
@@ -62,7 +62,7 @@ extern void cgit_diff_tree_cb(struct diff_queue_struct *q, struct diff_options *
* in place of the content.
*/
extern int cgit_diff_files(const struct object_id *old_oid, const struct object_id *new_oid,
- unsigned long *old_size, unsigned long *new_size, int *binary, int context, int ignorews,
+ size_t *old_size, size_t *new_size, int *binary, int context, int ignorews,
linediff_fn fn);
/*
@@ -70,7 +70,7 @@ extern int cgit_diff_files(const struct object_id *old_oid, const struct object_
* reading the object, so a huge blob stays out of memory rather than being
* noticed once it is already there.
*/
-extern int cgit_blob_too_large(unsigned long size);
+extern int cgit_blob_too_large(size_t size);
/*
* Limit a diff to the paths below prefix, which is taken literally.
diff --git a/source/ui-blame.c b/source/ui-blame.c
index f3d58c0..8fd6c83 100644
--- a/source/ui-blame.c
+++ b/source/ui-blame.c
@@ -265,7 +265,7 @@ static void print_blame_page(const struct object_id *oid, const char *path,
{
enum object_type type;
char *buf;
- unsigned long size;
+ size_t size;
struct rev_info revs;
struct blame_scoreboard sb;
diff --git a/source/ui-blob.c b/source/ui-blob.c
index f7047c7..1d22483 100644
--- a/source/ui-blob.c
+++ b/source/ui-blob.c
@@ -98,7 +98,7 @@ static int find_path_oid(struct object_id *oid, char *path, int file_only)
int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
{
struct object_id oid;
- unsigned long size;
+ size_t size;
char *path_copy = xstrdup(path);
int found = 0;
@@ -117,7 +117,7 @@ int cgit_print_file(char *path, const char *head, int file_only, int html_escape
{
struct object_id oid;
enum object_type type;
- unsigned long size;
+ size_t size;
char *buf;
if (repo_get_oid(the_repository, head, &oid))
@@ -165,7 +165,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
{
struct object_id oid;
enum object_type type;
- unsigned long size;
+ size_t size;
char *buf;
if (hex) {
diff --git a/source/ui-diff.c b/source/ui-diff.c
index 9ea6543..f133a9c 100644
--- a/source/ui-diff.c
+++ b/source/ui-diff.c
@@ -33,8 +33,8 @@ struct fileinfo {
char *new_path;
unsigned int added;
unsigned int removed;
- unsigned long old_size;
- unsigned long new_size;
+ size_t old_size;
+ size_t new_size;
unsigned int binary:1;
struct strbuf body;
};
@@ -146,7 +146,7 @@ static void print_fileinfo(struct fileinfo *info)
}
html("</td><td class='right'>");
if (info->binary) {
- htmlf("bin</td><td class='graph'>%lu -> %lu bytes</td></tr>\n", info->old_size,
+ htmlf("bin</td><td class='graph'>%zu -> %zu bytes</td></tr>\n", info->old_size,
info->new_size);
return;
}
@@ -363,7 +363,7 @@ static struct fileinfo *reserve_item(void)
* written it straight out on a second walk.
*/
static void collect_body(struct diff_filepair *pair, struct fileinfo *item, int *binary,
- unsigned long *old_size, unsigned long *new_size)
+ size_t *old_size, size_t *new_size)
{
struct strbuf *body = &item->body;
linediff_fn line_fn = use_ssdiff ? cgit_ssdiff_line_cb : print_line;
@@ -428,8 +428,8 @@ static void inspect_filepair(struct diff_filepair *pair)
{
struct fileinfo *item;
int binary = 0;
- unsigned long old_size = 0;
- unsigned long new_size = 0;
+ size_t old_size = 0;
+ size_t new_size = 0;
if (!show_filepair(pair))
return;
@@ -498,8 +498,8 @@ static int over_line_cap(int idx)
static void filepair_cb(struct diff_filepair *pair)
{
- unsigned long old_size = 0;
- unsigned long new_size = 0;
+ size_t old_size = 0;
+ size_t new_size = 0;
int binary = 0;
int idx;
linediff_fn line_fn = print_line;
diff --git a/source/ui-log.c b/source/ui-log.c
index d23fcd4..f96689e 100644
--- a/source/ui-log.c
+++ b/source/ui-log.c
@@ -58,8 +58,8 @@ static void count_file(struct diff_filepair *pair)
{
// cgit_diff_files needs somewhere to report the blob sizes and
// whether the pair is binary, none of which these columns show.
- unsigned long old_size = 0;
- unsigned long new_size = 0;
+ size_t old_size = 0;
+ size_t new_size = 0;
int binary = 0;
file_count++;
diff --git a/source/ui-plain.c b/source/ui-plain.c
index 136e1f4..67b2044 100644
--- a/source/ui-plain.c
+++ b/source/ui-plain.c
@@ -50,7 +50,7 @@ static void print_object(const struct object_id *oid, const char *path)
{
enum object_type type;
char *buf, *mimetype;
- unsigned long size;
+ size_t size;
type = odb_read_object_info(the_repository->objects, oid, &size);
if (type == OBJ_BAD) {
diff --git a/source/ui-shared.c b/source/ui-shared.c
index 94a749e..f762fd7 100644
--- a/source/ui-shared.c
+++ b/source/ui-shared.c
@@ -1658,9 +1658,9 @@ void cgit_vprint_error_page(int code, const char *msg, const char *fmt, va_list
cgit_print_layout_end();
}
-void cgit_print_blob_too_large(unsigned long size)
+void cgit_print_blob_too_large(size_t size)
{
- cgit_print_error_page(413, "Content Too Large", "Blob size (%lu KB) exceeds the limit (%d KB)",
+ cgit_print_error_page(413, "Content Too Large", "Blob size (%zu KB) exceeds the limit (%d KB)",
size / 1024, ctx.cfg.max_blob_size);
}
diff --git a/source/ui-shared.h b/source/ui-shared.h
index dd90196..fdfdbed 100644
--- a/source/ui-shared.h
+++ b/source/ui-shared.h
@@ -109,7 +109,7 @@ extern void cgit_vprint_error_page(int code, const char *msg, const char *fmt, v
/*
* Answer with the error page for a blob of size bytes past max-blob-size.
*/
-extern void cgit_print_blob_too_large(unsigned long size);
+extern void cgit_print_blob_too_large(size_t size);
extern void cgit_print_pageheader(void);
extern void cgit_print_filemode(unsigned short mode);
extern void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref,
diff --git a/source/ui-snapshot.c b/source/ui-snapshot.c
index 24d1268..8762407 100644
--- a/source/ui-snapshot.c
+++ b/source/ui-snapshot.c
@@ -256,7 +256,7 @@ static int send_sig(const struct cgit_snapshot_format *format, const char *hex,
{
const struct object_id *note = cgit_snapshot_get_sig(hex, format);
enum object_type type;
- unsigned long size;
+ size_t size;
char *buf;
if (!note) {
diff --git a/source/ui-tree.c b/source/ui-tree.c
index d023502..bee750c 100644
--- a/source/ui-tree.c
+++ b/source/ui-tree.c
@@ -58,15 +58,15 @@ struct only_child {
* The anchors are handed over in batches rather than a write per line, and
* never built whole, which would come to several times the blob's size.
*/
-static void add_linenumber(struct strbuf *numbers, unsigned long lineno)
+static void add_linenumber(struct strbuf *numbers, size_t lineno)
{
- strbuf_addf(numbers, "<a id='n%lu' href='#n%lu'>%lu</a>\n", lineno, lineno, lineno);
+ strbuf_addf(numbers, "<a id='n%zu' href='#n%zu'>%zu</a>\n", lineno, lineno, lineno);
}
-static void print_linenumbers(const char *buf, unsigned long size)
+static void print_linenumbers(const char *buf, size_t size)
{
struct strbuf numbers = STRBUF_INIT;
- unsigned long lineno = 0, idx = 0;
+ size_t lineno = 0, idx = 0;
if (size) {
add_linenumber(&numbers, ++lineno);
@@ -88,7 +88,7 @@ static void print_linenumbers(const char *buf, unsigned long size)
strbuf_release(&numbers);
}
-static void print_text_buffer(const char *filename, char *buf, unsigned long size)
+static void print_text_buffer(const char *filename, char *buf, size_t size)
{
html("<table class='blob'>\n");
@@ -126,9 +126,9 @@ static int is_graphic(unsigned char ch)
return isprint(ch) && !isspace(ch);
}
-static void print_binary_buffer(char *buf, unsigned long size)
+static void print_binary_buffer(char *buf, size_t size)
{
- unsigned long offset, idx;
+ size_t offset, idx;
char ascii[HEXDUMP_ROW_BYTES + 1];
struct strbuf row = STRBUF_INIT;
@@ -138,7 +138,7 @@ static void print_binary_buffer(char *buf, unsigned long size)
// A row goes out in one write rather than a write per byte.
for (offset = 0; offset < size; offset += HEXDUMP_ROW_BYTES, buf += HEXDUMP_ROW_BYTES) {
strbuf_reset(&row);
- strbuf_addf(&row, "<tr><td class='right'>%04lx</td><td class='hex'>", offset);
+ strbuf_addf(&row, "<tr><td class='right'>%04zx</td><td class='hex'>", offset);
for (idx = 0; idx < HEXDUMP_ROW_BYTES && offset + idx < size; idx++) {
int gap = idx == HEXDUMP_ROW_HALF ? HEXDUMP_GAP_WIDTH : 1;
@@ -167,7 +167,7 @@ static bool print_object(const struct object_id *oid, const char *path,
{
enum object_type type;
char *buf;
- unsigned long size;
+ size_t size;
bool is_binary;
type = odb_read_object_info(the_repository->objects, oid, &size);
@@ -280,7 +280,7 @@ static void print_ls_row(const struct object_id *oid, const char *pathname,
struct strbuf linkpath = STRBUF_INIT;
struct strbuf class = STRBUF_INIT;
enum object_type type;
- unsigned long size = 0;
+ size_t size = 0;
char *buf;
name = xstrdup(pathname);
@@ -346,7 +346,7 @@ static void print_ls_row(const struct object_id *oid, const char *pathname,
if (S_ISGITLINK(mode))
html("</td><td class='ls-size'>-</td>");
else
- htmlf("</td><td class='ls-size'>%lu</td>", size);
+ htmlf("</td><td class='ls-size'>%zu</td>", size);
html("<td class='ls-links'>");
cgit_log_link("log", NULL, "button", ctx.qry.head, walk->rev, fullpath.buf,