Changeset 307

Show
Ignore:
Timestamp:
01/09/07 11:33:09 (2 years ago)
Author:
blackhedd
Message:

Modified treatment of incoming integer params to improve error reporting.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • version_0/ext/rubymain.cpp

    r296 r307  
    201201static VALUE t_connect_server (VALUE self, VALUE server, VALUE port) 
    202202{ 
    203         const char *f = evma_connect_to_server (StringValuePtr(server), FIX2INT(port)); 
     203        // Avoid FIX2INT in this case, because it doesn't deal with type errors properly. 
     204        // Specifically, if the value of port comes in as a string rather than an integer, 
     205        // NUM2INT will throw a type error, but FIX2INT will generate garbage. 
     206 
     207        const char *f = evma_connect_to_server (StringValuePtr(server), NUM2INT(port)); 
    204208        if (!f || !*f) 
    205209                rb_raise (rb_eRuntimeError, "no connection");