nobody at rubyforge.org
2007-Jan-23 21:23 UTC
[Wxruby-development] [853] trunk/wxruby2/swig: Replace deprecated STR2CSTR with StringValuePtr
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:'':'';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[853] trunk/wxruby2/swig: Replace deprecated STR2CSTR with StringValuePtr</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>853</dd> <dt>Author</dt> <dd>brokentoy</dd> <dt>Date</dt> <dd>2007-01-23 16:23:36 -0500 (Tue, 23 Jan 2007)</dd> </dl> <h3>Log Message</h3> <pre>Replace deprecated STR2CSTR with StringValuePtr</pre> <h3>Modified Paths</h3> <ul> <li><a href="#trunkwxruby2swigFunctionsi">trunk/wxruby2/swig/Functions.i</a></li> <li><a href="#trunkwxruby2swigclassesImagei">trunk/wxruby2/swig/classes/Image.i</a></li> <li><a href="#trunkwxruby2swigtypemapi">trunk/wxruby2/swig/typemap.i</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="trunkwxruby2swigFunctionsi"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/Functions.i (852 => 853)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/Functions.i        2007-01-23 21:21:41 UTC (rev 852) +++ trunk/wxruby2/swig/Functions.i        2007-01-23 21:23:36 UTC (rev 853) </span><span class="lines">@@ -25,7 +25,7 @@ </span><span class="cx"> void log_message(int argc, VALUE *argv, VALUE self) </span><span class="cx"> { </span><span class="cx"> VALUE str = rb_f_sprintf(argc, argv); </span><del>- wxLogMessage(wxString(STR2CSTR(str), wxConvUTF8)); </del><ins>+ wxLogMessage(wxString(StringValuePtr(str), wxConvUTF8)); </ins><span class="cx"> </span><span class="cx"> } </span><span class="cx"> </span><span class="lines">@@ -35,11 +35,11 @@ </span><span class="cx"> wxFrame *ptr; </span><span class="cx"> Data_Get_Struct(argv[0], wxFrame, ptr); </span><span class="cx"> VALUE str = rb_f_sprintf(argc-1, &argv[1]); </span><del>- wxLogStatus(ptr,wxString(STR2CSTR(str), wxConvUTF8)); </del><ins>+ wxLogStatus(ptr,wxString(StringValuePtr(str), wxConvUTF8)); </ins><span class="cx"> } </span><span class="cx"> else { </span><span class="cx"> VALUE str = rb_f_sprintf(argc, argv); </span><del>- wxLogStatus(wxString(STR2CSTR(str), wxConvUTF8)); </del><ins>+ wxLogStatus(wxString(StringValuePtr(str), wxConvUTF8)); </ins><span class="cx"> } </span><span class="cx"> </span><span class="cx"> } </span><span class="lines">@@ -49,7 +49,7 @@ </span><span class="cx"> log_warning(int argc, VALUE *argv, VALUE self) </span><span class="cx"> { </span><span class="cx"> VALUE str = rb_f_sprintf(argc, argv); </span><del>- wxLogWarning(wxString(STR2CSTR(str), wxConvUTF8)); </del><ins>+ wxLogWarning(wxString(StringValuePtr(str), wxConvUTF8)); </ins><span class="cx"> } </span><span class="cx"> </span><span class="cx"> </span><span class="lines">@@ -57,7 +57,7 @@ </span><span class="cx"> log_error(int argc, VALUE *argv, VALUE self) </span><span class="cx"> { </span><span class="cx"> VALUE str = rb_f_sprintf(argc, argv); </span><del>- wxLogError(wxString(STR2CSTR(str), wxConvUTF8)); </del><ins>+ wxLogError(wxString(StringValuePtr(str), wxConvUTF8)); </ins><span class="cx"> } </span><span class="cx"> </span><span class="cx"> </span><span class="lines">@@ -77,7 +77,7 @@ </span><span class="cx"> static VALUE </span><span class="cx"> xrcid(VALUE self,VALUE str_id) </span><span class="cx"> { </span><del>- wxString temp(STR2CSTR(str_id), wxConvUTF8); </del><ins>+ wxString temp(StringValuePtr(str_id), wxConvUTF8); </ins><span class="cx"> int ret = wxXmlResource::GetXRCID(temp); </span><span class="cx"> return INT2NUM(ret); </span><span class="cx"> } </span></span></pre></div> <a id="trunkwxruby2swigclassesImagei"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/classes/Image.i (852 => 853)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/classes/Image.i        2007-01-23 21:21:41 UTC (rev 852) +++ trunk/wxruby2/swig/classes/Image.i        2007-01-23 21:23:36 UTC (rev 853) </span><span class="lines">@@ -11,7 +11,7 @@ </span><span class="cx"> </span><span class="cx"> %typemap(in) unsigned char * data { </span><span class="cx">         if(TYPE($input) == T_STRING) </span><del>-                $1 = reinterpret_cast< unsigned char * >(STR2CSTR($input)); </del><ins>+                $1 = reinterpret_cast< unsigned char * >(StringValuePtr($input)); </ins><span class="cx">         else </span><span class="cx">                 SWIG_exception_fail(SWIG_ERROR, "in method ''set_data'', expected argument of type ''string''"); </span><span class="cx"> } </span></span></pre></div> <a id="trunkwxruby2swigtypemapi"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/swig/typemap.i (852 => 853)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/swig/typemap.i        2007-01-23 21:21:41 UTC (rev 852) +++ trunk/wxruby2/swig/typemap.i        2007-01-23 21:23:36 UTC (rev 853) </span><span class="lines">@@ -6,18 +6,18 @@ </span><span class="cx"> ############################################################## </span><span class="cx"> %typemap(in) wxString& { </span><span class="cx">         // $argnum: $1_type $1_name ($1_mangle) [$1_ltype] </span><del>-        $1 = new wxString(STR2CSTR($input), wxConvUTF8); </del><ins>+        $1 = new wxString(StringValuePtr($input), wxConvUTF8); </ins><span class="cx"> } </span><span class="cx"> </span><span class="cx"> %typemap(in) const wxString& { </span><del>-        $1 = new wxString(STR2CSTR($input), wxConvUTF8); </del><ins>+        $1 = new wxString(StringValuePtr($input), wxConvUTF8); </ins><span class="cx"> } </span><span class="cx"> </span><span class="cx"> %typemap(in) wxString* { </span><del>-        $1 = new wxString(STR2CSTR($input), wxConvUTF8); </del><ins>+        $1 = new wxString(StringValuePtr($input), wxConvUTF8); </ins><span class="cx"> } </span><span class="cx"> </span><del>-%typemap(directorout) wxString, wxString& "$result = wxString(STR2CSTR($input), wxConvUTF8);"; </del><ins>+%typemap(directorout) wxString, wxString& "$result = wxString(StringValuePtr($input), wxConvUTF8);"; </ins><span class="cx"> </span><span class="cx"> %include "typemaps.i" </span><span class="cx"> </span><span class="lines">@@ -118,7 +118,7 @@ </span><span class="cx"> </span><span class="cx"> ############################################################## </span><span class="cx"> %typemap(in) const wxChar const * { </span><del>-        $1 = new wxString(STR2CSTR($input), wxConvUTF8).c_str(); </del><ins>+        $1 = new wxString(StringValuePtr($input), wxConvUTF8).c_str(); </ins><span class="cx"> } </span><span class="cx"> </span><span class="cx"> %typemap(out) wxChar const * { </span><span class="lines">@@ -235,7 +235,8 @@ </span><span class="cx"> arr = new wxString[RARRAY($input)->len]; </span><span class="cx"> for (int i = 0; i < RARRAY($input)->len; i++) </span><span class="cx"> { </span><del>- arr[i] = wxString(STR2CSTR(rb_ary_entry($input,i)), wxConvUTF8); </del><ins>+         VALUE str = rb_ary_entry($input,i); +         arr[i] = wxString(StringValuePtr(str), wxConvUTF8); </ins><span class="cx"> } </span><span class="cx"> $1 = RARRAY($input)->len; </span><span class="cx"> $2 = arr; </span><span class="lines">@@ -316,8 +317,9 @@ </span><span class="cx"> </span><span class="cx"> for (int i = 0; i < RARRAY($input)->len; i++) </span><span class="cx"> { </span><del>-                wxString item(STR2CSTR(rb_ary_entry($input,i)),wxConvUTF8); - tmp.Add(item); </del><ins>+         VALUE str = rb_ary_entry($input, i); +         wxString item(StringValuePtr(str), wxConvUTF8); +         tmp.Add(item); </ins><span class="cx"> } </span><span class="cx"> </span><span class="cx"> $1 = &tmp; </span></span></pre> </div> </div> </body> </html>