|
From: <xb...@us...> - 2013-06-24 20:09:54
|
Revision: 1832
http://sourceforge.net/p/scstudio/code/1832
Author: xborza
Date: 2013-06-24 20:09:51 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
bug #36(Wrong filename in warnig when importing an empty file) fixed
Modified Paths:
--------------
trunk/src/data/msc_types.cpp
Modified: trunk/src/data/msc_types.cpp
===================================================================
--- trunk/src/data/msc_types.cpp 2013-06-24 18:01:11 UTC (rev 1831)
+++ trunk/src/data/msc_types.cpp 2013-06-24 20:09:51 UTC (rev 1832)
@@ -22,25 +22,44 @@
std::wstring TOWSTRING(const std::string& s)
{
- std::wstring result;
+ std::wstring result;
+ bool slash = false;
+ unsigned int posit = 0;
+ for(size_t i=0; i < s.size();)
+ {
+ posit = s.find('\\',posit+1);
+
+ if(posit == std::string::npos)
+ posit = s.size();
+ else
+ slash = true;
- size_t size = s.length();
- const char* pos = s.data();
+ std::string sub = s.substr(i,posit-i);
+ i += posit-i+1;
- while(size > 0)
- {
- wchar_t wc;
- int inc = mbtowc(&wc, pos, size);
+ size_t size = sub.length();
+ const char* pos = sub.data();
+
+ wchar_t wc;
- if(inc > 0)
- {
+ while(size > 0)
+ {
+ int inc = mbtowc(&wc, pos, size);
+ if(inc > 0)
+ {
result.push_back(wc);
size = size - inc;
pos = pos + inc;
- }
- }
+ }
+ }
+ if(slash)
+ {
+ result.append(L"\\\\");
+ slash = false;
+ }
+ }
return result;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|