~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to ext/syck/rubyext.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-01-24 11:42:29 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20080124114229-jw2f87rdxlq6gp11
Tags: 1.9.0.0-2ubuntu1
* Merge from debian unstable, remaining changes:
  - Robustify check for target_os, fixing build failure on lpia.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * rubyext.c
4
4
 *
5
 
 * $Author: akr $
6
 
 * $Date: 2007-08-30 08:12:21 +0900 (木, 30  8月 2007) $
 
5
 * $Author: matz $
 
6
 * $Date: 2007-12-22 21:14:37 +0900 (Sat, 22 Dec 2007) $
7
7
 *
8
8
 * Copyright (C) 2003-2005 why the lucky stiff
9
9
 */
262
262
    {
263
263
        char padded[] = "000000";
264
264
        char *end = ptr + 1;
 
265
        char *p = end;
265
266
        while ( isdigit( *end ) ) end++;
266
 
        MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
267
 
        usec = strtol(padded, NULL, 10);
 
267
        if (end - p < sizeof(padded)) {
 
268
            MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
 
269
            p = padded;
 
270
        }
 
271
        usec = strtol(p, NULL, 10);
268
272
    }
269
273
    else
270
274
    {
1261
1265
        break;
1262
1266
 
1263
1267
        case syck_seq_kind:
1264
 
            rb_iv_set(obj, "@kind", sym_seq);
1265
1268
            v = rb_ary_new2( syck_seq_count( n ) );
1266
1269
            for ( i = 0; i < syck_seq_count( n ); i++ )
1267
1270
            {
1272
1275
                style = sym_inline;
1273
1276
            } 
1274
1277
            obj = rb_funcall( cSeq, s_new, 3, t, v, style );
 
1278
            rb_iv_set(obj, "@kind", sym_seq);
1275
1279
        break;
1276
1280
 
1277
1281
        case syck_map_kind:
1278
 
            rb_iv_set(obj, "@kind", sym_map);
1279
1282
            v = rb_hash_new();
1280
1283
            for ( i = 0; i < syck_map_count( n ); i++ )
1281
1284
            {
1286
1289
                style = sym_inline;
1287
1290
            } 
1288
1291
            obj = rb_funcall( cMap, s_new, 3, t, v, style );
 
1292
            rb_iv_set(obj, "@kind", sym_map);
1289
1293
        break;
1290
1294
    }
1291
1295
 
2188
2192
     */
2189
2193
    cScalar = rb_define_class_under( rb_syck, "Scalar", cNode );
2190
2194
    rb_define_alloc_func( cScalar, syck_scalar_alloc );
2191
 
    rb_define_attr( cNode, "value", 1, 0 );
2192
2195
    rb_define_method( cScalar, "initialize", syck_scalar_initialize, 3 );
2193
2196
    rb_define_method( cScalar, "value=", syck_scalar_value_set, 1 );
2194
2197
    rb_define_method( cScalar, "style=", syck_scalar_style_set, 1 );