blob: 9acae66465d47e1e204d75bdde37b45dacaedbad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
--- source/tools/genrb/rbutil.c
+++ source/tools/genrb/rbutil.c
@@ -30,7 +30,12 @@
get_dirname(char *dirname,
const char *filename)
{
- const char *lastSlash = uprv_strrchr(filename, U_FILE_SEP_CHAR) + 1;
+ const char *lastSlash = uprv_strrchr(filename, U_FILE_SEP_CHAR);
+ if(lastSlash == NULL) {
+ lastSlash = filename;
+ } else {
+ ++lastSlash;
+ }
if(lastSlash>filename) {
uprv_strncpy(dirname, filename, (lastSlash - filename));
@@ -46,7 +51,12 @@
const char *filename)
{
/* strip off any leading directory portions */
- const char *lastSlash = uprv_strrchr(filename, U_FILE_SEP_CHAR) + 1;
+ const char *lastSlash = uprv_strrchr(filename, U_FILE_SEP_CHAR);
+ if(lastSlash == NULL) {
+ lastSlash = filename;
+ } else {
+ ++lastSlash;
+ }
char *lastDot;
if(lastSlash>filename) {
|