Skip to content

Commit

Permalink
V0.9.5 dev to master (#154)
Browse files Browse the repository at this point in the history
* Updated gitignore

* Fixes creating parent directoires issue #153

* Backported issue #151 into branch

* Updated version number
  • Loading branch information
roberthawdon authored Feb 12, 2022
1 parent 950e9ae commit 168f508
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,32 @@ config.h
config.hin
config.log
config.status
config.guess
config.rpath
config.sub
configure
depcomp
install-sh
missing
stamp-*
m4/*
po/Makefile
po/Makefile.in.in
po/Makevars.template
po/POTFILES
po/Rules-quot
po/boldquot.sed
po/dfshow.pot
po/en@boldquot.header
po/en@quot.header
po/insert-header.sin
po/quot.sed
po/remove-potcdate.sed
po/remove-potcdate.sin
/bin/*
/docs/build/*
*.stackdump
*~
valgrind*
*.#*
ABOUT-NLS
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([dfshow],[0.9.4],[https://github.com/roberthawdon/dfshow/issues])
AC_INIT([dfshow],[0.9.5],[https://github.com/roberthawdon/dfshow/issues])
AM_INIT_AUTOMAKE([subdir-objects])
AC_PROG_CC
AC_CONFIG_HEADERS([config.h:config.hin])
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = '0.9'
# The full version, including alpha/beta/rc tags
release = '0.9.4-beta'
release = '0.9.5-beta'


# -- General configuration ---------------------------------------------------
Expand Down
18 changes: 10 additions & 8 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,15 @@ int createParentsInput(char *path)
void createParentDirs(char *path){
pathDirs *targetPath;
char *tempPath = malloc(sizeof(char) * 1);
char *tempPathWork;
int e, i = 0;

e = splitPath(&targetPath, path);

tempPath[0]=0;
for (i = 0; i < e; i++){
tempPath = realloc(tempPath, sizeof(char) * (strlen(tempPath) + strlen(targetPath[i].directories) + 2));
snprintf(tempPath, (strlen(tempPath) + strlen(targetPath[i].directories) + 2), "%s/%s", tempPath, targetPath[i].directories);
memcpy(tempPath, tempPathWork, (setDynamicChar(&tempPathWork, "%s/%s", tempPath, targetPath[i].directories) + 1));
free(tempPathWork);
if (!check_dir(tempPath)){
mk_dir(tempPath);
}
Expand Down Expand Up @@ -371,11 +372,12 @@ char *str_replace(char *orig, char *rep, char *with) {
ins = tmp + len_rep;
}

tmp_size = strlen(orig) + (len_with - len_rep) * count + 1;
tmp_size = (strlen(orig) + ((len_with - len_rep) * count) + 1);
tmp = result = malloc(tmp_size);

if (!result)
return NULL;
if (!result){
return NULL;
}

// first time through the loop, all the variable are set correctly
// from here on,
Expand All @@ -391,7 +393,7 @@ char *str_replace(char *orig, char *rep, char *with) {
tmp = tmp + len_with;
orig += len_front + len_rep; // move to next "end of rep"
}
memcpy(tmp, orig, tmp_size);
memcpy(tmp, orig, (strlen(orig) + 1));
return result;
}

Expand Down Expand Up @@ -564,7 +566,6 @@ void buildCommandArguments(const char *cmd, char **args, size_t items)
// Getting the length of the input
cmdLen = strlen(cmd);

// endwin();
// First sweep to get the number of args, and length
itemCount = 0;
argCharCount = 0;
Expand Down Expand Up @@ -608,7 +609,7 @@ void buildCommandArguments(const char *cmd, char **args, size_t items)
tempStr = calloc(itemLen[i] + 1, sizeof(char));
args[i] = calloc(itemLen[i] + 1, sizeof(char));
for (k = 0; k < itemLen[i]; k++){
if ((cmdPos + cmdOffset + k) > cmdLen){
if ((cmdPos + cmdOffset + k) > cmdLen - 1){
// Hacky workaround to avoid buffer overflow
break;
}
Expand All @@ -628,6 +629,7 @@ void buildCommandArguments(const char *cmd, char **args, size_t items)
cmdOffset++;
}
cmdOffset++;
goto checkBlank;
}
tempStr[k] = cmd[cmdPos + cmdOffset + k];
if (k == (itemLen[i] - 1)){
Expand Down
6 changes: 2 additions & 4 deletions src/showfunctions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1568,8 +1568,7 @@ int SendToPager(char* object)
fullCommand = calloc((strlen(page) + 1), sizeof(char));
snprintf(fullCommand, (strlen(page) + 1), "%s", page);
escObject = str_replace(object, "'", "'\"'\"'");
fullObject = calloc((strlen(escObject) + 3), sizeof(char));
snprintf(fullObject, (strlen(escObject) + 3), "'%s'", escObject);
setDynamicChar(&fullObject, "'%s'", escObject);
for (i = 1; i < noOfArgs; i++){
fullCommand = realloc(fullCommand, (strlen(fullCommand) + strlen(launchCommand[i]) + 2));
snprintf(fullCommand + strlen(fullCommand), (strlen(fullCommand) + strlen(launchCommand[i]) + 2), " %s", launchCommand[i]);
Expand Down Expand Up @@ -1631,8 +1630,7 @@ int SendToEditor(char* object)
fullCommand = calloc((strlen(editor) + 1), sizeof(char));
snprintf(fullCommand, (strlen(editor) + 1), "%s", editor);
escObject = str_replace(object, "'", "'\"'\"'");
fullObject = calloc((strlen(escObject) + 3), sizeof(char));
snprintf(fullObject, (strlen(escObject) + 3), "'%s'", escObject);
setDynamicChar(&fullObject, "'%s'", escObject);
for (i = 1; i < noOfArgs; i++){
fullCommand = realloc(fullCommand, (strlen(fullCommand) + strlen(launchCommand[i]) + 2));
snprintf(fullCommand + strlen(fullCommand), (strlen(fullCommand) + strlen(launchCommand[i]) + 2), " %s", launchCommand[i]);
Expand Down

0 comments on commit 168f508

Please sign in to comment.