summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-05-28 10:31:39 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-05-28 10:31:39 +0200
commit9e71296d22207988e0e3986591f95f6ea04dae75 (patch)
tree45231187f6dd9fa7079dd9e180ae66029ad2be2c
parenta4f6b307c0e497683eeab18f3c762c9f7e7543e1 (diff)
Clarify code and fix 64bit warning.
-rw-r--r--src/file.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/file.cc b/src/file.cc
index 7c4725d..9d86c1c 100644
--- a/src/file.cc
+++ b/src/file.cc
@@ -68,11 +68,15 @@ File::File(const char *fn, const char* ext, Info *i)
seqnum = 0;
fd = -1;
- int pos = (int)strrchr(filename, '/');
+ char *cpos = strrchr(filename, '/');
memset(path, 0, sizeof(path));
- if(pos) { // pos is NULL, a file will be created in the current dir (Which is bad)
- pos -= (int)filename; // Make pos relative to the beginning of the string
+ // cpos is NULL, a file will be created in the current dir (Which is bad)
+ if(cpos) {
+
+ // Make pos relative to the beginning of the string
+ size_t pos = (size_t)(cpos - filename);
+
strncpy(path, filename, pos);
createPath(path);
}