Changeset 34570 in vbox
- Timestamp:
- Dec 1, 2010 1:33:49 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 68364
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ExtPackUtil.cpp
r34307 r34570 245 245 * Skip ahead to the filename part and count the number of characters 246 246 * that matches the criteria for a extension pack name. 247 * 248 * Trick: '_' == ' ' - filenames with spaces cause trouble. 247 249 */ 248 250 const char *pszSrc = RTPathFilename(pszTarball); … … 251 253 252 254 size_t off = 0; 253 while (RT_C_IS_ALNUM(pszSrc[off]) || pszSrc[off] == ' ' )255 while (RT_C_IS_ALNUM(pszSrc[off]) || pszSrc[off] == ' ' || pszSrc[off] == '_') 254 256 off++; 255 257 … … 257 259 * Check min and max name limits. 258 260 */ 259 if ( off > VBOX_EXTPACK_NAME_M IN_LEN261 if ( off > VBOX_EXTPACK_NAME_MAX_LEN 260 262 || off < VBOX_EXTPACK_NAME_MIN_LEN) 261 263 return NULL; 262 264 263 265 /* 264 * Make a duplicate of the name and return it. 265 */ 266 iprt::MiniString *pStrRet = new iprt::MiniString(pszSrc, off); 267 Assert(VBoxExtPackIsValidName(pStrRet->c_str())); 266 * Replace underscores, duplicate the string and return it. 267 * (Unforuntately, iprt::ministring does not offer simple search & replace.) 268 */ 269 char szTmp[VBOX_EXTPACK_NAME_MAX_LEN + 1]; 270 memcpy(szTmp, pszSrc, off); 271 szTmp[off] = '\0'; 272 char *psz = szTmp; 273 while ((psz = strchr(psz, '_')) != NULL) 274 *psz++ = ' '; 275 Assert(VBoxExtPackIsValidName(szTmp)); 276 277 iprt::MiniString *pStrRet = new iprt::MiniString(szTmp, off); 268 278 return pStrRet; 269 279 }
Note:
See TracChangeset
for help on using the changeset viewer.