Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: third_party/lzma/v4_65/files/CPP/7zip/Archive/Common/ItemNameUtils.cpp

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Archive/Common/ItemNameUtils.cpp
2
3 #include "StdAfx.h"
4
5 #include "ItemNameUtils.h"
6
7 namespace NArchive {
8 namespace NItemName {
9
10 static const wchar_t kOSDirDelimiter = WCHAR_PATH_SEPARATOR;
11 static const wchar_t kDirDelimiter = L'/';
12
13 UString MakeLegalName(const UString &name)
14 {
15 UString zipName = name;
16 zipName.Replace(kOSDirDelimiter, kDirDelimiter);
17 return zipName;
18 }
19
20 UString GetOSName(const UString &name)
21 {
22 UString newName = name;
23 newName.Replace(kDirDelimiter, kOSDirDelimiter);
24 return newName;
25 }
26
27 UString GetOSName2(const UString &name)
28 {
29 if (name.IsEmpty())
30 return UString();
31 UString newName = GetOSName(name);
32 if (newName[newName.Length() - 1] == kOSDirDelimiter)
33 newName.Delete(newName.Length() - 1);
34 return newName;
35 }
36
37 bool HasTailSlash(const AString &name, UINT codePage)
38 {
39 if (name.IsEmpty())
40 return false;
41 LPCSTR prev =
42 #ifdef _WIN32
43 CharPrevExA((WORD)codePage, name, &name[name.Length()], 0);
44 #else
45 (LPCSTR)(name) + (name.Length() - 1);
46 #endif
47 return (*prev == '/');
48 }
49
50 #ifndef _WIN32
51 UString WinNameToOSName(const UString &name)
52 {
53 UString newName = name;
54 newName.Replace(L'\\', kOSDirDelimiter);
55 return newName;
56 }
57 #endif
58
59 }}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698