Cleanup: use full scentences for code-comments & minor corrections

This commit is contained in:
Campbell Barton 2024-03-21 09:49:19 +11:00
parent fbe16bc1eb
commit 116264c310
4 changed files with 16 additions and 18 deletions

View File

@ -86,11 +86,11 @@ char BKE_imtype_valid_depths(char imtype);
/** /**
* String is from command line `--render-format` argument, * String is from command line `--render-format` argument,
* keep in sync with `creator_args.c` help info. * keep in sync with `creator_args.cc` help info.
*/ */
char BKE_imtype_from_arg(const char *imtype_arg); char BKE_imtype_from_arg(const char *imtype_arg);
/* Conversion between ImBuf settings. */ /* Conversion between #ImBuf settings. */
void BKE_image_format_from_imbuf(struct ImageFormatData *im_format, const struct ImBuf *imbuf); void BKE_image_format_from_imbuf(struct ImageFormatData *im_format, const struct ImBuf *imbuf);
void BKE_image_format_to_imbuf(struct ImBuf *ibuf, const struct ImageFormatData *imf); void BKE_image_format_to_imbuf(struct ImBuf *ibuf, const struct ImageFormatData *imf);

View File

@ -112,7 +112,7 @@ void BKE_scene_object_base_flag_sync_from_base(Base *base);
*/ */
void BKE_scene_set_background(Main *bmain, Scene *sce); void BKE_scene_set_background(Main *bmain, Scene *sce);
/** /**
* Called from `creator_args.c`. * Called from `creator_args.cc`.
*/ */
Scene *BKE_scene_set_name(Main *bmain, const char *name); Scene *BKE_scene_set_name(Main *bmain, const char *name);

View File

@ -46,7 +46,7 @@
#include "BLI_path_util.h" #include "BLI_path_util.h"
#include "BLI_string.h" #include "BLI_string.h"
#include "BLI_string_utils.hh" #include "BLI_string_utils.hh"
#include "BLI_sys_types.h" /* for intptr_t support */ #include "BLI_sys_types.h" /* For `intptr_t` support. */
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
/** Sizes above this must be allocated. */ /** Sizes above this must be allocated. */
@ -292,19 +292,19 @@ bool BLI_file_is_writable(const char *filepath)
{ {
bool writable; bool writable;
if (BLI_access(filepath, W_OK) == 0) { if (BLI_access(filepath, W_OK) == 0) {
/* file exists and I can write to it */ /* File exists and I can write to it. */
writable = true; writable = true;
} }
else if (errno != ENOENT) { else if (errno != ENOENT) {
/* most likely file or containing directory cannot be accessed */ /* Most likely file or containing directory cannot be accessed. */
writable = false; writable = false;
} }
else { else {
/* file doesn't exist -- check I can create it in parent directory */ /* File doesn't exist -- check I can create it in parent directory. */
char parent[FILE_MAX]; char parent[FILE_MAX];
BLI_path_split_dir_part(filepath, parent, sizeof(parent)); BLI_path_split_dir_part(filepath, parent, sizeof(parent));
#ifdef WIN32 #ifdef WIN32
/* windows does not have X_OK */ /* Windows does not have X_OK. */
writable = BLI_access(parent, W_OK) == 0; writable = BLI_access(parent, W_OK) == 0;
#else #else
writable = BLI_access(parent, X_OK | W_OK) == 0; writable = BLI_access(parent, X_OK | W_OK) == 0;
@ -321,7 +321,7 @@ bool BLI_file_touch(const char *filepath)
int c = getc(f); int c = getc(f);
if (c == EOF) { if (c == EOF) {
/* Empty file, reopen in truncate write mode... */ /* Empty file, reopen in truncate write mode. */
fclose(f); fclose(f);
f = BLI_fopen(filepath, "w+b"); f = BLI_fopen(filepath, "w+b");
} }
@ -1228,7 +1228,7 @@ static int delete_soft(const char *file, const char **error_message)
int pid = fork(); int pid = fork();
if (pid != 0) { if (pid != 0) {
/* Parent process */ /* Parent process. */
int wstatus = 0; int wstatus = 0;
waitpid(pid, &wstatus, 0); waitpid(pid, &wstatus, 0);
@ -1249,7 +1249,7 @@ static int delete_soft(const char *file, const char **error_message)
execvp(args[0], (char **)args); execvp(args[0], (char **)args);
*error_message = "Forking process failed."; *error_message = "Forking process failed.";
return -1; /* This should only be reached if execvp fails and stack isn't replaced. */ return -1; /* This should only be reached if `execvp` fails and stack isn't replaced. */
} }
# endif # endif
@ -1355,13 +1355,13 @@ static int copy_callback_pre(const char *from, const char *to)
return RecursiveOp_Callback_Error; return RecursiveOp_Callback_Error;
} }
/* create a directory */ /* Create a directory. */
if (mkdir(to, st.st_mode)) { if (mkdir(to, st.st_mode)) {
perror("mkdir"); perror("mkdir");
return RecursiveOp_Callback_Error; return RecursiveOp_Callback_Error;
} }
/* set proper owner and group on new directory */ /* Set proper owner and group on new directory. */
if (chown(to, st.st_uid, st.st_gid)) { if (chown(to, st.st_uid, st.st_gid)) {
perror("chown"); perror("chown");
return RecursiveOp_Callback_Error; return RecursiveOp_Callback_Error;
@ -1388,12 +1388,12 @@ static int copy_single_file(const char *from, const char *to)
} }
if (S_ISLNK(st.st_mode)) { if (S_ISLNK(st.st_mode)) {
/* symbolic links should be copied in special way */ /* Symbolic links should be copied in special way. */
char *link_buffer; char *link_buffer;
int need_free; int need_free;
int64_t link_len; int64_t link_len;
/* get large enough buffer to read link content */ /* Get large enough buffer to read link content. */
if ((st.st_size + 1) < sizeof(buf)) { if ((st.st_size + 1) < sizeof(buf)) {
link_buffer = buf; link_buffer = buf;
need_free = 0; need_free = 0;
@ -1431,7 +1431,7 @@ static int copy_single_file(const char *from, const char *to)
return RecursiveOp_Callback_OK; return RecursiveOp_Callback_OK;
} }
if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode) || S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode)) { if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode) || S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode)) {
/* copy special type of file */ /* Copy special type of file. */
if (mknod(to, st.st_mode, st.st_rdev)) { if (mknod(to, st.st_mode, st.st_rdev)) {
perror("mknod"); perror("mknod");
return RecursiveOp_Callback_Error; return RecursiveOp_Callback_Error;

View File

@ -290,8 +290,6 @@ int main(int argc,
int argv_num; int argv_num;
#endif #endif
/* --- end declarations --- */
/* Ensure we free data on early-exit. */ /* Ensure we free data on early-exit. */
CreatorAtExitData app_init_data = {nullptr}; CreatorAtExitData app_init_data = {nullptr};
BKE_blender_atexit_register(callback_main_atexit, &app_init_data); BKE_blender_atexit_register(callback_main_atexit, &app_init_data);