Skip to content

Commit b0d2f01

Browse files
committed
style: follow C conventions of constant naming (Uppercase, move constant to top of file)
1 parent 3e39d09 commit b0d2f01

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/appimagetool.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ enum fARCH {
7070
};
7171

7272
static gchar const APPIMAGEIGNORE[] = ".appimageignore";
73-
static char _exclude_file_desc[256];
7473

74+
// maximum size that the updateinformation's buffer can hold
75+
// TODO: why 1024?
76+
const int UPDATE_INFORMATION_BUFFER_SIZE = 1024;
77+
78+
static char _exclude_file_desc[256];
7579
static gboolean list = FALSE;
7680
static gboolean verbose = FALSE;
7781
static gboolean showVersionOnly = FALSE;
@@ -825,7 +829,7 @@ main (int argc, char *argv[])
825829
* should hopefully change that. */
826830

827831
fprintf (stderr, "Generating squashfs...\n");
828-
const int buffer_size = 1024;
832+
829833
int size = 0;
830834

831835

@@ -873,7 +877,7 @@ main (int argc, char *argv[])
873877

874878
if(bintray_user != NULL){
875879
if(bintray_repo != NULL){
876-
char buf[buffer_size];
880+
char buf[UPDATE_INFORMATION_BUFFER_SIZE];
877881
sprintf(buf, "bintray-zsync|%s|%s|%s|%s-_latestVersion-%s.AppImage.zsync", bintray_user, bintray_repo, app_name_for_filename, app_name_for_filename, arch);
878882
updateinformation = buf;
879883
printf("%s\n", updateinformation);
@@ -928,9 +932,9 @@ main (int argc, char *argv[])
928932
} else {
929933
channel = "continuous";
930934
}
931-
int is_zsync_write_success = snprintf(buf, buffer_size, "gh-releases-zsync|%s|%s|%s|%s*-%s.AppImage.zsync", parts[0], parts[1], channel, app_name_for_filename, arch);
935+
int is_zsync_write_success = snprintf(buf, UPDATE_INFORMATION_BUFFER_SIZE, "gh-releases-zsync|%s|%s|%s|%s*-%s.AppImage.zsync", parts[0], parts[1], channel, app_name_for_filename, arch);
932936
if (is_zsync_write_success < 0) {
933-
printf("Writing updateinformation failed. zsync information is too long. (> %d)\n", buffer_size);
937+
printf("Writing updateinformation failed. zsync information is too long. (> %d)\n", UPDATE_INFORMATION_BUFFER_SIZE);
934938
exit(is_zsync_write_success);
935939
}
936940
updateinformation = buf;

0 commit comments

Comments
 (0)