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

Side by Side Diff: third_party/lzma/v4_65/files/CPP/7zip/UI/Common/DefaultName.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 // DefaultName.cpp
2
3 #include "StdAfx.h"
4
5 #include "DefaultName.h"
6
7 static UString GetDefaultName3(const UString &fileName,
8 const UString &extension, const UString &addSubExtension)
9 {
10 int extLength = extension.Length();
11 int fileNameLength = fileName.Length();
12 if (fileNameLength > extLength + 1)
13 {
14 int dotPos = fileNameLength - (extLength + 1);
15 if (fileName[dotPos] == '.')
16 if (extension.CompareNoCase(fileName.Mid(dotPos + 1)) == 0)
17 return fileName.Left(dotPos) + addSubExtension;
18 }
19 int dotPos = fileName.ReverseFind(L'.');
20 if (dotPos > 0)
21 return fileName.Left(dotPos) + addSubExtension;
22
23 if (addSubExtension.IsEmpty())
24 return fileName + L"~";
25 else
26 return fileName + addSubExtension;
27 }
28
29 UString GetDefaultName2(const UString &fileName,
30 const UString &extension, const UString &addSubExtension)
31 {
32 UString name = GetDefaultName3(fileName, extension, addSubExtension);
33 name.TrimRight();
34 return name;
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698