Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginUtil.cpp

Issue 4859310991474688: Issue 1681 - Incorrect usage of BString (Closed)
Patch Set: Created Dec. 10, 2014, 11:34 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« src/plugin/PluginClass.cpp ('K') | « src/plugin/PluginUtil.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 #include <algorithm> 2 #include <algorithm>
3 #include <stdexcept> 3 #include <stdexcept>
4 #include <vector> 4 #include <vector>
5 5
6 #include "../shared/Utils.h" 6 #include "../shared/Utils.h"
7 #include "PluginUtil.h" 7 #include "PluginUtil.h"
8 #include "PluginSettings.h" 8 #include "PluginSettings.h"
9 9
10 BString::BString(const std::wstring& value)
11 : value(::SysAllocString(value.c_str()))
12 {
13 }
14
15 BString::~BString()
16 {
17 ::SysFreeString(value);
18 }
19
20 BString::operator BSTR()
21 {
22 return value;
23 }
24
25 std::wstring HtmlFolderPath() 10 std::wstring HtmlFolderPath()
26 { 11 {
27 return GetDllDir() + L"html\\templates\\"; 12 return GetDllDir() + L"html\\templates\\";
28 } 13 }
29 14
30 std::wstring UserSettingsFileUrl() 15 std::wstring UserSettingsFileUrl()
31 { 16 {
32 return FileUrl(HtmlFolderPath() + L"index.html"); 17 return FileUrl(HtmlFolderPath() + L"index.html");
33 } 18 }
34 19
35 std::wstring FirstRunPageFileUrl() 20 std::wstring FirstRunPageFileUrl()
36 { 21 {
37 return FileUrl(HtmlFolderPath() + L"firstRun.html"); 22 return FileUrl(HtmlFolderPath() + L"firstRun.html");
38 } 23 }
39 24
40 std::wstring FileUrl(const std::wstring& path) 25 std::wstring FileUrl(const std::wstring& path)
41 { 26 {
42 std::wstring url = path; 27 std::wstring url = path;
43 std::replace(url.begin(), url.end(), L'\\', L'/'); 28 std::replace(url.begin(), url.end(), L'\\', L'/');
44 return L"file:///" + url; 29 return L"file:///" + url;
45 } 30 }
OLDNEW
« src/plugin/PluginClass.cpp ('K') | « src/plugin/PluginUtil.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld