Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Fixed memory access violation bug in System.trimChar
-Changed floor to follow specification (Real->Real, NOT Real -> Integer) -Changed System.stringReplace implementation to c++ (in systemimplmisc.cpp) (This was probably not necessary since bug was in trimChar, but impl. is now much more readable ;) git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4734 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
Peter Aronsson
committed
Jan 5, 2010
1 parent
9c7c2f0
commit 3196f8e
Showing
10 changed files
with
82 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
/* Miscellaneous C++ file for systemimpl. */ | ||
|
||
|
||
#include <string> | ||
|
||
using namespace std; | ||
|
||
void FindAndReplace( std::string& tInput, std::string tFind, std::string tReplace ) | ||
{ | ||
size_t uPos = 0; size_t uFindLen = tFind.length(); size_t uReplaceLen = tReplace.length(); | ||
|
||
if( uFindLen == 0 ) | ||
{ | ||
return; | ||
} | ||
|
||
for( ;(uPos = tInput.find( tFind, uPos )) != std::string::npos; ) | ||
{ | ||
tInput.replace( uPos, uFindLen, tReplace ); | ||
uPos += uReplaceLen; | ||
} | ||
|
||
} | ||
|
||
|
||
extern "C" { | ||
|
||
#include <string.h> | ||
|
||
char* _replace(const char* source_str, const char* search_str, const char* replace_str) | ||
{ | ||
string str(source_str); | ||
FindAndReplace(str,string(search_str),string(replace_str)); | ||
|
||
char* res = strdup(str.c_str()); | ||
return res; | ||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef SYSTEMIMPLMISC_H | ||
#define SYSTEMIMPLMISC_H | ||
|
||
extern "C" { | ||
|
||
char* _replace(const char* source_str, const char* search_str, const char* replace_str); | ||
|
||
} | ||
|
||
#endif |