OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 1999-2013, International Business Machines | 4 * Copyright (C) 1999-2014, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: toolutil.c | 8 * file name: toolutil.c |
9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
11 * indentation:4 | 11 * indentation:4 |
12 * | 12 * |
13 * created on: 1999nov19 | 13 * created on: 1999nov19 |
14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
15 * | 15 * |
16 * 6/25/08 - Added Cygwin specific code in uprv_mkdir - Brian Rower | 16 * 6/25/08 - Added Cygwin specific code in uprv_mkdir - Brian Rower |
17 * | 17 * |
18 * This file contains utility functions for ICU tools like genccode. | 18 * This file contains utility functions for ICU tools like genccode. |
19 */ | 19 */ |
20 | 20 |
| 21 #include "unicode/platform.h" |
21 #if U_PLATFORM == U_PF_MINGW | 22 #if U_PLATFORM == U_PF_MINGW |
22 // *cough* - for struct stat | 23 // *cough* - for struct stat |
23 #ifdef __STRICT_ANSI__ | 24 #ifdef __STRICT_ANSI__ |
24 #undef __STRICT_ANSI__ | 25 #undef __STRICT_ANSI__ |
25 #endif | 26 #endif |
26 #endif | 27 #endif |
27 | 28 |
28 #include <stdio.h> | 29 #include <stdio.h> |
29 #include <sys/stat.h> | 30 #include <sys/stat.h> |
30 #include "unicode/utypes.h" | 31 #include "unicode/utypes.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 *status = U_BUFFER_OVERFLOW_ERROR; | 155 *status = U_BUFFER_OVERFLOW_ERROR; |
155 return NULL; | 156 return NULL; |
156 } | 157 } |
157 } | 158 } |
158 | 159 |
159 U_CAPI const char * U_EXPORT2 | 160 U_CAPI const char * U_EXPORT2 |
160 findBasename(const char *filename) { | 161 findBasename(const char *filename) { |
161 const char *basename=uprv_strrchr(filename, U_FILE_SEP_CHAR); | 162 const char *basename=uprv_strrchr(filename, U_FILE_SEP_CHAR); |
162 | 163 |
163 #if U_FILE_ALT_SEP_CHAR!=U_FILE_SEP_CHAR | 164 #if U_FILE_ALT_SEP_CHAR!=U_FILE_SEP_CHAR |
164 if(basename==NULL) { | 165 #if !(U_PLATFORM == U_PF_CYGWIN && U_PLATFORM_USES_ONLY_WIN32_API) |
| 166 if(basename==NULL) |
| 167 #endif |
| 168 { |
165 /* Use lenient matching on Windows, which can accept either \ or / | 169 /* Use lenient matching on Windows, which can accept either \ or / |
166 This is useful for environments like Win32+CygWin which have both. | 170 This is useful for environments like Win32+CygWin which have both. |
167 */ | 171 */ |
168 basename=uprv_strrchr(filename, U_FILE_ALT_SEP_CHAR); | 172 basename=uprv_strrchr(filename, U_FILE_ALT_SEP_CHAR); |
169 } | 173 } |
170 #endif | 174 #endif |
171 | 175 |
172 if(basename!=NULL) { | 176 if(basename!=NULL) { |
173 return basename+1; | 177 return basename+1; |
174 } else { | 178 } else { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 char *p=NULL; | 346 char *p=NULL; |
343 int32_t oldIndex=mem->idx; | 347 int32_t oldIndex=mem->idx; |
344 int32_t newIndex=oldIndex+n; | 348 int32_t newIndex=oldIndex+n; |
345 if(utm_hasCapacity(mem, newIndex)) { | 349 if(utm_hasCapacity(mem, newIndex)) { |
346 p=(char *)mem->array+oldIndex*mem->size; | 350 p=(char *)mem->array+oldIndex*mem->size; |
347 mem->idx=newIndex; | 351 mem->idx=newIndex; |
348 uprv_memset(p, 0, n*mem->size); | 352 uprv_memset(p, 0, n*mem->size); |
349 } | 353 } |
350 return p; | 354 return p; |
351 } | 355 } |
OLD | NEW |