bug-5199-tkutil.diff

Nobuyoshi Nakada, 02/20/2013 12:54 PM

Download (3.83 KB)

View differences:

ext/tk/tkutil/tkutil.c
897 897
        }
898 898
    }
899 899

  
900
    rb_warning("fail to convert '%s' to string for Tk",
901
               RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0)));
900
    rb_warning("fail to convert '%+"PRIsVALUE"' to string for Tk", obj);
902 901

  
903 902
    return obj;
904 903
}
......
1247 1246

  
1248 1247
    switch(TYPE(key)) {
1249 1248
    case T_STRING:
1250
        key_id = rb_intern(RSTRING_PTR(key));
1249
        key_id = rb_intern_str(key);
1251 1250
        break;
1252 1251
    case T_SYMBOL:
1253 1252
        key_id = SYM2ID(key);
......
1259 1258

  
1260 1259
    switch(TYPE(value)) {
1261 1260
    case T_STRING:
1262
        value_id = rb_intern(RSTRING_PTR(value));
1261
        value_id = rb_intern_str(value);
1263 1262
        break;
1264 1263
    case T_SYMBOL:
1265 1264
        value_id = SYM2ID(value);
......
1299 1298
    VALUE sym;
1300 1299
{
1301 1300
    struct cbsubst_info *inf;
1302
    const char *str;
1301
    VALUE str;
1303 1302
    char *buf, *ptr;
1304 1303
    int idx;
1305 1304
    long len;
......
1312 1311
                    struct cbsubst_info, inf);
1313 1312

  
1314 1313
    if (!NIL_P(ret = rb_hash_aref(inf->aliases, sym))) {
1315
      str = rb_id2name(SYM2ID(ret));
1314
	str = rb_id2str(SYM2ID(ret));
1316 1315
    } else {
1317
      str = rb_id2name(SYM2ID(sym));
1316
	str = rb_id2str(SYM2ID(sym));
1318 1317
    }
1319 1318

  
1320
    id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));
1319
    id = rb_intern_str(rb_sprintf("@%"PRIsVALUE, str));
1321 1320

  
1322 1321
    for(idx = 0; idx < CBSUBST_TBL_MAX; idx++) {
1323 1322
      if (inf->ivar[idx] == id) break;
......
1354 1353
    VALUE self;
1355 1354
{
1356 1355
    struct cbsubst_info *inf;
1357
    const char *str;
1356
    VALUE str;
1358 1357
    char *buf, *ptr;
1359 1358
    int i, idx;
1360 1359
    long len;
......
1369 1368
    for(i = 0; i < argc; i++) {
1370 1369
        switch(TYPE(argv[i])) {
1371 1370
        case T_STRING:
1372
            str = RSTRING_PTR(argv[i]);
1373
            arg_sym = ID2SYM(rb_intern(str));
1371
            str = argv[i];
1372
            arg_sym = ID2SYM(rb_intern_str(argv[i]));
1374 1373
            break;
1375 1374
        case T_SYMBOL:
1376 1375
            arg_sym = argv[i];
1377
            str = rb_id2name(SYM2ID(arg_sym));
1376
            str = rb_id2str(SYM2ID(arg_sym));
1378 1377
            break;
1379 1378
        default:
1380 1379
            rb_raise(rb_eArgError, "arg #%d is not a String or a Symbol", i);
1381 1380
        }
1382 1381

  
1383 1382
        if (!NIL_P(ret = rb_hash_aref(inf->aliases, arg_sym))) {
1384
            str = rb_id2name(SYM2ID(ret));
1383
            str = rb_id2str(SYM2ID(ret));
1385 1384
        }
1386 1385

  
1387
        id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));
1386
        id = rb_intern_str(rb_sprintf("@%"PRIsVALUE, str));
1388 1387

  
1389 1388
	for(idx = 0; idx < CBSUBST_TBL_MAX; idx++) {
1390 1389
	  if (inf->ivar[idx] == id) break;
1391 1390
	}
1392 1391
        if (idx >= CBSUBST_TBL_MAX) {
1393
            rb_raise(rb_eArgError, "cannot find attribute :%s", str);
1392
            rb_raise(rb_eArgError, "cannot find attribute :%"PRIsVALUE, str);
1394 1393
        }
1395 1394

  
1396 1395
	*(ptr++) = '%';
......
1572 1571
    subst_inf->full_subst_length += 3;
1573 1572

  
1574 1573
    id = SYM2ID(RARRAY_PTR(inf)[2]);
1575
    subst_inf->ivar[chr] = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), rb_id2name(id))));
1574
    subst_inf->ivar[chr] = rb_intern_str(rb_sprintf("@%"PRIsVALUE, rb_id2str(id)));
1576 1575

  
1577 1576
    rb_attr(self, id, 1, 0, Qtrue);
1578 1577
  }
......
1611 1610
    subst_inf->full_subst_length += (subst_inf->keylen[chr] + 2);
1612 1611

  
1613 1612
    id = SYM2ID(RARRAY_PTR(inf)[2]);
1614
    subst_inf->ivar[chr] = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), rb_id2name(id))));
1613
    subst_inf->ivar[chr] = rb_intern_str(rb_sprintf("@%"PRIsVALUE, rb_id2str(id)));
1615 1614

  
1616 1615
    rb_attr(self, id, 1, 0, Qtrue);
1617 1616
  }