1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/**/*.[ch]: removed trailing spaces.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-04-22 08:04:13 +00:00
parent 36f8540a2b
commit 977267c2e0
92 changed files with 1588 additions and 1588 deletions

View file

@ -1,12 +1,12 @@
/*
*
* Ruby BigDecimal(Variable decimal precision) extension library.
* Ruby BigDecimal(Variable decimal precision) extension library.
*
* Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp)
* Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp)
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file
* of this BigDecimal distribution.
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file
* of this BigDecimal distribution.
*
* NOTES:
* 2003-03-28 V1.0 checked in.
@ -29,10 +29,10 @@ extern "C" {
#define SZ_NINF "-Infinity"
/*
* #define VP_EXPORT other than static to let VP_ routines
* #define VP_EXPORT other than static to let VP_ routines
* be called from outside of this module.
*/
#define VP_EXPORT static
#define VP_EXPORT static
#define U_LONG unsigned long
#define S_LONG long
@ -96,7 +96,7 @@ typedef struct {
U_LONG frac[1]; /* Pointer to array of fraction part. */
} Real;
/*
/*
* ------------------
* EXPORTables.
* ------------------
@ -161,7 +161,7 @@ VP_EXPORT int VpPower(Real *y,Real *x,S_INT n);
/* VP constants */
VP_EXPORT Real *VpOne(void);
/*
/*
* ------------------
* MACRO definitions.
* ------------------

View file

@ -317,7 +317,7 @@ fdbm_shift(VALUE obj)
GetDBM2(obj, dbmp, dbm);
dbmp->di_size = -1;
key = dbm_firstkey(dbm);
key = dbm_firstkey(dbm);
if (!key.dptr) return Qnil;
val = dbm_fetch(dbm, key);
keystr = rb_tainted_str_new(key.dptr, key.dsize);

View file

@ -54,7 +54,7 @@ bubblebabble_str_new(VALUE str_digest)
p[j++] = consonants[16];
p[j++] = vowels[seed / 6];
break;
}
}
byte1 = digest[i++];
p[j++] = vowels[(((byte1 >> 6) & 3) + seed) % 6];

View file

@ -7,7 +7,7 @@
* FILE: rmd160.h
*
* CONTENTS: Header file for a sample C-implementation of the
* RIPEMD-160 hash-function.
* RIPEMD-160 hash-function.
* TARGET: any computer with an ANSI C compiler
*
* AUTHOR: Antoon Bosselaers, ESAT-COSIC

View file

@ -15,7 +15,7 @@
typedef struct {
uint32_t state[5];
uint32_t count[2];
uint32_t count[2];
uint8_t buffer[64];
} SHA1_CTX;
@ -35,5 +35,5 @@ void SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20]));
#define SHA1_BLOCK_LENGTH 64
#define SHA1_DIGEST_LENGTH 20
#define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
#endif /* _SYS_SHA1_H_ */

View file

@ -27,9 +27,9 @@ void
Init_sha1()
{
VALUE mDigest, cDigest_Base, cDigest_SHA1;
rb_require("digest");
mDigest = rb_path2class("Digest");
cDigest_Base = rb_path2class("Digest::Base");

View file

@ -1,7 +1,7 @@
/*
* FILE: sha2.c
* AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/
*
*
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
@ -16,7 +16,7 @@
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -77,7 +77,7 @@
*
* And for little-endian machines, add:
*
* #define BYTE_ORDER LITTLE_ENDIAN
* #define BYTE_ORDER LITTLE_ENDIAN
*
* Or for big-endian machines:
*
@ -494,7 +494,7 @@ void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
s1 = sigma1_256(s1);
/* Apply the SHA-256 compression function to update a..h */
T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] +
T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] +
(W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);
T2 = Sigma0_256(a) + Maj(a, b, c);
h = g;

View file

@ -1,7 +1,7 @@
/*
* FILE: sha2.h
* AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/
*
*
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
@ -16,7 +16,7 @@
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -51,7 +51,7 @@ extern "C" {
#ifdef RUBY
# ifdef HAVE_PROTOTYPES
# undef NOPROTO
# undef NOPROTO
# else
# define NOPROTO
# endif /* HAVE_PROTOTYPES */
@ -61,7 +61,7 @@ extern "C" {
# ifdef WORDS_BIGENDIAN
# define BYTE_ORDER BIG_ENDIAN
# else
# define BYTE_ORDER LITTLE_ENDIAN
# define BYTE_ORDER LITTLE_ENDIAN
# endif
# endif /* BYTE_ORDER */
# define SHA2_USE_INTTYPES_H
@ -111,7 +111,7 @@ typedef unsigned long long uint64_t; /* 8-bytes (64-bits) */
*
* #include <inttypes.h>
*
* If you choose to use <inttypes.h> then please define:
* If you choose to use <inttypes.h> then please define:
*
* #define SHA2_USE_INTTYPES_H
*

View file

@ -147,12 +147,12 @@ rb_dlcfunc_initialize(int argc, VALUE argv[], VALUE self)
struct cfunc_data *data;
void *saddr;
const char *sname;
rb_scan_args(argc, argv, "13", &addr, &type, &name, &calltype);
saddr = (void*)(NUM2PTR(rb_Integer(addr)));
sname = NIL_P(name) ? NULL : StringValuePtr(name);
TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, data);
if( data->name ) xfree(data->name);
data->ptr = saddr;
@ -286,9 +286,9 @@ rb_dlcfunc_inspect(VALUE self)
char *str;
int str_size;
struct cfunc_data *cfunc;
TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
str_size = (cfunc->name ? strlen(cfunc->name) : 0) + 100;
str = ruby_xmalloc(str_size);
snprintf(str, str_size - 1,
@ -339,14 +339,14 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
memset(stack, 0, sizeof(DLSTACK_TYPE) * DLSTACK_SIZE);
Check_Type(ary, T_ARRAY);
TypedData_Get_Struct(self, struct cfunc_data, &dlcfunc_data_type, cfunc);
if( cfunc->ptr == 0 ){
rb_raise(rb_eDLError, "can't call null-function");
return Qnil;
}
for( i = 0; i < RARRAY_LEN(ary); i++ ){
if( i >= DLSTACK_SIZE ){
rb_raise(rb_eDLError, "too many arguments (stack overflow)");
@ -354,7 +354,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
rb_check_safe_obj(RARRAY_PTR(ary)[i]);
stack[i] = NUM2LONG(RARRAY_PTR(ary)[i]);
}
/* calltype == CFUNC_CDECL */
if( cfunc->calltype == CFUNC_CDECL
#ifndef FUNC_STDCALL

View file

@ -104,7 +104,7 @@ rb_dlptr2cptr(VALUE val)
else{
rb_raise(rb_eTypeError, "DL::PtrData was expected");
}
return ptr;
}

View file

@ -133,7 +133,7 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj)
pwd = getpwuid(uid);
if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %d", (int)uid);
return setup_passwd(pwd);
#else
#else
return Qnil;
#endif
}
@ -156,7 +156,7 @@ etc_getpwnam(VALUE obj, VALUE nam)
pwd = getpwnam(RSTRING_PTR(nam));
if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %s", RSTRING_PTR(nam));
return setup_passwd(pwd);
#else
#else
return Qnil;
#endif
}
@ -194,10 +194,10 @@ each_passwd(void)
}
#endif
/* Provides a convenient Ruby iterator which executes a block for each entry
/* Provides a convenient Ruby iterator which executes a block for each entry
* in the /etc/passwd file.
*
* The code block is passed an Struct::Passwd struct; see getpwent above for
* The code block is passed an Struct::Passwd struct; see getpwent above for
* details.
*
* Example:
@ -229,7 +229,7 @@ etc_passwd(VALUE obj)
/* Iterates for each entry in the /etc/passwd file if a block is given.
* If no block is given, returns the enumerator.
*
* The code block is passed an Struct::Passwd struct; see getpwent above for
* The code block is passed an Struct::Passwd struct; see getpwent above for
* details.
*
* Example:
@ -279,7 +279,7 @@ etc_endpwent(VALUE obj)
}
/* Returns an entry from the /etc/passwd file. The first time it is called it
* opens the file and returns the first entry; each successive call returns
* opens the file and returns the first entry; each successive call returns
* the next entry, or nil if the end of the file has been reached.
*
* To close the file when processing is complete, call endpwent.
@ -296,8 +296,8 @@ etc_endpwent(VALUE obj)
*
* - Passwd#gid contains the integer group ID (gid) of the user's primary group.
*
* - Passwd#gecos contains a longer String description of the user, such as
* a full name. Some Unix systems provide structured information in the
* - Passwd#gecos contains a longer String description of the user, such as
* a full name. Some Unix systems provide structured information in the
* gecos field, but this is system-dependent.
*
* - Passwd#dir contains the path to the home directory of the user as a String.
@ -340,7 +340,7 @@ setup_group(struct group *grp)
}
#endif
/* Returns information about the group with specified integer group id (gid),
/* Returns information about the group with specified integer group id (gid),
* as found in /etc/group.
*
* The information is returned as a Struct::Group; see getgrent above for
@ -373,7 +373,7 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj)
#endif
}
/* Returns information about the group with specified String name, as found
/* Returns information about the group with specified String name, as found
* in /etc/group.
*
* The information is returned as a Struct::Group; see getgrent above for
@ -432,10 +432,10 @@ each_group(void)
}
#endif
/* Provides a convenient Ruby iterator which executes a block for each entry
/* Provides a convenient Ruby iterator which executes a block for each entry
* in the /etc/group file.
*
* The code block is passed an Struct::Group struct; see getgrent above for
* The code block is passed an Struct::Group struct; see getgrent above for
* details.
*
* Example:
@ -468,7 +468,7 @@ etc_group(VALUE obj)
/* Iterates for each entry in the /etc/group file if a block is given.
* If no block is given, returns the enumerator.
*
* The code block is passed an Struct::Group struct; see getpwent above for
* The code block is passed an Struct::Group struct; see getpwent above for
* details.
*
* Example:
@ -504,7 +504,7 @@ etc_setgrent(VALUE obj)
return Qnil;
}
/* Ends the process of scanning through the /etc/group file begun by
/* Ends the process of scanning through the /etc/group file begun by
* getgrent, and closes the file.
*/
static VALUE
@ -517,7 +517,7 @@ etc_endgrent(VALUE obj)
}
/* Returns an entry from the /etc/group file. The first time it is called it
* opens the file and returns the first entry; each successive call returns
* opens the file and returns the first entry; each successive call returns
* the next entry, or nil if the end of the file has been reached.
*
* To close the file when processing is complete, call endgrent.
@ -527,13 +527,13 @@ etc_endgrent(VALUE obj)
* - Group#name contains the name of the group as a String.
*
* - Group#passwd contains the encrypted password as a String. An 'x' is
* returned if password access to the group is not available; an empty
* string is returned if no password is needed to obtain membership of
* returned if password access to the group is not available; an empty
* string is returned if no password is needed to obtain membership of
* the group.
*
* - Group#gid contains the group's numeric ID as an integer.
*
* - Group#mem is an Array of Strings containing the short login names of the
* - Group#mem is an Array of Strings containing the short login names of the
* members of the group.
*/
static VALUE

View file

@ -42,7 +42,7 @@ pack up your own arguments to pass as args for locking functions, etc.
* Documented by mathew <meta@pobox.com>
*
* = Usage
*
*
* To perform a fcntl(2) operation, use IO::fcntl in the core classes.
*
* To perform an open(2) operation, use IO::sysopen.
@ -99,10 +99,10 @@ pack up your own arguments to pass as args for locking functions, etc.
* - O_ACCMODE - mask to extract read/write flags.
*
* Example:
*
*
* require 'fcntl'
*
* fd = IO::sysopen('/tmp/tempfile',
* fd = IO::sysopen('/tmp/tempfile',
* Fcntl::O_WRONLY | Fcntl::O_EXCL | Fcntl::O_CREAT)
* f = IO.open(fd)
* f.syswrite("TEMP DATA")

View file

@ -44,7 +44,7 @@
* 1. Opening/creating a database, and filling it with some entries:
*
* require 'gdbm'
*
*
* gdbm = GDBM.new("fruitstore.db")
* gdbm["ananas"] = "3"
* gdbm["banana"] = "8"
@ -54,7 +54,7 @@
* 2. Reading out a database:
*
* require 'gdbm'
*
*
* gdbm = GDBM.new("fruitstore.db")
* gdbm.each_pair do |key, value|
* print "#{key}: #{value}\n"
@ -206,19 +206,19 @@ fgdbm_initialize(int argc, VALUE *argv, VALUE obj)
if (flags & RUBY_GDBM_RW_BIT) {
flags &= ~RUBY_GDBM_RW_BIT;
dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE,
dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE,
flags, mode, MY_FATAL_FUNC);
}
else {
dbm = 0;
if (mode >= 0)
dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE,
dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE,
GDBM_WRCREAT|flags, mode, MY_FATAL_FUNC);
if (!dbm)
dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE,
dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE,
GDBM_WRITER|flags, 0, MY_FATAL_FUNC);
if (!dbm)
dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE,
dbm = gdbm_open(RSTRING_PTR(file), MY_BLOCK_SIZE,
GDBM_READER|flags, 0, MY_FATAL_FUNC);
}
@ -537,7 +537,7 @@ fgdbm_delete(VALUE obj, VALUE keystr)
* call-seq:
* gdbm.shift -> (key, value) or nil
*
* Removes a key-value-pair from this database and returns it as a
* Removes a key-value-pair from this database and returns it as a
* two-item array [ _key_, _value_ ]. Returns nil if the database is empty.
*/
static VALUE
@ -619,7 +619,7 @@ fgdbm_clear(VALUE obj)
free(key.dptr);
rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
}
free(key.dptr);
free(key.dptr);
}
#else
while (key = gdbm_firstkey(dbm), key.dptr) {

View file

@ -26,20 +26,20 @@
* == Summary
*
* Ruby extension for charset conversion.
*
*
* == Abstract
*
* Iconv is a wrapper class for the UNIX 95 <tt>iconv()</tt> function family,
* which translates string between various encoding systems.
*
*
* See Open Group's on-line documents for more details.
* * <tt>iconv.h</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.h.html
* * <tt>iconv_open()</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv_open.html
* * <tt>iconv()</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html
* * <tt>iconv_close()</tt>: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv_close.html
*
*
* Which coding systems are available is platform-dependent.
*
*
* == Examples
*
* 1. Simple conversion between two charsets.
@ -622,7 +622,7 @@ get_iconv_opt(struct rb_iconv_opt_t *opt, VALUE options)
*
* Creates new code converter from a coding-system designated with +from+
* to another one designated with +to+.
*
*
* === Parameters
*
* +to+:: encoding name for destination
@ -1104,7 +1104,7 @@ iconv_failure_success(VALUE self)
* call-seq: failed
*
* Returns substring of the original string passed to Iconv that starts at the
* character caused the exception.
* character caused the exception.
*/
static VALUE
iconv_failure_failed(VALUE self)
@ -1134,13 +1134,13 @@ iconv_failure_inspect(VALUE self)
/*
* Document-class: Iconv::InvalidEncoding
*
*
* Requested coding-system is not available on this system.
*/
/*
* Document-class: Iconv::IllegalSequence
*
*
* Input conversion stopped due to an input byte that does not belong to
* the input codeset, or the output codeset does not contain the
* character.
@ -1148,20 +1148,20 @@ iconv_failure_inspect(VALUE self)
/*
* Document-class: Iconv::InvalidCharacter
*
*
* Input conversion stopped due to an incomplete character or shift
* sequence at the end of the input buffer.
*/
/*
* Document-class: Iconv::OutOfRange
*
*
* Iconv library internal error. Must not occur.
*/
/*
* Document-class: Iconv::BrokenLibrary
*
*
* Detected a bug of underlying iconv(3) libray.
* * returns an error without setting errno properly
*/

View file

@ -62,7 +62,7 @@ typedef struct JSON_Generator_StateStruct {
JSON_Generator_State *state; \
Data_Get_Struct(self, JSON_Generator_State, state);
/*
/*
* Document-module: JSON::Ext::Generator
*
* This is the JSON generator implemented as a C extension. It can be
@ -459,7 +459,7 @@ static VALUE mObject_to_json(int argc, VALUE *argv, VALUE self)
return result;
}
/*
/*
* Document-class: JSON::Ext::Generator::State
*
* This class is used to create State instances, that are use to hold data
@ -586,7 +586,7 @@ static VALUE cState_to_h(VALUE self)
* * *indent*: a string used to indent levels (default: ''),
* * *space*: a string that is put after, a : or , delimiter (default: ''),
* * *space_before*: a string that is put before a : pair delimiter (default: ''),
* * *object_nl*: a string that is put at the end of a JSON object (default: ''),
* * *object_nl*: a string that is put at the end of a JSON object (default: ''),
* * *array_nl*: a string that is put at the end of a JSON array (default: ''),
* * *check_circular*: true if checking for circular data structures
* should be done, false (the default) otherwise.
@ -808,7 +808,7 @@ static VALUE cState_allow_nan_p(VALUE self)
/*
* call-seq: seen?(object)
*
* Returns _true_, if _object_ was already seen during this generating run.
* Returns _true_, if _object_ was already seen during this generating run.
*/
static VALUE cState_seen_p(VALUE self, VALUE object)
{
@ -820,7 +820,7 @@ static VALUE cState_seen_p(VALUE self, VALUE object)
* call-seq: remember(object)
*
* Remember _object_, to find out if it was already encountered (if a cyclic
* data structure is rendered).
* data structure is rendered).
*/
static VALUE cState_remember(VALUE self, VALUE object)
{

View file

@ -6,9 +6,9 @@
/*
* Copyright 2001-2004 Unicode, Inc.
*
*
* Disclaimer
*
*
* This source code is provided as is by Unicode, Inc. No claims are
* made as to fitness for any particular purpose. No warranties of any
* kind are expressed or implied. The recipient agrees to determine
@ -16,9 +16,9 @@
* purchased on magnetic or optical media from Unicode, Inc., the
* sole remedy for any claim will be exchange of defective media
* within 90 days of receipt.
*
*
* Limitations on Rights to Redistribute This Code
*
*
* Unicode, Inc. hereby grants the right to freely use the information
* supplied in this file in the creation of products supporting the
* Unicode Standard, and to make copies of this file in any form
@ -49,7 +49,7 @@ static const char trailingBytesForUTF8[256] = {
* This table contains as many values as there might be trailing bytes
* in a UTF-8 sequence.
*/
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL };
/*

View file

@ -29,7 +29,7 @@ static VALUE mJSON, mExt, cParser, eParserError, eNestingError;
static VALUE CNaN, CInfinity, CMinusInfinity;
static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
i_chr, i_max_nesting, i_allow_nan, i_object_class, i_array_class;
i_chr, i_max_nesting, i_allow_nan, i_object_class, i_array_class;
#define MinusInfinity "-Infinity"
@ -201,7 +201,7 @@ tr11:
#line 92 "parser.rl"
{
VALUE v = Qnil;
char *np = JSON_parse_value(json, p, pe, &v);
char *np = JSON_parse_value(json, p, pe, &v);
if (np == NULL) {
p--; {p++; cs = 9; goto _out;}
} else {
@ -503,7 +503,7 @@ tr2:
goto st21;
tr5:
#line 202 "parser.rl"
{
{
char *np;
json->current_nesting++;
np = JSON_parse_array(json, p, pe, result);
@ -513,7 +513,7 @@ tr5:
goto st21;
tr9:
#line 210 "parser.rl"
{
{
char *np;
json->current_nesting++;
np = JSON_parse_object(json, p, pe, result);
@ -1066,7 +1066,7 @@ tr2:
#line 312 "parser.rl"
{
VALUE v = Qnil;
char *np = JSON_parse_value(json, p, pe, &v);
char *np = JSON_parse_value(json, p, pe, &v);
if (np == NULL) {
p--; {p++; cs = 3; goto _out;}
} else {
@ -1286,7 +1286,7 @@ static VALUE json_string_unescape(char *p, char *pe)
p++;
break;
case 'u':
if (p > pe - 4) {
if (p > pe - 4) {
return Qnil;
} else {
p = JSON_convert_UTF16_to_UTF8(result, p, pe, strictConversion);
@ -1474,7 +1474,7 @@ static const int JSON_en_main = 1;
#line 473 "parser.rl"
/*
/*
* Document-class: JSON::Ext::Parser
*
* This is the JSON parser implemented as a C extension. It can be configured

View file

@ -27,7 +27,7 @@ static VALUE mJSON, mExt, cParser, eParserError, eNestingError;
static VALUE CNaN, CInfinity, CMinusInfinity;
static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
i_chr, i_max_nesting, i_allow_nan, i_object_class, i_array_class;
i_chr, i_max_nesting, i_allow_nan, i_object_class, i_array_class;
#define MinusInfinity "-Infinity"
@ -91,7 +91,7 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
action parse_value {
VALUE v = Qnil;
char *np = JSON_parse_value(json, fpc, pe, &v);
char *np = JSON_parse_value(json, fpc, pe, &v);
if (np == NULL) {
fhold; fbreak;
} else {
@ -199,7 +199,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
fhold; fbreak;
}
action parse_array {
action parse_array {
char *np;
json->current_nesting++;
np = JSON_parse_array(json, fpc, pe, result);
@ -207,7 +207,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
if (np == NULL) { fhold; fbreak; } else fexec np;
}
action parse_object {
action parse_object {
char *np;
json->current_nesting++;
np = JSON_parse_object(json, fpc, pe, result);
@ -311,7 +311,7 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
action parse_value {
VALUE v = Qnil;
char *np = JSON_parse_value(json, fpc, pe, &v);
char *np = JSON_parse_value(json, fpc, pe, &v);
if (np == NULL) {
fhold; fbreak;
} else {
@ -385,7 +385,7 @@ static VALUE json_string_unescape(char *p, char *pe)
p++;
break;
case 'u':
if (p > pe - 4) {
if (p > pe - 4) {
return Qnil;
} else {
p = JSON_convert_UTF16_to_UTF8(result, p, pe, strictConversion);
@ -472,7 +472,7 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
) ignore*;
}%%
/*
/*
* Document-class: JSON::Ext::Parser
*
* This is the JSON parser implemented as a C extension. It can be configured

View file

@ -2,9 +2,9 @@
/*
* Copyright 2001-2004 Unicode, Inc.
*
*
* Disclaimer
*
*
* This source code is provided as is by Unicode, Inc. No claims are
* made as to fitness for any particular purpose. No warranties of any
* kind are expressed or implied. The recipient agrees to determine
@ -12,9 +12,9 @@
* purchased on magnetic or optical media from Unicode, Inc., the
* sole remedy for any claim will be exchange of defective media
* within 90 days of receipt.
*
*
* Limitations on Rights to Redistribute This Code
*
*
* Unicode, Inc. hereby grants the right to freely use the information
* supplied in this file in the creation of products supporting the
* Unicode Standard, and to make copies of this file in any form
@ -45,7 +45,7 @@ static const char trailingBytesForUTF8[256] = {
* This table contains as many values as there might be trailing bytes
* in a UTF-8 sequence.
*/
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL };
/*
@ -89,7 +89,7 @@ char *JSON_convert_UTF16_to_UTF8 (
UTF32 ch;
unsigned short bytesToWrite = 0;
const UTF32 byteMask = 0xBF;
const UTF32 byteMark = 0x80;
const UTF32 byteMark = 0x80;
ch = *tmpPtr++;
/* If we have a surrogate pair, convert to UTF32 first. */
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {

View file

@ -39,7 +39,7 @@
/*
* Select Default Output Encoding
*
*
*/
/* #define DEFAULT_CODE_JIS */

View file

@ -820,7 +820,7 @@ nkf_buf_new(int length)
buf->capa = length;
buf->len = 0;
return buf;
}
}
#if 0
static void
@ -5870,7 +5870,7 @@ finished:
/*
* int options(unsigned char *cp)
*
*
* return values:
* 0: success
* -1: ArgumentError

View file

@ -1,7 +1,7 @@
/*
*
*
* nkf.h - Header file for nkf
*
*
* $Id$
*/

View file

@ -203,7 +203,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
/*
* NKF - Ruby extension for Network Kanji Filter
* NKF - Ruby extension for Network Kanji Filter
*
* == Description
*
@ -341,7 +341,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
* To see ISO8859-1 (Latin-1) -l is necessary.
*
* [-mB] Decode MIME base64 encoded stream. Remove header or other part before
* conversion.
* conversion.
*
* [-mQ] Decode MIME quoted stream. '_' in quoted stream is converted to space.
*

View file

@ -15,7 +15,7 @@
/* objspace library extends ObjectSpace module and add several
* methods to get internal statistic information about
* object/memory management.
*
*
* Generally, you *SHOULD NOT*use this library if you do not know
* about the MRI implementation. Mainly, this library is for (memory)
* profiler developers and MRI developers who need to know how MRI
@ -203,7 +203,7 @@ cos_i(void *vstart, void *vend, size_t stride, void *data)
*
* It returns a hash as:
* {:TOTAL=>1461154, :T_CLASS=>158280, :T_MODULE=>20672, :T_STRING=>527249, ...}
*
*
* If the optional argument, result_hash, is given,
* it is overwritten and returned.
* This is intended to avoid probe effect.
@ -532,7 +532,7 @@ count_tdata_objects(int argc, VALUE *argv, VALUE self)
/* objspace library extends ObjectSpace module and add several
* methods to get internal statistic information about
* object/memory management.
*
*
* Generally, you *SHOULD NOT*use this library if you do not know
* about the MRI implementation. Mainly, this library is for (memory)
* profiler developers and MRI developers who need to know how MRI

View file

@ -41,7 +41,7 @@ int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data)
{
return CRYPTO_set_ex_data(&str->ex_data, idx, data);
}
void *X509_STORE_get_ex_data(X509_STORE *str, int idx)
{
return CRYPTO_get_ex_data(&str->ex_data, idx);
@ -111,7 +111,7 @@ HMAC_CTX_cleanup(HMAC_CTX *ctx)
#endif
#if !defined(HAVE_EVP_CIPHER_CTX_COPY)
/*
/*
* this function does not exist in OpenSSL yet... or ever?.
* a future version may break this function.
* tested on 0.9.7d.
@ -180,12 +180,12 @@ OSSL_X509_REVOKED_cmp(const X509_REVOKED * const *a, const X509_REVOKED * const
(ASN1_STRING *)(*a)->serialNumber,
(ASN1_STRING *)(*b)->serialNumber));
}
int
X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev)
{
X509_CRL_INFO *inf;
inf = crl->crl;
if (!inf->revoked)
inf->revoked = sk_X509_REVOKED_new(OSSL_X509_REVOKED_cmp);
@ -313,7 +313,7 @@ PEM_def_callback(char *buf, int num, int w, void *key)
{
int i,j;
const char *prompt;
if (key) {
i = strlen(key);
i = (i > num) ? num : i;

View file

@ -48,7 +48,7 @@ string2hex(const unsigned char *buf, int buf_len, char **hexbuf, int *hexbuf_len
* Data Conversion
*/
STACK_OF(X509) *
ossl_x509_ary2sk0(VALUE ary)
ossl_x509_ary2sk0(VALUE ary)
{
STACK_OF(X509) *sk;
VALUE val;
@ -57,13 +57,13 @@ ossl_x509_ary2sk0(VALUE ary)
Check_Type(ary, T_ARRAY);
sk = sk_X509_new_null();
if (!sk) ossl_raise(eOSSLError, NULL);
if (!sk) ossl_raise(eOSSLError, NULL);
for (i = 0; i < RARRAY_LEN(ary); i++) {
val = rb_ary_entry(ary, i);
if (!rb_obj_is_kind_of(val, cX509Cert)) {
sk_X509_pop_free(sk, X509_free);
ossl_raise(eOSSLError, "object not X509 cert in array");
ossl_raise(eOSSLError, "object not X509 cert in array");
}
x509 = DupX509CertPtr(val); /* NEED TO DUP */
sk_X509_push(sk, x509);
@ -157,7 +157,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
{
int len, status = 0;
VALUE rflag, pass;
if (pwd || !rb_block_given_p())
return PEM_def_callback(buf, max_len, flag, pwd);
@ -192,12 +192,12 @@ int ossl_verify_cb_idx;
VALUE
ossl_call_verify_cb_proc(struct ossl_verify_cb_args *args)
{
{
return rb_funcall(args->proc, rb_intern("call"), 2,
args->preverify_ok, args->store_ctx);
}
int
int
ossl_verify_cb(int ok, X509_STORE_CTX *ctx)
{
VALUE proc, rctx, ret;

View file

@ -27,7 +27,7 @@ asn1time_to_time(ASN1_TIME *time)
{
struct tm tm;
VALUE argv[6];
if (!time || !time->data) return Qnil;
memset(&tm, 0, sizeof(struct tm));
@ -36,7 +36,7 @@ asn1time_to_time(ASN1_TIME *time)
if (sscanf((const char *)time->data, "%2d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
&tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
ossl_raise(rb_eTypeError, "bad UTCTIME format");
}
}
if (tm.tm_year < 69) {
tm.tm_year += 2000;
} else {
@ -47,7 +47,7 @@ asn1time_to_time(ASN1_TIME *time)
if (sscanf((const char *)time->data, "%4d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
&tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format" );
}
}
break;
default:
rb_warning("unknown time format");
@ -144,7 +144,7 @@ ASN1_INTEGER *
num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai)
{
BIGNUM *bn = GetBNPtr(obj);
if (!(ai = BN_to_ASN1_INTEGER(bn, ai))) {
ossl_raise(eOSSLError, NULL);
}
@ -321,7 +321,7 @@ decode_int(unsigned char* der, int length)
{
ASN1_INTEGER *ai;
const unsigned char *p;
VALUE ret;
VALUE ret;
int status = 0;
p = der;
@ -361,7 +361,7 @@ decode_enum(unsigned char* der, int length)
{
ASN1_ENUMERATED *ai;
const unsigned char *p;
VALUE ret;
VALUE ret;
int status = 0;
p = der;
@ -524,7 +524,7 @@ ossl_asn1_get_asn1type(VALUE obj)
case V_ASN1_ISO64STRING: /* FALLTHROUGH */
case V_ASN1_GENERALSTRING: /* FALLTHROUGH */
case V_ASN1_UNIVERSALSTRING: /* FALLTHROUGH */
case V_ASN1_BMPSTRING:
case V_ASN1_BMPSTRING:
ptr = obj_to_asn1str(value);
free_func = ASN1_STRING_free;
break;
@ -660,8 +660,8 @@ ossl_asn1data_initialize(VALUE self, VALUE value, VALUE tag, VALUE tag_class)
return self;
}
static VALUE
join_der_i(VALUE i, VALUE str)
static VALUE
join_der_i(VALUE i, VALUE str)
{
i = ossl_to_der_if_possible(i);
StringValue(i);
@ -737,7 +737,7 @@ ossl_asn1_decode0(unsigned char **pp, long length, long *offset, long depth,
rb_yield(arg);
}
length -= hlen;
off += hlen;
off += hlen;
if(len > length) ossl_raise(eASN1Error, "value is too short");
if((tc & V_ASN1_PRIVATE) == V_ASN1_PRIVATE)
tag_class = sPRIVATE;

View file

@ -32,12 +32,12 @@ ASN1_INTEGER *num_to_asn1integer(VALUE, ASN1_INTEGER *);
* ASN1 module
*/
extern VALUE mASN1;
extern VALUE eASN1Error;
extern VALUE eASN1Error;
extern VALUE cASN1Data;
extern VALUE cASN1Primitive;
extern VALUE cASN1Constructive;
extern VALUE cASN1Boolean; /* BOOLEAN */
extern VALUE cASN1Integer, cASN1Enumerated; /* INTEGER */
extern VALUE cASN1BitString; /* BIT STRING */

View file

@ -72,7 +72,7 @@ ossl_protect_membio2str(BIO *bio, int *status)
return rb_protect((VALUE(*)_((VALUE)))ossl_membio2str0, (VALUE)bio, status);
}
VALUE
VALUE
ossl_membio2str(BIO *bio)
{
VALUE ret;

View file

@ -380,7 +380,7 @@ ossl_bn_div(VALUE self, VALUE other)
}
WrapBN(CLASS_OF(self), obj1, r1);
WrapBN(CLASS_OF(self), obj2, r2);
return rb_ary_new3(2, obj1, obj2);
}
@ -591,7 +591,7 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
ossl_raise(eBNError, NULL);
}
WrapBN(klass, obj, result);
return obj;
}
@ -615,14 +615,14 @@ static VALUE
ossl_bn_copy(VALUE self, VALUE other)
{
BIGNUM *bn1, *bn2;
rb_check_frozen(self);
if (self == other) return self;
GetBN(self, bn1);
bn2 = GetBNPtr(other);
if (!BN_copy(bn1, bn2)) {
ossl_raise(eBNError, NULL);
}
@ -793,7 +793,7 @@ Init_ossl_bn()
* value_one - DON'T IMPL.
* set_word
* get_word */
rb_define_singleton_method(cBN, "rand", ossl_bn_s_rand, -1);
rb_define_singleton_method(cBN, "pseudo_rand", ossl_bn_s_pseudo_rand, -1);
rb_define_singleton_method(cBN, "rand_range", ossl_bn_s_rand_range, 1);

View file

@ -287,7 +287,7 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
digest = NIL_P(vdigest) ? EVP_md5() : GetDigestPtr(vdigest);
GetCipher(self, ctx);
EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), digest, salt,
(unsigned char *)RSTRING_PTR(vpass), RSTRING_LEN(vpass), iter, key, iv);
(unsigned char *)RSTRING_PTR(vpass), RSTRING_LEN(vpass), iter, key, iv);
if (EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, -1) != 1)
ossl_raise(eCipherError, NULL);
OPENSSL_cleanse(key, sizeof key);
@ -305,7 +305,7 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
* +data+ is a nonempty string.
* +buffer+ is an optional string to store the result.
*/
static VALUE
static VALUE
ossl_cipher_update(int argc, VALUE *argv, VALUE self)
{
EVP_CIPHER_CTX *ctx;
@ -345,7 +345,7 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self)
*
* See EVP_CipherFinal_ex for further information.
*/
static VALUE
static VALUE
ossl_cipher_final(VALUE self)
{
EVP_CIPHER_CTX *ctx;
@ -445,7 +445,7 @@ ossl_cipher_set_key_length(VALUE self, VALUE key_length)
{
int len = NUM2INT(key_length);
EVP_CIPHER_CTX *ctx;
GetCipher(self, ctx);
if (EVP_CIPHER_CTX_set_key_length(ctx, len) != 1)
ossl_raise(eCipherError, NULL);
@ -515,7 +515,7 @@ static VALUE ossl_cipher_block_size() { }
/*
* INIT
*/
void
void
Init_ossl_cipher(void)
{
#if 0 /* let rdoc know about mOSSL */

View file

@ -33,8 +33,8 @@
VALUE cConfig;
VALUE eConfigError;
/*
* Public
/*
* Public
*/
static CONF *parse_config(VALUE, CONF*);
@ -154,7 +154,7 @@ ossl_config_initialize(int argc, VALUE *argv, VALUE self)
_CONF_new_data(conf);
}
#endif
return self;
}
@ -187,7 +187,7 @@ ossl_config_add_value(VALUE self, VALUE section, VALUE name, VALUE value)
OPENSSL_free(cv);
ossl_raise(eConfigError, "_CONF_add_string failure");
}
return value;
#endif
}
@ -233,7 +233,7 @@ static VALUE
ossl_config_get_value_old(int argc, VALUE *argv, VALUE self)
{
VALUE section, name;
rb_scan_args(argc, argv, "11", &section, &name);
/* support conf.value(nil, "HOME") -> conf.get_value("", "HOME") */

View file

@ -56,14 +56,14 @@ GetDigestPtr(VALUE obj)
VALUE
ossl_digest_new(const EVP_MD *md)
{
{
VALUE ret;
EVP_MD_CTX *ctx;
ret = ossl_digest_alloc(cDigest);
GetDigest(ret, ctx);
EVP_DigestInit_ex(ctx, md, NULL);
return ret;
}
@ -104,7 +104,7 @@ ossl_digest_initialize(int argc, VALUE *argv, VALUE self)
GetDigest(self, ctx);
EVP_DigestInit_ex(ctx, md, NULL);
if (!NIL_P(data)) return ossl_digest_update(self, data);
return self;
}
@ -113,7 +113,7 @@ static VALUE
ossl_digest_copy(VALUE self, VALUE other)
{
EVP_MD_CTX *ctx1, *ctx2;
rb_check_frozen(self);
if (self == other) return self;

View file

@ -29,7 +29,7 @@
GetPKCS7(obj, engine); \
} while (0)
/*
/*
* Classes
*/
VALUE cEngine;
@ -327,7 +327,7 @@ ossl_engine_inspect(VALUE self)
{
VALUE str;
const char *cname = rb_class2name(rb_obj_class(self));
str = rb_str_new2("#<");
rb_str_cat2(str, cname);
rb_str_cat2(str, " id=\"");

View file

@ -80,7 +80,7 @@ static VALUE
ossl_hmac_copy(VALUE self, VALUE other)
{
HMAC_CTX *ctx1, *ctx2;
rb_check_frozen(self);
if (self == other) return self;
@ -139,7 +139,7 @@ ossl_hmac_digest(VALUE self)
GetHMAC(self, ctx);
hmac_final(ctx, &buf, &buf_len);
digest = ossl_buf2str((char *)buf, buf_len);
return digest;
}
@ -247,7 +247,7 @@ Init_ossl_hmac()
rb_define_alloc_func(cHMAC, ossl_hmac_alloc);
rb_define_singleton_method(cHMAC, "digest", ossl_hmac_s_digest, 3);
rb_define_singleton_method(cHMAC, "hexdigest", ossl_hmac_s_hexdigest, 3);
rb_define_method(cHMAC, "initialize", ossl_hmac_initialize, 2);
rb_define_copy_func(cHMAC, ossl_hmac_copy);

View file

@ -91,7 +91,7 @@ ossl_spki_to_der(VALUE self)
if (i2d_NETSCAPE_SPKI(spki, &p) <= 0)
ossl_raise(eX509CertError, NULL);
ossl_str_adjust(str, p);
return str;
}
@ -187,7 +187,7 @@ ossl_spki_set_challenge(VALUE self, VALUE str)
RSTRING_LEN(str))) {
ossl_raise(eSPKIError, NULL);
}
return str;
}

View file

@ -558,7 +558,7 @@ ossl_ocspbres_get_status(VALUE self)
}
return ret;
}
}
static VALUE
ossl_ocspbres_sign(int argc, VALUE *argv, VALUE self)

View file

@ -81,7 +81,7 @@ ossl_pkcs12_s_create(int argc, VALUE *argv, VALUE self)
STACK_OF(X509) *x509s;
int nkey = 0, ncert = 0, kiter = 0, miter = 0, ktype = 0;
PKCS12 *p12;
rb_scan_args(argc, argv, "46", &pass, &name, &pkey, &cert, &ca, &key_nid, &cert_nid, &key_iter, &mac_iter, &keytype);
passphrase = NIL_P(pass) ? NULL : StringValuePtr(pass);
friendlyname = NIL_P(name) ? NULL : StringValuePtr(name);

View file

@ -68,7 +68,7 @@
#define ossl_pkcs7_set_err_string(o,v) rb_iv_set((o), "@error_string", (v))
#define ossl_pkcs7_get_err_string(o) rb_iv_get((o), "@error_string")
/*
/*
* Classes
*/
VALUE cPKCS7;
@ -295,7 +295,7 @@ ossl_pkcs7_alloc(VALUE klass)
ossl_raise(ePKCS7Error, NULL);
}
WrapPKCS7(klass, obj, pkcs7);
return obj;
}
@ -495,7 +495,7 @@ ossl_pkcs7_get_signer(VALUE self)
PKCS7_SIGNER_INFO *si;
int num, i;
VALUE ary;
GetPKCS7(self, pkcs7);
if (!(sk = PKCS7_get_signer_info(pkcs7))) {
OSSL_Debug("OpenSSL::PKCS7#get_signer_info == NULL!");
@ -537,7 +537,7 @@ ossl_pkcs7_get_recipient(VALUE self)
PKCS7_RECIP_INFO *si;
int num, i;
VALUE ary;
GetPKCS7(self, pkcs7);
if (PKCS7_type_is_enveloped(pkcs7))
sk = pkcs7->d.enveloped->recipientinfo;
@ -777,7 +777,7 @@ ossl_pkcs7_add_data(VALUE self, VALUE data)
}
if(!PKCS7_dataFinal(pkcs7, out)) goto err;
ossl_pkcs7_set_data(self, Qnil);
err:
BIO_free(out);
BIO_free(in);
@ -1021,10 +1021,10 @@ Init_ossl_pkcs7()
cPKCS7Recipient = rb_define_class_under(cPKCS7,"RecipientInfo",rb_cObject);
rb_define_alloc_func(cPKCS7Recipient, ossl_pkcs7ri_alloc);
rb_define_method(cPKCS7Recipient, "initialize", ossl_pkcs7ri_initialize,1);
rb_define_method(cPKCS7Recipient, "initialize", ossl_pkcs7ri_initialize,1);
rb_define_method(cPKCS7Recipient, "issuer", ossl_pkcs7ri_get_issuer,0);
rb_define_method(cPKCS7Recipient, "serial", ossl_pkcs7ri_get_serial,0);
rb_define_method(cPKCS7Recipient, "enc_key", ossl_pkcs7ri_get_enc_key,0);
rb_define_method(cPKCS7Recipient, "enc_key", ossl_pkcs7ri_get_enc_key,0);
#define DefPKCS7Const(x) rb_define_const(cPKCS7, #x, INT2NUM(PKCS7_##x))

View file

@ -214,7 +214,7 @@ Init_ossl_pkey()
#if 0 /* let rdoc know about mOSSL */
mOSSL = rb_define_module("OpenSSL");
#endif
mPKey = rb_define_module_under(mOSSL, "PKey");
ePKeyError = rb_define_class_under(mPKey, "PKeyError", eOSSLError);

View file

@ -85,7 +85,7 @@ static DH *
dh_generate(int size, int gen)
{
DH *dh;
dh = DH_generate_parameters(size, gen,
rb_block_given_p() ? ossl_generate_cb : NULL,
NULL);
@ -244,7 +244,7 @@ ossl_dh_export(VALUE self)
*/
static VALUE
ossl_dh_to_der(VALUE self)
{
{
EVP_PKEY *pkey;
unsigned char *p;
long len;
@ -284,7 +284,7 @@ ossl_dh_get_params(VALUE self)
rb_hash_aset(hash, rb_str_new2("g"), ossl_bn_new(pkey->pkey.dh->g));
rb_hash_aset(hash, rb_str_new2("pub_key"), ossl_bn_new(pkey->pkey.dh->pub_key));
rb_hash_aset(hash, rb_str_new2("priv_key"), ossl_bn_new(pkey->pkey.dh->priv_key));
return hash;
}
@ -351,7 +351,7 @@ ossl_dh_check_params(VALUE self)
DH *dh;
EVP_PKEY *pkey;
int codes;
GetPKeyDH(self, pkey);
dh = pkey->pkey.dh;
@ -436,10 +436,10 @@ static unsigned char DEFAULT_DH_512_PRIM[] = {
0x08, 0x04, 0x8c, 0x52, 0x8f, 0xe3, 0x4a, 0x31,
0x44, 0x47, 0x19, 0xa1, 0x4a, 0xc8, 0x8b, 0xcb,
};
static unsigned char DEFAULT_DH_512_GEN[] = { 0x02 };
static unsigned char DEFAULT_DH_512_GEN[] = { 0x02 };
DH *OSSL_DEFAULT_DH_512 = NULL;
/*
/*
* -----BEGIN DH PARAMETERS-----
* MIGHAoGBAJ0lOVy0VIr/JebWn0zDwY2h+rqITFOpdNr6ugsgvkDXuucdcChhYExJ
* AV/ZD2AWPbrTqV76mGRgJg4EddgT1zG0jq3rnFdMj2XzkBYx3BVvfR0Arnby0RHR

View file

@ -320,7 +320,7 @@ ossl_dsa_get_params(VALUE self)
rb_hash_aset(hash, rb_str_new2("g"), ossl_bn_new(pkey->pkey.dsa->g));
rb_hash_aset(hash, rb_str_new2("pub_key"), ossl_bn_new(pkey->pkey.dsa->pub_key));
rb_hash_aset(hash, rb_str_new2("priv_key"), ossl_bn_new(pkey->pkey.dsa->priv_key));
return hash;
}

View file

@ -274,7 +274,7 @@ static VALUE ossl_ec_key_get_group(VALUE self)
* the group.
*
* Setting the group will immediately destroy any previously assigned group object.
* The group is internally copied by OpenSSL. Modifying the original group after
* The group is internally copied by OpenSSL. Modifying the original group after
* assignment will not effect the internal key structure.
* (your changes may be lost). BE CAREFUL.
*
@ -1023,7 +1023,7 @@ static VALUE ossl_ec_group_set_asn1_flag(VALUE self, VALUE flag_v)
}
/* call-seq:
* group.point_conversion_form => :uncompressed | :compressed | :hybrid
* group.point_conversion_form => :uncompressed | :compressed | :hybrid
*
* See the OpenSSL documentation for EC_GROUP_get_point_conversion_form()
*/
@ -1043,7 +1043,7 @@ static VALUE ossl_ec_group_get_point_conversion_form(VALUE self)
case POINT_CONVERSION_HYBRID: ret = ID_hybrid; break;
default: rb_raise(eEC_GROUP, "unsupported point conversion form: %d, this module should be updated", form);
}
return ID2SYM(ret);
}
@ -1270,7 +1270,7 @@ static VALUE ossl_ec_point_initialize(int argc, VALUE *argv, VALUE self)
rb_raise(rb_eArgError, "1st argument must be OpenSSL::PKey::EC::Group");
group_v = arg1;
SafeRequire_EC_GROUP(group_v, group);
if (rb_obj_is_kind_of(arg2, cBN)) {
const BIGNUM *bn = GetBNPtr(arg2);

View file

@ -124,7 +124,7 @@ ossl_rsa_s_generate(int argc, VALUE *argv, VALUE klass)
* * +pass+ is an optional string with the password to decrypt the encoded key.
*
* === Examples
* * RSA.new(2048) -> rsa
* * RSA.new(2048) -> rsa
* * RSA.new(File.read("rsa.pem")) -> rsa
* * RSA.new(File.read("rsa.pem"), "mypassword") -> rsa
*/
@ -211,7 +211,7 @@ ossl_rsa_is_private(VALUE self)
EVP_PKEY *pkey;
GetPKeyRSA(self, pkey);
return (RSA_PRIVATE(self, pkey->pkey.rsa)) ? Qtrue : Qfalse;
}
@ -262,7 +262,7 @@ ossl_rsa_export(int argc, VALUE *argv, VALUE self)
}
}
str = ossl_membio2str(out);
return str;
}
@ -346,7 +346,7 @@ ossl_rsa_public_decrypt(int argc, VALUE *argv, VALUE self)
pad);
if (buf_len < 0) ossl_raise(eRSAError, NULL);
rb_str_set_len(str, buf_len);
return str;
}
@ -375,7 +375,7 @@ ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self)
pad);
if (buf_len < 0) ossl_raise(eRSAError, NULL);
rb_str_set_len(str, buf_len);
return str;
}
@ -435,7 +435,7 @@ ossl_rsa_get_params(VALUE self)
rb_hash_aset(hash, rb_str_new2("dmp1"), ossl_bn_new(pkey->pkey.rsa->dmp1));
rb_hash_aset(hash, rb_str_new2("dmq1"), ossl_bn_new(pkey->pkey.rsa->dmq1));
rb_hash_aset(hash, rb_str_new2("iqmp"), ossl_bn_new(pkey->pkey.rsa->iqmp));
return hash;
}
@ -479,7 +479,7 @@ ossl_rsa_to_public_key(VALUE self)
EVP_PKEY *pkey;
RSA *rsa;
VALUE obj;
GetPKeyRSA(self, pkey);
/* err check performed by rsa_instance */
rsa = RSAPublicKey_dup(pkey->pkey.rsa);
@ -498,7 +498,7 @@ static VALUE
ossl_rsa_blinding_on(VALUE self)
{
EVP_PKEY *pkey;
GetPKeyRSA(self, pkey);
if (RSA_blinding_on(pkey->pkey.rsa, ossl_bn_ctx) != 1) {
@ -511,7 +511,7 @@ static VALUE
ossl_rsa_blinding_off(VALUE self)
{
EVP_PKEY *pkey;
GetPKeyRSA(self, pkey);
RSA_blinding_off(pkey->pkey.rsa);

View file

@ -91,7 +91,7 @@ static const char *ossl_ssl_attrs[] = {
#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
"hostname",
#endif
"sync_close",
"sync_close",
};
ID ID_callback_state;
@ -304,7 +304,7 @@ static VALUE
ossl_call_session_get_cb(VALUE ary)
{
VALUE ssl_obj, sslctx_obj, cb;
Check_Type(ary, T_ARRAY);
ssl_obj = rb_ary_entry(ary, 0);
@ -351,7 +351,7 @@ static VALUE
ossl_call_session_new_cb(VALUE ary)
{
VALUE ssl_obj, sslctx_obj, cb;
Check_Type(ary, T_ARRAY);
ssl_obj = rb_ary_entry(ary, 0);
@ -398,7 +398,7 @@ static VALUE
ossl_call_session_remove_cb(VALUE ary)
{
VALUE sslctx_obj, cb;
Check_Type(ary, T_ARRAY);
sslctx_obj = rb_ary_entry(ary, 0);
@ -1585,7 +1585,7 @@ Init_ossl_ssl()
rb_define_method(cSSLContext, "setup", ossl_sslctx_setup, 0);
rb_define_const(cSSLContext, "SESSION_CACHE_OFF", LONG2FIX(SSL_SESS_CACHE_OFF));
rb_define_const(cSSLContext, "SESSION_CACHE_CLIENT", LONG2FIX(SSL_SESS_CACHE_CLIENT)); /* doesn't actually do anything in 0.9.8e */
rb_define_const(cSSLContext, "SESSION_CACHE_SERVER", LONG2FIX(SSL_SESS_CACHE_SERVER));

View file

@ -22,7 +22,7 @@
OSSL_Check_Kind(obj, cSSLSession); \
GetSSLSession(obj, sess); \
} while (0)
extern VALUE mSSL;
extern VALUE eSSLError;
extern VALUE cSSLSocket;

View file

@ -15,7 +15,7 @@
OSSL_Check_Kind(obj, cSSLSession); \
GetSSLSession(obj, sess); \
} while (0)
VALUE cSSLSession;
static VALUE eSSLSession;
@ -214,7 +214,7 @@ static VALUE ossl_ssl_session_to_pem(VALUE self)
BUF_MEM *buf;
VALUE str;
int i;
GetSSLSession(self, ctx);
if (!(out = BIO_new(BIO_s_mem()))) {
@ -246,7 +246,7 @@ static VALUE ossl_ssl_session_to_text(VALUE self)
BIO *out;
BUF_MEM *buf;
VALUE str;
GetSSLSession(self, ctx);
if (!(out = BIO_new(BIO_s_mem()))) {
@ -264,7 +264,7 @@ static VALUE ossl_ssl_session_to_text(VALUE self)
return str;
}
void Init_ossl_ssl_session(void)
{

View file

@ -41,7 +41,7 @@ ossl_x509attr_new(X509_ATTRIBUTE *attr)
{
X509_ATTRIBUTE *new;
VALUE obj;
if (!attr) {
new = X509_ATTRIBUTE_new();
} else {
@ -77,7 +77,7 @@ ossl_x509attr_alloc(VALUE klass)
X509_ATTRIBUTE *attr;
VALUE obj;
if (!(attr = X509_ATTRIBUTE_new()))
if (!(attr = X509_ATTRIBUTE_new()))
ossl_raise(eX509AttrError, NULL);
WrapX509Attr(klass, obj, attr);
@ -123,14 +123,14 @@ ossl_x509attr_set_oid(VALUE self, VALUE oid)
X509_ATTRIBUTE *attr;
ASN1_OBJECT *obj;
char *s;
s = StringValuePtr(oid);
obj = OBJ_txt2obj(s, 0);
if(!obj) obj = OBJ_txt2obj(s, 1);
if(!obj) ossl_raise(eX509AttrError, NULL);
GetX509Attr(self, attr);
X509_ATTRIBUTE_set1_object(attr, obj);
return oid;
}
@ -157,7 +157,7 @@ ossl_x509attr_get_oid(VALUE self)
i2a_ASN1_OBJECT(out, oid);
ret = ossl_membio2str(out);
}
return ret;
}
@ -251,7 +251,7 @@ ossl_x509attr_to_der(VALUE self)
p = (unsigned char *)RSTRING_PTR(str);
if(i2d_X509_ATTRIBUTE(attr, &p) <= 0)
ossl_raise(eX509AttrError, NULL);
rb_str_set_len(str, p - (unsigned char*)RSTRING_PTR(str));
rb_str_set_len(str, p - (unsigned char*)RSTRING_PTR(str));
return str;
}

View file

@ -55,7 +55,7 @@ ossl_x509_new(X509 *x509)
return obj;
}
VALUE
VALUE
ossl_x509_new_from_file(VALUE filename)
{
X509 *x509;
@ -111,7 +111,7 @@ DupX509CertPtr(VALUE obj)
/*
* Private
*/
static VALUE
static VALUE
ossl_x509_alloc(VALUE klass)
{
X509 *x509;
@ -130,7 +130,7 @@ ossl_x509_alloc(VALUE klass)
* Certificate.new => cert
* Certificate.new(string) => cert
*/
static VALUE
static VALUE
ossl_x509_initialize(int argc, VALUE *argv, VALUE self)
{
BIO *in;
@ -152,7 +152,7 @@ ossl_x509_initialize(int argc, VALUE *argv, VALUE self)
}
BIO_free(in);
if (!x509) ossl_raise(eX509CertError, NULL);
return self;
}
@ -169,7 +169,7 @@ ossl_x509_copy(VALUE self, VALUE other)
x509 = X509_dup(b);
if (!x509) ossl_raise(eX509CertError, NULL);
DATA_PTR(self) = x509;
X509_free(a);
@ -180,7 +180,7 @@ ossl_x509_copy(VALUE self, VALUE other)
* call-seq:
* cert.to_der => string
*/
static VALUE
static VALUE
ossl_x509_to_der(VALUE self)
{
X509 *x509;
@ -196,7 +196,7 @@ ossl_x509_to_der(VALUE self)
if (i2d_X509(x509, &p) <= 0)
ossl_raise(eX509CertError, NULL);
ossl_str_adjust(str, p);
return str;
}
@ -204,7 +204,7 @@ ossl_x509_to_der(VALUE self)
* call-seq:
* cert.to_pem => string
*/
static VALUE
static VALUE
ossl_x509_to_pem(VALUE self)
{
X509 *x509;
@ -253,7 +253,7 @@ ossl_x509_to_text(VALUE self)
/*
* Makes from X509 X509_REQuest
*/
static VALUE
static VALUE
ossl_x509_to_req(VALUE self)
{
X509 *x509;
@ -275,7 +275,7 @@ ossl_x509_to_req(VALUE self)
* call-seq:
* cert.version => integer
*/
static VALUE
static VALUE
ossl_x509_get_version(VALUE self)
{
X509 *x509;
@ -289,7 +289,7 @@ ossl_x509_get_version(VALUE self)
* call-seq:
* cert.version = integer => integer
*/
static VALUE
static VALUE
ossl_x509_set_version(VALUE self, VALUE version)
{
X509 *x509;
@ -310,7 +310,7 @@ ossl_x509_set_version(VALUE self, VALUE version)
* call-seq:
* cert.serial => integer
*/
static VALUE
static VALUE
ossl_x509_get_serial(VALUE self)
{
X509 *x509;
@ -324,7 +324,7 @@ ossl_x509_get_serial(VALUE self)
* call-seq:
* cert.serial = integer => integer
*/
static VALUE
static VALUE
ossl_x509_set_serial(VALUE self, VALUE num)
{
X509 *x509;
@ -341,7 +341,7 @@ ossl_x509_set_serial(VALUE self, VALUE num)
* call-seq:
* cert.signature_algorithm => string
*/
static VALUE
static VALUE
ossl_x509_get_signature_algorithm(VALUE self)
{
X509 *x509;
@ -365,7 +365,7 @@ ossl_x509_get_signature_algorithm(VALUE self)
* call-seq:
* cert.subject => name
*/
static VALUE
static VALUE
ossl_x509_get_subject(VALUE self)
{
X509 *x509;
@ -383,7 +383,7 @@ ossl_x509_get_subject(VALUE self)
* call-seq:
* cert.subject = name => name
*/
static VALUE
static VALUE
ossl_x509_set_subject(VALUE self, VALUE subject)
{
X509 *x509;
@ -400,7 +400,7 @@ ossl_x509_set_subject(VALUE self, VALUE subject)
* call-seq:
* cert.issuer => name
*/
static VALUE
static VALUE
ossl_x509_get_issuer(VALUE self)
{
X509 *x509;
@ -418,7 +418,7 @@ ossl_x509_get_issuer(VALUE self)
* call-seq:
* cert.issuer = name => name
*/
static VALUE
static VALUE
ossl_x509_set_issuer(VALUE self, VALUE issuer)
{
X509 *x509;
@ -435,7 +435,7 @@ ossl_x509_set_issuer(VALUE self, VALUE issuer)
* call-seq:
* cert.not_before => time
*/
static VALUE
static VALUE
ossl_x509_get_not_before(VALUE self)
{
X509 *x509;
@ -453,7 +453,7 @@ ossl_x509_get_not_before(VALUE self)
* call-seq:
* cert.not_before = time => time
*/
static VALUE
static VALUE
ossl_x509_set_not_before(VALUE self, VALUE time)
{
X509 *x509;
@ -472,7 +472,7 @@ ossl_x509_set_not_before(VALUE self, VALUE time)
* call-seq:
* cert.not_after => time
*/
static VALUE
static VALUE
ossl_x509_get_not_after(VALUE self)
{
X509 *x509;
@ -490,7 +490,7 @@ ossl_x509_get_not_after(VALUE self)
* call-seq:
* cert.not_before = time => time
*/
static VALUE
static VALUE
ossl_x509_set_not_after(VALUE self, VALUE time)
{
X509 *x509;
@ -509,7 +509,7 @@ ossl_x509_set_not_after(VALUE self, VALUE time)
* call-seq:
* cert.public_key => key
*/
static VALUE
static VALUE
ossl_x509_get_public_key(VALUE self)
{
X509 *x509;
@ -527,7 +527,7 @@ ossl_x509_get_public_key(VALUE self)
* call-seq:
* cert.public_key = key => key
*/
static VALUE
static VALUE
ossl_x509_set_public_key(VALUE self, VALUE key)
{
X509 *x509;
@ -544,7 +544,7 @@ ossl_x509_set_public_key(VALUE self, VALUE key)
* call-seq:
* cert.sign(key, digest) => self
*/
static VALUE
static VALUE
ossl_x509_sign(VALUE self, VALUE key, VALUE digest)
{
X509 *x509;
@ -567,7 +567,7 @@ ossl_x509_sign(VALUE self, VALUE key, VALUE digest)
*
* Checks that cert signature is made with PRIVversion of this PUBLIC 'key'
*/
static VALUE
static VALUE
ossl_x509_verify(VALUE self, VALUE key)
{
X509 *x509;
@ -578,7 +578,7 @@ ossl_x509_verify(VALUE self, VALUE key)
GetX509(self, x509);
if ((i = X509_verify(x509, pkey)) < 0) {
ossl_raise(eX509CertError, NULL);
}
}
if (i > 0) {
return Qtrue;
}
@ -592,7 +592,7 @@ ossl_x509_verify(VALUE self, VALUE key)
*
* Checks if 'key' is PRIV key for this cert
*/
static VALUE
static VALUE
ossl_x509_check_private_key(VALUE self, VALUE key)
{
X509 *x509;
@ -613,7 +613,7 @@ ossl_x509_check_private_key(VALUE self, VALUE key)
* call-seq:
* cert.extensions => [extension...]
*/
static VALUE
static VALUE
ossl_x509_get_extensions(VALUE self)
{
X509 *x509;
@ -639,7 +639,7 @@ ossl_x509_get_extensions(VALUE self)
* call-seq:
* cert.extensions = [ext...] => [ext...]
*/
static VALUE
static VALUE
ossl_x509_set_extensions(VALUE self, VALUE ary)
{
X509 *x509;
@ -671,7 +671,7 @@ ossl_x509_set_extensions(VALUE self, VALUE ary)
* call-seq:
* cert.add_extension(extension) => extension
*/
static VALUE
static VALUE
ossl_x509_add_extension(VALUE self, VALUE extension)
{
X509 *x509;
@ -725,7 +725,7 @@ ossl_x509_inspect(VALUE self)
/*
* INIT
*/
void
void
Init_ossl_x509cert()
{
eX509CertError = rb_define_class_under(mX509, "CertificateError", eOSSLError);
@ -735,7 +735,7 @@ Init_ossl_x509cert()
rb_define_alloc_func(cX509Cert, ossl_x509_alloc);
rb_define_method(cX509Cert, "initialize", ossl_x509_initialize, -1);
rb_define_copy_func(cX509Cert, ossl_x509_copy);
rb_define_method(cX509Cert, "to_der", ossl_x509_to_der, 0);
rb_define_method(cX509Cert, "to_pem", ossl_x509_to_pem, 0);
rb_define_alias(cX509Cert, "to_s", "to_pem");

View file

@ -66,14 +66,14 @@ ossl_x509crl_new(X509_CRL *crl)
tmp = crl ? X509_CRL_dup(crl) : X509_CRL_new();
if(!tmp) ossl_raise(eX509CRLError, NULL);
WrapX509CRL(cX509CRL, obj, tmp);
return obj;
}
/*
* PRIVATE
*/
static VALUE
static VALUE
ossl_x509crl_alloc(VALUE klass)
{
X509_CRL *crl;
@ -87,7 +87,7 @@ ossl_x509crl_alloc(VALUE klass)
return obj;
}
static VALUE
static VALUE
ossl_x509crl_initialize(int argc, VALUE *argv, VALUE self)
{
BIO *in;
@ -130,7 +130,7 @@ ossl_x509crl_copy(VALUE self, VALUE other)
return self;
}
static VALUE
static VALUE
ossl_x509crl_get_version(VALUE self)
{
X509_CRL *crl;
@ -142,7 +142,7 @@ ossl_x509crl_get_version(VALUE self)
return LONG2NUM(ver);
}
static VALUE
static VALUE
ossl_x509crl_set_version(VALUE self, VALUE version)
{
X509_CRL *crl;
@ -159,7 +159,7 @@ ossl_x509crl_set_version(VALUE self, VALUE version)
return version;
}
static VALUE
static VALUE
ossl_x509crl_get_signature_algorithm(VALUE self)
{
X509_CRL *crl;
@ -181,7 +181,7 @@ ossl_x509crl_get_signature_algorithm(VALUE self)
return str;
}
static VALUE
static VALUE
ossl_x509crl_get_issuer(VALUE self)
{
X509_CRL *crl;
@ -191,7 +191,7 @@ ossl_x509crl_get_issuer(VALUE self)
return ossl_x509name_new(X509_CRL_get_issuer(crl)); /* NO DUP - don't free */
}
static VALUE
static VALUE
ossl_x509crl_set_issuer(VALUE self, VALUE issuer)
{
X509_CRL *crl;
@ -204,7 +204,7 @@ ossl_x509crl_set_issuer(VALUE self, VALUE issuer)
return issuer;
}
static VALUE
static VALUE
ossl_x509crl_get_last_update(VALUE self)
{
X509_CRL *crl;
@ -214,7 +214,7 @@ ossl_x509crl_get_last_update(VALUE self)
return asn1time_to_time(X509_CRL_get_lastUpdate(crl));
}
static VALUE
static VALUE
ossl_x509crl_set_last_update(VALUE self, VALUE time)
{
X509_CRL *crl;
@ -229,7 +229,7 @@ ossl_x509crl_set_last_update(VALUE self, VALUE time)
return time;
}
static VALUE
static VALUE
ossl_x509crl_get_next_update(VALUE self)
{
X509_CRL *crl;
@ -239,7 +239,7 @@ ossl_x509crl_get_next_update(VALUE self)
return asn1time_to_time(X509_CRL_get_nextUpdate(crl));
}
static VALUE
static VALUE
ossl_x509crl_set_next_update(VALUE self, VALUE time)
{
X509_CRL *crl;
@ -280,7 +280,7 @@ ossl_x509crl_get_revoked(VALUE self)
return ary;
}
static VALUE
static VALUE
ossl_x509crl_set_revoked(VALUE self, VALUE ary)
{
X509_CRL *crl;
@ -306,7 +306,7 @@ ossl_x509crl_set_revoked(VALUE self, VALUE ary)
return ary;
}
static VALUE
static VALUE
ossl_x509crl_add_revoked(VALUE self, VALUE revoked)
{
X509_CRL *crl;
@ -322,7 +322,7 @@ ossl_x509crl_add_revoked(VALUE self, VALUE revoked)
return revoked;
}
static VALUE
static VALUE
ossl_x509crl_sign(VALUE self, VALUE key, VALUE digest)
{
X509_CRL *crl;
@ -339,7 +339,7 @@ ossl_x509crl_sign(VALUE self, VALUE key, VALUE digest)
return self;
}
static VALUE
static VALUE
ossl_x509crl_verify(VALUE self, VALUE key)
{
X509_CRL *crl;
@ -356,7 +356,7 @@ ossl_x509crl_verify(VALUE self, VALUE key)
return Qfalse;
}
static VALUE
static VALUE
ossl_x509crl_to_der(VALUE self)
{
X509_CRL *crl;
@ -379,7 +379,7 @@ ossl_x509crl_to_der(VALUE self)
return str;
}
static VALUE
static VALUE
ossl_x509crl_to_pem(VALUE self)
{
X509_CRL *crl;
@ -402,7 +402,7 @@ ossl_x509crl_to_pem(VALUE self)
return str;
}
static VALUE
static VALUE
ossl_x509crl_to_text(VALUE self)
{
X509_CRL *crl;
@ -428,7 +428,7 @@ ossl_x509crl_to_text(VALUE self)
/*
* Gets X509v3 extensions as array of X509Ext objects
*/
static VALUE
static VALUE
ossl_x509crl_get_extensions(VALUE self)
{
X509_CRL *crl;
@ -454,7 +454,7 @@ ossl_x509crl_get_extensions(VALUE self)
/*
* Sets X509_EXTENSIONs
*/
static VALUE
static VALUE
ossl_x509crl_set_extensions(VALUE self, VALUE ary)
{
X509_CRL *crl;
@ -481,7 +481,7 @@ ossl_x509crl_set_extensions(VALUE self, VALUE ary)
return ary;
}
static VALUE
static VALUE
ossl_x509crl_add_extension(VALUE self, VALUE extension)
{
X509_CRL *crl;
@ -501,7 +501,7 @@ ossl_x509crl_add_extension(VALUE self, VALUE extension)
/*
* INIT
*/
void
void
Init_ossl_x509crl()
{
eX509CRLError = rb_define_class_under(mX509, "CRLError", eOSSLError);
@ -511,7 +511,7 @@ Init_ossl_x509crl()
rb_define_alloc_func(cX509CRL, ossl_x509crl_alloc);
rb_define_method(cX509CRL, "initialize", ossl_x509crl_initialize, -1);
rb_define_copy_func(cX509CRL, ossl_x509crl_copy);
rb_define_method(cX509CRL, "version", ossl_x509crl_get_version, 0);
rb_define_method(cX509CRL, "version=", ossl_x509crl_set_version, 1);
rb_define_method(cX509CRL, "signature_algorithm", ossl_x509crl_get_signature_algorithm, 0);

View file

@ -49,7 +49,7 @@ VALUE eX509ExtError;
/*
* Public
*/
VALUE
VALUE
ossl_x509ext_new(X509_EXTENSION *ext)
{
X509_EXTENSION *new;
@ -103,7 +103,7 @@ ossl_x509extfactory_free(X509V3_CTX *ctx)
OPENSSL_free(ctx);
}
static VALUE
static VALUE
ossl_x509extfactory_alloc(VALUE klass)
{
X509V3_CTX *ctx;
@ -115,7 +115,7 @@ ossl_x509extfactory_alloc(VALUE klass)
return obj;
}
static VALUE
static VALUE
ossl_x509extfactory_set_issuer_cert(VALUE self, VALUE cert)
{
X509V3_CTX *ctx;
@ -127,7 +127,7 @@ ossl_x509extfactory_set_issuer_cert(VALUE self, VALUE cert)
return cert;
}
static VALUE
static VALUE
ossl_x509extfactory_set_subject_cert(VALUE self, VALUE cert)
{
X509V3_CTX *ctx;
@ -139,7 +139,7 @@ ossl_x509extfactory_set_subject_cert(VALUE self, VALUE cert)
return cert;
}
static VALUE
static VALUE
ossl_x509extfactory_set_subject_req(VALUE self, VALUE req)
{
X509V3_CTX *ctx;
@ -151,7 +151,7 @@ ossl_x509extfactory_set_subject_req(VALUE self, VALUE req)
return req;
}
static VALUE
static VALUE
ossl_x509extfactory_set_crl(VALUE self, VALUE crl)
{
X509V3_CTX *ctx;
@ -181,7 +181,7 @@ ossl_x509extfactory_set_config(VALUE self, VALUE config)
#define rb_f_fork rb_f_notimplement
#endif
static VALUE
static VALUE
ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self)
{
/*X509V3_CTX *ctx;*/
@ -211,7 +211,7 @@ ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self)
* ["ln", "critical,value"] or the same for sn
* ["ln", "value"] => not critical
*/
static VALUE
static VALUE
ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self)
{
X509V3_CTX *ctx;
@ -351,7 +351,7 @@ ossl_x509ext_set_critical(VALUE self, VALUE flag)
return flag;
}
static VALUE
static VALUE
ossl_x509ext_get_oid(VALUE obj)
{
X509_EXTENSION *ext;
@ -427,7 +427,7 @@ void
Init_ossl_x509ext()
{
eX509ExtError = rb_define_class_under(mX509, "ExtensionError", eOSSLError);
cX509ExtFactory = rb_define_class_under(mX509, "ExtensionFactory", rb_cObject);
rb_define_alloc_func(cX509ExtFactory, ossl_x509extfactory_alloc);

View file

@ -41,7 +41,7 @@ VALUE eX509NameError;
/*
* Public
*/
VALUE
VALUE
ossl_x509name_new(X509_NAME *name)
{
X509_NAME *new;
@ -56,7 +56,7 @@ ossl_x509name_new(X509_NAME *name)
ossl_raise(eX509NameError, NULL);
}
WrapX509Name(cX509Name, obj, new);
return obj;
}
@ -222,7 +222,7 @@ ossl_x509name_to_s(int argc, VALUE *argv, VALUE self)
* call-seq:
* name.to_a => [[name, data, type], ...]
*/
static VALUE
static VALUE
ossl_x509name_to_a(VALUE self)
{
X509_NAME *name;
@ -333,7 +333,7 @@ ossl_x509name_to_der(VALUE self)
/*
* INIT
*/
void
void
Init_ossl_x509name()
{
VALUE utf8str, ptrstr, ia5str, hash;

View file

@ -81,7 +81,7 @@ DupX509ReqPtr(VALUE obj)
/*
* Private functions
*/
static VALUE
static VALUE
ossl_x509req_alloc(VALUE klass)
{
X509_REQ *req;
@ -95,7 +95,7 @@ ossl_x509req_alloc(VALUE klass)
return obj;
}
static VALUE
static VALUE
ossl_x509req_initialize(int argc, VALUE *argv, VALUE self)
{
BIO *in;
@ -138,7 +138,7 @@ ossl_x509req_copy(VALUE self, VALUE other)
return self;
}
static VALUE
static VALUE
ossl_x509req_to_pem(VALUE self)
{
X509_REQ *req;
@ -181,7 +181,7 @@ ossl_x509req_to_der(VALUE self)
return str;
}
static VALUE
static VALUE
ossl_x509req_to_text(VALUE self)
{
X509_REQ *req;
@ -208,7 +208,7 @@ ossl_x509req_to_text(VALUE self)
/*
* Makes X509 from X509_REQuest
*/
static VALUE
static VALUE
ossl_x509req_to_x509(VALUE self, VALUE days, VALUE key)
{
X509_REQ *req;
@ -224,7 +224,7 @@ ossl_x509req_to_x509(VALUE self, VALUE days, VALUE key)
}
#endif
static VALUE
static VALUE
ossl_x509req_get_version(VALUE self)
{
X509_REQ *req;
@ -236,7 +236,7 @@ ossl_x509req_get_version(VALUE self)
return LONG2FIX(version);
}
static VALUE
static VALUE
ossl_x509req_set_version(VALUE self, VALUE version)
{
X509_REQ *req;
@ -253,7 +253,7 @@ ossl_x509req_set_version(VALUE self, VALUE version)
return version;
}
static VALUE
static VALUE
ossl_x509req_get_subject(VALUE self)
{
X509_REQ *req;
@ -267,7 +267,7 @@ ossl_x509req_get_subject(VALUE self)
return ossl_x509name_new(name);
}
static VALUE
static VALUE
ossl_x509req_set_subject(VALUE self, VALUE subject)
{
X509_REQ *req;
@ -281,7 +281,7 @@ ossl_x509req_set_subject(VALUE self, VALUE subject)
return subject;
}
static VALUE
static VALUE
ossl_x509req_get_signature_algorithm(VALUE self)
{
X509_REQ *req;
@ -304,7 +304,7 @@ ossl_x509req_get_signature_algorithm(VALUE self)
return str;
}
static VALUE
static VALUE
ossl_x509req_get_public_key(VALUE self)
{
X509_REQ *req;
@ -318,7 +318,7 @@ ossl_x509req_get_public_key(VALUE self)
return ossl_pkey_new(pkey); /* NO DUP - OK */
}
static VALUE
static VALUE
ossl_x509req_set_public_key(VALUE self, VALUE key)
{
X509_REQ *req;
@ -333,7 +333,7 @@ ossl_x509req_set_public_key(VALUE self, VALUE key)
return key;
}
static VALUE
static VALUE
ossl_x509req_sign(VALUE self, VALUE key, VALUE digest)
{
X509_REQ *req;
@ -353,7 +353,7 @@ ossl_x509req_sign(VALUE self, VALUE key, VALUE digest)
/*
* Checks that cert signature is made with PRIVversion of this PUBLIC 'key'
*/
static VALUE
static VALUE
ossl_x509req_verify(VALUE self, VALUE key)
{
X509_REQ *req;
@ -372,7 +372,7 @@ ossl_x509req_verify(VALUE self, VALUE key)
return Qfalse;
}
static VALUE
static VALUE
ossl_x509req_get_attributes(VALUE self)
{
X509_REQ *req;
@ -396,7 +396,7 @@ ossl_x509req_get_attributes(VALUE self)
return ary;
}
static VALUE
static VALUE
ossl_x509req_set_attributes(VALUE self, VALUE ary)
{
X509_REQ *req;
@ -421,7 +421,7 @@ ossl_x509req_set_attributes(VALUE self, VALUE ary)
return ary;
}
static VALUE
static VALUE
ossl_x509req_add_attribute(VALUE self, VALUE attr)
{
X509_REQ *req;
@ -437,7 +437,7 @@ ossl_x509req_add_attribute(VALUE self, VALUE attr)
/*
* X509_REQUEST init
*/
void
void
Init_ossl_x509req()
{
eX509ReqError = rb_define_class_under(mX509, "RequestError", eOSSLError);

View file

@ -36,7 +36,7 @@ VALUE eX509RevError;
/*
* PUBLIC
*/
VALUE
VALUE
ossl_x509revoked_new(X509_REVOKED *rev)
{
X509_REVOKED *new;
@ -71,7 +71,7 @@ DupX509RevokedPtr(VALUE obj)
/*
* PRIVATE
*/
static VALUE
static VALUE
ossl_x509revoked_alloc(VALUE klass)
{
X509_REVOKED *rev;
@ -85,14 +85,14 @@ ossl_x509revoked_alloc(VALUE klass)
return obj;
}
static VALUE
static VALUE
ossl_x509revoked_initialize(int argc, VALUE *argv, VALUE self)
{
/* EMPTY */
return self;
}
static VALUE
static VALUE
ossl_x509revoked_get_serial(VALUE self)
{
X509_REVOKED *rev;
@ -102,7 +102,7 @@ ossl_x509revoked_get_serial(VALUE self)
return asn1integer_to_num(rev->serialNumber);
}
static VALUE
static VALUE
ossl_x509revoked_set_serial(VALUE self, VALUE num)
{
X509_REVOKED *rev;
@ -113,7 +113,7 @@ ossl_x509revoked_set_serial(VALUE self, VALUE num)
return num;
}
static VALUE
static VALUE
ossl_x509revoked_get_time(VALUE self)
{
X509_REVOKED *rev;
@ -123,7 +123,7 @@ ossl_x509revoked_get_time(VALUE self)
return asn1time_to_time(rev->revocationDate);
}
static VALUE
static VALUE
ossl_x509revoked_set_time(VALUE self, VALUE time)
{
X509_REVOKED *rev;
@ -140,7 +140,7 @@ ossl_x509revoked_set_time(VALUE self, VALUE time)
/*
* Gets X509v3 extensions as array of X509Ext objects
*/
static VALUE
static VALUE
ossl_x509revoked_get_extensions(VALUE self)
{
X509_REVOKED *rev;
@ -166,7 +166,7 @@ ossl_x509revoked_get_extensions(VALUE self)
/*
* Sets X509_EXTENSIONs
*/
static VALUE
static VALUE
ossl_x509revoked_set_extensions(VALUE self, VALUE ary)
{
X509_REVOKED *rev;
@ -196,7 +196,7 @@ static VALUE
ossl_x509revoked_add_extension(VALUE self, VALUE ext)
{
X509_REVOKED *rev;
GetX509Rev(self, rev);
if(!X509_REVOKED_add_ext(rev, DupX509ExtPtr(ext), -1)) {
ossl_raise(eX509RevError, NULL);

View file

@ -54,7 +54,7 @@ VALUE eX509StoreError;
/*
* Public functions
*/
VALUE
VALUE
ossl_x509store_new(X509_STORE *store)
{
VALUE obj;
@ -76,19 +76,19 @@ GetX509StorePtr(VALUE obj)
X509_STORE *
DupX509StorePtr(VALUE obj)
{
{
X509_STORE *store;
SafeGetX509Store(obj, store);
CRYPTO_add(&store->references, 1, CRYPTO_LOCK_X509_STORE);
return store;
}
/*
* Private functions
*/
static VALUE
static VALUE
ossl_x509store_alloc(VALUE klass)
{
X509_STORE *store;
@ -171,7 +171,7 @@ ossl_x509store_set_purpose(VALUE self, VALUE purpose)
#if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
X509_STORE *store;
long p = NUM2LONG(purpose);
GetX509Store(self, store);
X509_STORE_set_purpose(store, p);
#else
@ -197,14 +197,14 @@ ossl_x509store_set_trust(VALUE self, VALUE trust)
return trust;
}
static VALUE
static VALUE
ossl_x509store_set_time(VALUE self, VALUE time)
{
rb_iv_set(self, "@time", time);
return time;
}
static VALUE
static VALUE
ossl_x509store_add_file(VALUE self, VALUE file)
{
X509_STORE *store;
@ -225,7 +225,7 @@ ossl_x509store_add_file(VALUE self, VALUE file)
return self;
}
static VALUE
static VALUE
ossl_x509store_add_path(VALUE self, VALUE dir)
{
X509_STORE *store;
@ -293,7 +293,7 @@ static VALUE ossl_x509stctx_get_err(VALUE);
static VALUE ossl_x509stctx_get_err_string(VALUE);
static VALUE ossl_x509stctx_get_chain(VALUE);
static VALUE
static VALUE
ossl_x509store_verify(int argc, VALUE *argv, VALUE self)
{
VALUE cert, chain;
@ -350,7 +350,7 @@ ossl_x509stctx_free(X509_STORE_CTX *ctx)
X509_STORE_CTX_free(ctx);
}
static VALUE
static VALUE
ossl_x509stctx_alloc(VALUE klass)
{
X509_STORE_CTX *ctx;
@ -442,7 +442,7 @@ ossl_x509stctx_get_chain(VALUE self)
return ary;
}
static VALUE
static VALUE
ossl_x509stctx_get_err(VALUE self)
{
X509_STORE_CTX *ctx;
@ -463,7 +463,7 @@ ossl_x509stctx_set_error(VALUE self, VALUE err)
return err;
}
static VALUE
static VALUE
ossl_x509stctx_get_err_string(VALUE self)
{
X509_STORE_CTX *ctx;
@ -475,7 +475,7 @@ ossl_x509stctx_get_err_string(VALUE self)
return rb_str_new2(X509_verify_cert_error_string(err));
}
static VALUE
static VALUE
ossl_x509stctx_get_err_depth(VALUE self)
{
X509_STORE_CTX *ctx;
@ -485,7 +485,7 @@ ossl_x509stctx_get_err_depth(VALUE self)
return INT2FIX(X509_STORE_CTX_get_error_depth(ctx));
}
static VALUE
static VALUE
ossl_x509stctx_get_curr_cert(VALUE self)
{
X509_STORE_CTX *ctx;
@ -577,7 +577,7 @@ ossl_x509stctx_set_time(VALUE self, VALUE time)
/*
* INIT
*/
void
void
Init_ossl_x509store()
{
VALUE x509stctx;

View file

@ -1,9 +1,9 @@
/*
cparse.c -- Racc Runtime Core
Copyright (c) 1999-2006 Minero Aoki
This library is free software.
You can distribute/modify this program under the same terms of ruby.
@ -293,7 +293,7 @@ lexer_i(VALUE block_args, VALUE data, VALUE self)
extract_user_token(v, block_args, &tok, &val);
parse_main(v, tok, val, 1);
if (v->fin && v->fin != CP_FIN_ACCEPT)
rb_iter_break();
rb_iter_break();
return Qnil;
}
@ -460,7 +460,7 @@ parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume)
if (resume)
goto resume;
while (1) {
D_puts("");
D_puts("---- enter new loop ----");
@ -519,7 +519,7 @@ parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume)
act_fixed:
D_printf("act=%ld\n", act);
goto handle_act;
notfound:
D_puts("(act) not found: use default");
act_value = AREF(v->action_default, v->curstate);
@ -620,7 +620,7 @@ parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume)
D_puts("(err) found: can handle error token");
break;
error_pop:
D_puts("(err) act not found: can't handle error token; pop");

View file

@ -81,7 +81,7 @@ static char **readline_attempted_completion_function(const char *text,
* GNU Readline:: http://www.gnu.org/directory/readline.html
* libedit:: http://www.thrysoee.dk/editline/
*
* Reads one inputted line with line edit by Readline.readline method.
* Reads one inputted line with line edit by Readline.readline method.
* At this time, the facilitatation completion and the key
* bind like Emacs can be operated like GNU Readline.
*
@ -173,9 +173,9 @@ readline_get(VALUE prompt)
*
* * Catches the Interrupt exception by pressed ^C after returns
* terminal status:
*
*
* require "readline"
*
*
* stty_save = `stty -g`.chomp
* begin
* while buf = Readline.readline
@ -187,25 +187,25 @@ readline_get(VALUE prompt)
* end
* end
* end
*
*
* * Catches the INT signal by pressed ^C after returns terminal
* status:
*
*
* require "readline"
*
*
* stty_save = `stty -g`.chomp
* trap("INT") { system "stty", stty_save; exit }
*
*
* while buf = Readline.readline
* p buf
* end
*
* * Ignores pressing ^C:
*
*
* require "readline"
*
*
* trap("INT", "SIG_IGN")
*
*
* while buf = Readline.readline
* p buf
* end
@ -215,18 +215,18 @@ readline_get(VALUE prompt)
* the same it as last one.
*
* require "readline"
*
*
* while buf = Readline.readline("> ", true)
* # p Readline::HISTORY.to_a
* Readline::HISTORY.pop if /^\s*$/ =~ buf
*
*
* begin
* if Readline::HISTORY[Readline::HISTORY.length-2] == buf
* Readline::HISTORY.pop
* Readline::HISTORY.pop
* end
* rescue IndexError
* end
*
*
* # p Readline::HISTORY.to_a
* print "-> ", buf, "\n"
* end
@ -389,7 +389,7 @@ readline_s_set_completion_case_fold(VALUE self, VALUE val)
* Readline.completion_case_fold= method.
*
* require "readline"
*
*
* Readline.completion_case_fold = "This is a String."
* p Readline.completion_case_fold # => "This is a String."
*
@ -521,7 +521,7 @@ readline_attempted_completion_function(const char *text, int start, int end)
*
* Set terminal size to +rows+ and +columns+.
*
* See GNU Readline's rl_set_screen_size function.
* See GNU Readline's rl_set_screen_size function.
*
* Raises NotImplementedError if the using readline library does not support.
*
@ -545,7 +545,7 @@ readline_s_set_screen_size(VALUE self, VALUE rows, VALUE columns)
*
* Returns the terminal's rows and columns.
*
* See GNU Readline's rl_get_screen_size function.
* See GNU Readline's rl_get_screen_size function.
*
* Raises NotImplementedError if the using readline library does not support.
*
@ -556,7 +556,7 @@ readline_s_get_screen_size(VALUE self)
{
int rows, columns;
VALUE res;
rb_secure(4);
rl_get_screen_size(&rows, &columns);
res = rb_ary_new();
@ -667,20 +667,20 @@ readline_s_emacs_editing_mode_p(VALUE self)
*
* For example:
* require "readline"
*
*
* Readline.readline("> ", true)
* Readline.completion_append_character = " "
*
* Result:
* >
* Input "/var/li".
*
*
* > /var/li
* Press TAB key.
*
*
* > /var/lib
* Completes "b" and appends " ". So, you can continuously input "/usr".
*
*
* > /var/lib /usr
*
* NOTE: Only one character can be specified. When "string" is
@ -788,7 +788,7 @@ readline_s_set_basic_word_break_characters(VALUE self, VALUE str)
*
* Gets the basic list of characters that signal a break between words
* for the completer routine.
*
*
* Raises NotImplementedError if the using readline library does not support.
*
* Raises SecurityError exception if $SAFE is 4.
@ -849,7 +849,7 @@ readline_s_set_completer_word_break_characters(VALUE self, VALUE str)
*
* Gets the basic list of characters that signal a break between words
* for rl_complete_internal().
*
*
* Raises NotImplementedError if the using readline library does not support.
*
* Raises SecurityError exception if $SAFE is 4.
@ -1143,7 +1143,7 @@ static VALUE
hist_push_method(int argc, VALUE *argv, VALUE self)
{
VALUE str;
rb_secure(4);
while (argc--) {
str = *argv++;
@ -1422,7 +1422,7 @@ Init_readline()
#if defined HAVE_RL_LIBRARY_VERSION
version = rb_str_new_cstr(rl_library_version);
#if defined HAVE_CLEAR_HISTORY || defined HAVE_REMOVE_HISTORY
if (strncmp(rl_library_version, EDIT_LINE_LIBRARY_VERSION,
if (strncmp(rl_library_version, EDIT_LINE_LIBRARY_VERSION,
strlen(EDIT_LINE_LIBRARY_VERSION)) == 0) {
add_history("1");
if (history_get(history_get_offset_func(0)) == NULL) {

View file

@ -186,7 +186,7 @@ sdbm_prep(char *dirname, char *pagname, int flags, int mode)
db->blkptr = 0;
db->keyptr = 0;
/*
* adjust user flags so that WRONLY becomes RDWR,
* adjust user flags so that WRONLY becomes RDWR,
* as required by this package. Also set our internal
* flag for RDONLY.
*/
@ -407,7 +407,7 @@ makroom(register DBM *db, long int hash, int need)
* need to read in anything. BUT we have to write the current
* [deferred] page out, as the window of failure is too great.
*/
db->curbit = 2 * db->curbit +
db->curbit = 2 * db->curbit +
((hash & (db->hmask + 1)) ? 2 : 1);
db->hmask |= (db->hmask + 1);
@ -483,7 +483,7 @@ getpage(register DBM *db, register long int hash)
* see if the block we need is already in memory.
* note: this lookaside cache has about 10% hit rate.
*/
if (pagb != db->pagbno) {
if (pagb != db->pagbno) {
/*
* note: here, we assume a "hole" is read as 0s.
* if not, must zero pagbuf first.
@ -608,8 +608,8 @@ getnext(register DBM *db)
#define exhash(item) sdbm_hash((item).dptr, (item).dsize)
/*
* forward
/*
* forward
*/
static int seepair proto((char *, int, char *, int));
@ -829,7 +829,7 @@ splpage(char *pag, char *new, long int sbit)
n = GET_SHORT(ino,0);
for (ino++; n > 0; ino += 2) {
key.dptr = cur + GET_SHORT(ino,0);
key.dptr = cur + GET_SHORT(ino,0);
key.dsize = off - GET_SHORT(ino,0);
val.dptr = cur + GET_SHORT(ino,1);
val.dsize = GET_SHORT(ino,0) - GET_SHORT(ino,1);
@ -842,13 +842,13 @@ splpage(char *pag, char *new, long int sbit)
n -= 2;
}
debug(("%d split %d/%d\n", ((short *) cur)[0] / 2,
debug(("%d split %d/%d\n", ((short *) cur)[0] / 2,
((short *) new)[0] / 2,
((short *) pag)[0] / 2));
}
/*
* check page sanity:
* check page sanity:
* number of entries should be something
* reasonable, and all offsets in the index should be in order.
* this could be made more rigorous.
@ -891,7 +891,7 @@ chkpage(char *pag)
* [this seems to work remarkably well, in fact better
* then the ndbm hash function. Replace at your own risk]
* use: 65599 nice.
* 65587 even better.
* 65587 even better.
*/
long
sdbm_hash(register char *str, register int len)

View file

@ -293,7 +293,7 @@ fsdbm_shift(VALUE obj)
fdbm_modify(obj);
GetDBM2(obj, dbmp, dbm);
key = sdbm_firstkey(dbm);
key = sdbm_firstkey(dbm);
if (!key.dptr) return Qnil;
val = sdbm_fetch(dbm, key);
keystr = rb_external_str_new(key.dptr, key.dsize);

View file

@ -2,7 +2,7 @@
* sdbm - ndbm work-alike hashed database library
* based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
* author: oz@nexus.yorku.ca
* status: public domain.
* status: public domain.
*/
#ifndef _SDBM_H_
#define _SDBM_H_

View file

@ -1,7 +1,7 @@
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -13,7 +13,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

View file

@ -65,7 +65,7 @@ ip_cmsg_type_to_sym(int level, int cmsg_type)
* p Socket::AncillaryData.new(:INET, :TCP, :NODELAY, "")
* #=> #<Socket::AncillaryData: INET TCP NODELAY "">
*
* p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "")
* p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "")
* #=> #<Socket::AncillaryData: INET6 IPV6 PKTINFO "">
*
*/
@ -228,7 +228,7 @@ ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass)
*
* returns the array of IO objects for SCM_RIGHTS control message in UNIX domain socket.
*
* The class of the IO objects in the array is IO or Socket.
* The class of the IO objects in the array is IO or Socket.
*
* The array is attached to _ancillarydata_ when it is instantiated.
* For example, BasicSocket#recvmsg attach the array when
@ -356,7 +356,7 @@ ancillary_timestamp(VALUE self)
*
* Creates a new Socket::AncillaryData object which contains a int as data.
*
* The size and endian is dependent on the host.
* The size and endian is dependent on the host.
*
* p Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, STDERR.fileno)
* #=> #<Socket::AncillaryData: UNIX SOCKET RIGHTS 2>
@ -377,7 +377,7 @@ ancillary_s_int(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE vtype, VALUE int
*
* Returns the data in _ancillarydata_ as an int.
*
* The size and endian is dependent on the host.
* The size and endian is dependent on the host.
*
* ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, STDERR.fileno)
* p ancdata.int #=> 2
@ -592,7 +592,7 @@ extract_ipv6_pktinfo(VALUE self, struct in6_pktinfo *pktinfo_ptr, struct sockadd
*
* IPV6_PKTINFO is defined by RFC 3542.
*
* addr = Addrinfo.ip("::1")
* addr = Addrinfo.ip("::1")
* ifindex = 0
* ancdata = Socket::AncillaryData.ipv6_pktinfo(addr, ifindex)
* p ancdata.ipv6_pktinfo #=> [#<Addrinfo: ::1>, 0]
@ -778,7 +778,7 @@ anc_inspect_ip_recvdstaddr(int level, int type, VALUE data, VALUE ret)
{
if (level == IPPROTO_IP && type == IP_RECVDSTADDR &&
RSTRING_LEN(data) == sizeof(struct in_addr)) {
struct in_addr addr;
struct in_addr addr;
char addrbuf[INET_ADDRSTRLEN];
memcpy(&addr, RSTRING_PTR(data), sizeof(addr));
if (inet_ntop(AF_INET, &addr, addrbuf, sizeof(addrbuf)) == NULL)
@ -829,7 +829,7 @@ anc_inspect_ipv6_pktinfo(int level, int type, VALUE data, VALUE ret)
if (level == IPPROTO_IPV6 && type == IPV6_PKTINFO &&
RSTRING_LEN(data) == sizeof(struct in6_pktinfo)) {
struct in6_pktinfo *pktinfo = (struct in6_pktinfo *)RSTRING_PTR(data);
struct in6_addr addr;
struct in6_addr addr;
unsigned int ifindex;
char addrbuf[INET6_ADDRSTRLEN], ifbuf[IFNAMSIZ];
memcpy(&addr, &pktinfo->ipi6_addr, sizeof(addr));
@ -1033,7 +1033,7 @@ ancillary_inspect(VALUE self)
# endif
}
break;
case AF_INET:
#ifdef INET6
case AF_INET6:
@ -1211,18 +1211,18 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
if (last_pad) {
/*
* This code removes the last padding from msg_controllen.
*
*
* 4.3BSD-Reno reject the padding for SCM_RIGHTS. (There was no 64bit environments in those days?)
* RFC 2292 require the padding.
* RFC 3542 relaxes the condition - implementation must accept both as valid.
*
*
* Actual problems:
*
* - NetBSD 4.0.1
* SCM_RIGHTS with padding causes EINVAL
* IPV6_PKTINFO without padding causes "page fault trap"
* http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=40661
*
*
* - OpenBSD 4.4
* IPV6_PKTINFO without padding causes EINVAL
*
@ -1317,7 +1317,7 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
* sendmsg can be used to implement send_io as follows:
*
* # use Socket::AncillaryData.
* ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, io.fileno)
* ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, io.fileno)
* sock.sendmsg("a", 0, nil, ancdata)
*
* # use 3-element array.

View file

@ -57,7 +57,7 @@ bsock_s_for_fd(VALUE klass, VALUE fd)
* s2.close
* p s1.read #=> "pong\n"
* }
*
*
*/
static VALUE
bsock_shutdown(int argc, VALUE *argv, VALUE sock)
@ -179,15 +179,15 @@ bsock_close_write(VALUE sock)
*
* Some socket options are integers with boolean values, in this case
* #setsockopt could be called like this:
* sock.setsockopt(:SOCKET, :REUSEADDR, true)
* sock.setsockopt(:SOCKET, :REUSEADDR, true)
* sock.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true)
* sock.setsockopt(Socket::Option.bool(:INET, :SOCKET, :REUSEADDR, true))
*
* Some socket options are integers with numeric values, in this case
* #setsockopt could be called like this:
* sock.setsockopt(:IP, :TTL, 255)
* sock.setsockopt(:IP, :TTL, 255)
* sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_TTL, 255)
* sock.setsockopt(Socket::Option.int(:INET, :IP, :TTL, 255))
* sock.setsockopt(Socket::Option.int(:INET, :IP, :TTL, 255))
*
* Option values may be structs. Passing them can be complex as it involves
* examining your system headers to determine the correct definition. An
@ -196,7 +196,7 @@ bsock_close_write(VALUE sock)
* struct in_addr imr_multiaddr;
* struct in_addr imr_interface;
* };
*
*
* In this case #setsockopt could be called like this:
* optval = IPAddr.new("224.0.0.251").hton +
* IPAddr.new(Socket::INADDR_ANY, Socket::AF_INET).hton
@ -303,7 +303,7 @@ bsock_setsockopt(int argc, VALUE *argv, VALUE sock)
* int l_onoff;
* int l_linger;
* };
*
*
* In this case #getsockopt could be called like this:
*
* # Socket::Option knows linger structure.
@ -647,7 +647,7 @@ bsock_recv(int argc, VALUE *argv, VALUE sock)
* call-seq:
* basicsocket.recv_nonblock(maxlen) => mesg
* basicsocket.recv_nonblock(maxlen, flags) => mesg
*
*
* Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
* O_NONBLOCK is set for the underlying file descriptor.
* _flags_ is zero or more of the +MSG_+ options.
@ -656,11 +656,11 @@ bsock_recv(int argc, VALUE *argv, VALUE sock)
* When recvfrom(2) returns 0, Socket#recv_nonblock returns
* an empty string as data.
* The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
*
*
* === Parameters
* * +maxlen+ - the number of bytes to receive from the socket
* * +flags+ - zero or more of the +MSG_+ options
*
* * +flags+ - zero or more of the +MSG_+ options
*
* === Example
* serv = TCPServer.new("127.0.0.1", 0)
* af, port, host, addr = serv.addr
@ -675,7 +675,7 @@ bsock_recv(int argc, VALUE *argv, VALUE sock)
* end
*
* Refer to Socket#recvfrom for the exceptions that may be thrown if the call
* to _recv_nonblock_ fails.
* to _recv_nonblock_ fails.
*
* BasicSocket#recv_nonblock may raise any error corresponding to recvfrom(2) failure,
* including Errno::EWOULDBLOCK.

View file

@ -1,7 +1,7 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -13,7 +13,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -45,7 +45,7 @@
#include <sys/types.h>
#ifndef _WIN32
#include <sys/param.h>
#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
# include <net/socket.h>
#else
# include <sys/socket.h>
@ -97,7 +97,7 @@ static const char in_addrany[] = { 0, 0, 0, 0 };
static const char in6_addrany[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static const char in_loopback[] = { 127, 0, 0, 1 };
static const char in_loopback[] = { 127, 0, 0, 1 };
static const char in6_loopback[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
};
@ -502,7 +502,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h
*/
get_name(pton, &afdl[i], &top, pton, pai, port);
goto good;
} else
} else
ERR(EAI_FAMILY); /*xxx*/
}
}

View file

@ -1,7 +1,7 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -13,7 +13,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

View file

@ -159,10 +159,10 @@ rsock_revlookup_flag(VALUE revlookup, int *norevlookup)
/*
* call-seq:
* ipsocket.addr([reverse_lookup]) => [address_family, port, hostname, numeric_address]
* ipsocket.addr([reverse_lookup]) => [address_family, port, hostname, numeric_address]
*
* Returns the local address as an array which contains
* address_family, port, hostname and numeric_address.
* address_family, port, hostname and numeric_address.
*
* If +reverse_lookup+ is +true+ or +:hostname+,
* hostname is obtained from numeric_address using reverse lookup.
@ -199,10 +199,10 @@ ip_addr(int argc, VALUE *argv, VALUE sock)
/*
* call-seq:
* ipsocket.peeraddr([reverse_lookup]) => [address_family, port, hostname, numeric_address]
* ipsocket.peeraddr([reverse_lookup]) => [address_family, port, hostname, numeric_address]
*
* Returns the remote address as an array which contains
* address_family, port, hostname and numeric_address.
* address_family, port, hostname and numeric_address.
* It is defined for connection oriented socket such as TCPSocket.
*
* If +reverse_lookup+ is +true+ or +:hostname+,
@ -257,7 +257,7 @@ ip_peeraddr(int argc, VALUE *argv, VALUE sock)
* u2 = UDPSocket.new
* u2.send "uuuu", 0, "127.0.0.1", 4913
* p u1.recvfrom(10) #=> ["uuuu", ["AF_INET", 33230, "localhost", "127.0.0.1"]]
*
*
*/
static VALUE
ip_recvfrom(int argc, VALUE *argv, VALUE sock)

View file

@ -148,7 +148,7 @@ sockopt_data(VALUE self)
*
* Creates a new Socket::Option object which contains an int as data.
*
* The size and endian is dependent on the platform.
* The size and endian is dependent on the platform.
*
* p Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 1)
* #=> #<Socket::Option: INET SOCKET KEEPALIVE 1>
@ -169,7 +169,7 @@ sockopt_s_int(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vi
*
* Returns the data in _sockopt_ as an int.
*
* The size and endian is dependent on the platform.
* The size and endian is dependent on the platform.
*
* sockopt = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 1)
* p sockopt.int => 1
@ -280,7 +280,7 @@ sockopt_linger(VALUE self)
VALUE vonoff, vsecs;
if (level != SOL_SOCKET || optname != SO_LINGER)
rb_raise(rb_eTypeError, "linger socket option expected");
rb_raise(rb_eTypeError, "linger socket option expected");
if (RSTRING_LEN(data) != sizeof(l))
rb_raise(rb_eTypeError, "size differ. expected as sizeof(struct linger)=%d but %ld",
(int)sizeof(struct linger), (long)RSTRING_LEN(data));

View file

@ -743,7 +743,7 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype)
un.sun_family = AF_UNIX;
memcpy((void*)&un.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
init_addrinfo(rai, (struct sockaddr *)&un, sizeof(un), PF_UNIX, socktype, 0, Qnil, Qnil);
}
#endif
@ -766,9 +766,9 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype)
* Socket.sockaddr_in or Socket.unpack_sockaddr_un.
*
* sockaddr examples:
* - ["AF_INET", 46102, "localhost.localdomain", "127.0.0.1"]
* - ["AF_INET6", 42304, "ip6-localhost", "::1"]
* - ["AF_UNIX", "/tmp/sock"]
* - ["AF_INET", 46102, "localhost.localdomain", "127.0.0.1"]
* - ["AF_INET6", 42304, "ip6-localhost", "::1"]
* - ["AF_UNIX", "/tmp/sock"]
* - Socket.sockaddr_in("smtp", "2001:DB8::1")
* - Socket.sockaddr_in(80, "172.18.22.42")
* - Socket.sockaddr_in(80, "www.ruby-lang.org")
@ -1374,7 +1374,7 @@ addrinfo_protocol(VALUE self)
*
* returns the socket address as packed struct sockaddr string.
*
* Addrinfo.tcp("localhost", 80).to_sockaddr
* Addrinfo.tcp("localhost", 80).to_sockaddr
* #=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
*
*/
@ -1928,11 +1928,11 @@ addrinfo_unix_path(VALUE self)
* nodename or service can be nil if no conversion intended.
*
* family, socktype and protocol are hint for preferred protocol.
* If the result will be used for a socket with SOCK_STREAM,
* If the result will be used for a socket with SOCK_STREAM,
* SOCK_STREAM should be specified as socktype.
* If so, Addrinfo.getaddrinfo returns addrinfo list appropriate for SOCK_STREAM.
* If they are omitted or nil is given, the result is not restricted.
*
*
* Similarly, PF_INET6 as family restricts for IPv6.
*
* flags should be bitwise OR of Socket::AI_??? constants.

View file

@ -135,13 +135,13 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* socket.connect(remote_sockaddr) => 0
*
*
* Requests a connection to be made on the given +remote_sockaddr+. Returns 0 if
* successful, otherwise an exception is raised.
*
*
* === Parameter
* * +remote_sockaddr+ - the +struct+ sockaddr contained in a string or Addrinfo object
*
*
* === Example:
* # Pull down Google's web page
* require 'socket'
@ -150,17 +150,17 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
* sockaddr = Socket.pack_sockaddr_in( 80, 'www.google.com' )
* socket.connect( sockaddr )
* socket.write( "GET / HTTP/1.0\r\n\r\n" )
* results = socket.read
*
* results = socket.read
*
* === Unix-based Exceptions
* On unix-based systems the following system exceptions may be raised if
* On unix-based systems the following system exceptions may be raised if
* the call to _connect_ fails:
* * Errno::EACCES - search permission is denied for a component of the prefix
* path or write access to the +socket+ is denied
* * Errno::EADDRINUSE - the _sockaddr_ is already in use
* * Errno::EADDRNOTAVAIL - the specified _sockaddr_ is not available from the
* local machine
* * Errno::EAFNOSUPPORT - the specified _sockaddr_ is not a valid address for
* * Errno::EAFNOSUPPORT - the specified _sockaddr_ is not a valid address for
* the address family of the specified +socket+
* * Errno::EALREADY - a connection is already in progress for the specified
* socket
@ -169,7 +169,7 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
* refused the connection request
* * Errno::ECONNRESET - the remote host reset the connection request
* * Errno::EFAULT - the _sockaddr_ cannot be accessed
* * Errno::EHOSTUNREACH - the destination host cannot be reached (probably
* * Errno::EHOSTUNREACH - the destination host cannot be reached (probably
* because the host is down or a remote router cannot reach it)
* * Errno::EINPROGRESS - the O_NONBLOCK is set for the +socket+ and the
* connection cannot be immediately established; the connection will be
@ -179,46 +179,46 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
* asynchronously
* * Errno::EISCONN - the specified +socket+ is already connected
* * Errno::EINVAL - the address length used for the _sockaddr_ is not a valid
* length for the address family or there is an invalid family in _sockaddr_
* length for the address family or there is an invalid family in _sockaddr_
* * Errno::ENAMETOOLONG - the pathname resolved had a length which exceeded
* PATH_MAX
* * Errno::ENETDOWN - the local interface used to reach the destination is down
* * Errno::ENETUNREACH - no route to the network is present
* * Errno::ENOBUFS - no buffer space is available
* * Errno::ENOSR - there were insufficient STREAMS resources available to
* * Errno::ENOSR - there were insufficient STREAMS resources available to
* complete the operation
* * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket
* * Errno::EOPNOTSUPP - the calling +socket+ is listening and cannot be connected
* * Errno::EPROTOTYPE - the _sockaddr_ has a different type than the socket
* * Errno::EPROTOTYPE - the _sockaddr_ has a different type than the socket
* bound to the specified peer address
* * Errno::ETIMEDOUT - the attempt to connect time out before a connection
* was made.
*
*
* On unix-based systems if the address family of the calling +socket+ is
* AF_UNIX the follow exceptions may be raised if the call to _connect_
* fails:
* * Errno::EIO - an i/o error occurred while reading from or writing to the
* * Errno::EIO - an i/o error occurred while reading from or writing to the
* file system
* * Errno::ELOOP - too many symbolic links were encountered in translating
* the pathname in _sockaddr_
* * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
* * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
* characters, or an entire pathname exceeded PATH_MAX characters
* * Errno::ENOENT - a component of the pathname does not name an existing file
* or the pathname is an empty string
* * Errno::ENOTDIR - a component of the path prefix of the pathname in _sockaddr_
* is not a directory
*
* is not a directory
*
* === Windows Exceptions
* On Windows systems the following system exceptions may be raised if
* On Windows systems the following system exceptions may be raised if
* the call to _connect_ fails:
* * Errno::ENETDOWN - the network is down
* * Errno::EADDRINUSE - the socket's local address is already in use
* * Errno::EINTR - the socket was cancelled
* * Errno::EINPROGRESS - a blocking socket is in progress or the service provider
* is still processing a callback function. Or a nonblocking connect call is
* is still processing a callback function. Or a nonblocking connect call is
* in progress on the +socket+.
* * Errno::EALREADY - see Errno::EINVAL
* * Errno::EADDRNOTAVAIL - the remote address is not a valid address, such as
* * Errno::EADDRNOTAVAIL - the remote address is not a valid address, such as
* ADDR_ANY TODO check ADDRANY TO INADDR_ANY
* * Errno::EAFNOSUPPORT - addresses in the specified family cannot be used with
* with this +socket+
@ -234,11 +234,11 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
* * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket
* * Errno::ETIMEDOUT - the attempt to connect time out before a connection
* was made.
* * Errno::EWOULDBLOCK - the socket is marked as nonblocking and the
* * Errno::EWOULDBLOCK - the socket is marked as nonblocking and the
* connection cannot be completed immediately
* * Errno::EACCES - the attempt to connect the datagram socket to the
* * Errno::EACCES - the attempt to connect the datagram socket to the
* broadcast address failed
*
*
* === See
* * connect manual pages on unix-based systems
* * connect function in Microsoft's Winsock functions reference
@ -264,14 +264,14 @@ sock_connect(VALUE sock, VALUE addr)
/*
* call-seq:
* socket.connect_nonblock(remote_sockaddr) => 0
*
*
* Requests a connection to be made on the given +remote_sockaddr+ after
* O_NONBLOCK is set for the underlying file descriptor.
* Returns 0 if successful, otherwise an exception is raised.
*
*
* === Parameter
* * +remote_sockaddr+ - the +struct+ sockaddr contained in a string or Addrinfo object
*
*
* === Example:
* # Pull down Google's web page
* require 'socket'
@ -283,15 +283,15 @@ sock_connect(VALUE sock, VALUE addr)
* rescue IO::WaitWritable
* IO.select(nil, [socket]) # wait 3-way handshake completion
* begin
* socket.connect_nonblock(sockaddr) # check connection failure
* socket.connect_nonblock(sockaddr) # check connection failure
* rescue Errno::EISCONN
* end
* end
* socket.write("GET / HTTP/1.0\r\n\r\n")
* results = socket.read
*
* results = socket.read
*
* Refer to Socket#connect for the exceptions that may be thrown if the call
* to _connect_nonblock_ fails.
* to _connect_nonblock_ fails.
*
* Socket#connect_nonblock may raise any error corresponding to connect(2) failure,
* including Errno::EINPROGRESS.
@ -326,9 +326,9 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
/*
* call-seq:
* socket.bind(local_sockaddr) => 0
*
*
* Binds to the given local address.
*
*
* === Parameter
* * +local_sockaddr+ - the +struct+ sockaddr contained in a string or an Addrinfo object
*
@ -345,9 +345,9 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
* socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
* sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
* socket.bind( sockaddr )
*
*
* === Unix-based Exceptions
* On unix-based based systems the following system exceptions may be raised if
* On unix-based based systems the following system exceptions may be raised if
* the call to _bind_ fails:
* * Errno::EACCES - the specified _sockaddr_ is protected and the current
* user does not have permission to bind to it
@ -358,7 +358,7 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
* the family of the calling +socket+
* * Errno::EBADF - the _sockaddr_ specified is not a valid file descriptor
* * Errno::EFAULT - the _sockaddr_ argument cannot be accessed
* * Errno::EINVAL - the +socket+ is already bound to an address, and the
* * Errno::EINVAL - the +socket+ is already bound to an address, and the
* protocol does not support binding to the new _sockaddr_ or the +socket+
* has been shut down.
* * Errno::EINVAL - the address length is not a valid length for the address
@ -366,12 +366,12 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
* * Errno::ENAMETOOLONG - the pathname resolved had a length which exceeded
* PATH_MAX
* * Errno::ENOBUFS - no buffer space is available
* * Errno::ENOSR - there were insufficient STREAMS resources available to
* * Errno::ENOSR - there were insufficient STREAMS resources available to
* complete the operation
* * Errno::ENOTSOCK - the +socket+ does not refer to a socket
* * Errno::EOPNOTSUPP - the socket type of the +socket+ does not support
* * Errno::EOPNOTSUPP - the socket type of the +socket+ does not support
* binding to an address
*
*
* On unix-based based systems if the address family of the calling +socket+ is
* Socket::AF_UNIX the follow exceptions may be raised if the call to _bind_
* fails:
@ -382,19 +382,19 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
* * Errno::EIO - an i/o error occurred
* * Errno::ELOOP - too many symbolic links were encountered in translating
* the pathname in _sockaddr_
* * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
* * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
* characters, or an entire pathname exceeded PATH_MAX characters
* * Errno::ENOENT - a component of the pathname does not name an existing file
* or the pathname is an empty string
* * Errno::ENOTDIR - a component of the path prefix of the pathname in _sockaddr_
* is not a directory
* * Errno::EROFS - the name would reside on a read only filesystem
*
*
* === Windows Exceptions
* On Windows systems the following system exceptions may be raised if
* On Windows systems the following system exceptions may be raised if
* the call to _bind_ fails:
* * Errno::ENETDOWN-- the network is down
* * Errno::EACCES - the attempt to connect the datagram socket to the
* * Errno::EACCES - the attempt to connect the datagram socket to the
* broadcast address failed
* * Errno::EADDRINUSE - the socket's local address is already in use
* * Errno::EADDRNOTAVAIL - the specified address is not a valid address for this
@ -404,11 +404,11 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
* * Errno::EINVAL - the +socket+ is already bound to an address
* * Errno::ENOBUFS - no buffer space is available
* * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket
*
*
* === See
* * bind manual pages on unix-based systems
* * bind function in Microsoft's Winsock functions reference
*/
*/
static VALUE
sock_bind(VALUE sock, VALUE addr)
{
@ -425,14 +425,14 @@ sock_bind(VALUE sock, VALUE addr)
/*
* call-seq:
* socket.listen( int ) => 0
*
*
* Listens for connections, using the specified +int+ as the backlog. A call
* to _listen_ only applies if the +socket+ is of type SOCK_STREAM or
* to _listen_ only applies if the +socket+ is of type SOCK_STREAM or
* SOCK_SEQPACKET.
*
*
* === Parameter
* * +backlog+ - the maximum length of the queue for pending connections.
*
*
* === Example 1
* require 'socket'
* include Socket::Constants
@ -440,43 +440,43 @@ sock_bind(VALUE sock, VALUE addr)
* sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
* socket.bind( sockaddr )
* socket.listen( 5 )
*
*
* === Example 2 (listening on an arbitrary port, unix-based systems only):
* require 'socket'
* include Socket::Constants
* socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
* socket.listen( 1 )
*
*
* === Unix-based Exceptions
* On unix based systems the above will work because a new +sockaddr+ struct
* is created on the address ADDR_ANY, for an arbitrary port number as handed
* off by the kernel. It will not work on Windows, because Windows requires that
* the +socket+ is bound by calling _bind_ before it can _listen_.
*
*
* If the _backlog_ amount exceeds the implementation-dependent maximum
* queue length, the implementation's maximum queue length will be used.
*
*
* On unix-based based systems the following system exceptions may be raised if the
* call to _listen_ fails:
* * Errno::EBADF - the _socket_ argument is not a valid file descriptor
* * Errno::EDESTADDRREQ - the _socket_ is not bound to a local address, and
* * Errno::EDESTADDRREQ - the _socket_ is not bound to a local address, and
* the protocol does not support listening on an unbound socket
* * Errno::EINVAL - the _socket_ is already connected
* * Errno::ENOTSOCK - the _socket_ argument does not refer to a socket
* * Errno::EOPNOTSUPP - the _socket_ protocol does not support listen
* * Errno::EACCES - the calling process does not have appropriate privileges
* * Errno::EINVAL - the _socket_ has been shut down
* * Errno::ENOBUFS - insufficient resources are available in the system to
* * Errno::ENOBUFS - insufficient resources are available in the system to
* complete the call
*
*
* === Windows Exceptions
* On Windows systems the following system exceptions may be raised if
* On Windows systems the following system exceptions may be raised if
* the call to _listen_ fails:
* * Errno::ENETDOWN - the network is down
* * Errno::EADDRINUSE - the socket's local address is already in use. This
* * Errno::EADDRINUSE - the socket's local address is already in use. This
* usually occurs during the execution of _bind_ but could be delayed
* if the call to _bind_ was to a partially wildcard address (involving
* ADDR_ANY) and if a specific address needs to be committed at the
* ADDR_ANY) and if a specific address needs to be committed at the
* time of the call to _listen_
* * Errno::EINPROGRESS - a Windows Sockets 1.1 call is in progress or the
* service provider is still processing a callback function
@ -487,7 +487,7 @@ sock_bind(VALUE sock, VALUE addr)
* * Errno::ENOTSOC - +socket+ is not a socket
* * Errno::EOPNOTSUPP - the referenced +socket+ is not a type that supports
* the _listen_ method
*
*
* === See
* * listen manual pages on unix-based systems
* * listen function in Microsoft's Winsock functions reference
@ -511,16 +511,16 @@ rsock_sock_listen(VALUE sock, VALUE log)
* call-seq:
* socket.recvfrom(maxlen) => [mesg, sender_addrinfo]
* socket.recvfrom(maxlen, flags) => [mesg, sender_addrinfo]
*
*
* Receives up to _maxlen_ bytes from +socket+. _flags_ is zero or more
* of the +MSG_+ options. The first element of the results, _mesg_, is the data
* received. The second element, _sender_addrinfo_, contains protocol-specific
* address information of the sender.
*
*
* === Parameters
* * +maxlen+ - the maximum number of bytes to receive from the socket
* * +flags+ - zero or more of the +MSG_+ options
*
* * +flags+ - zero or more of the +MSG_+ options
*
* === Example
* # In one file, start this first
* require 'socket'
@ -534,7 +534,7 @@ rsock_sock_listen(VALUE sock, VALUE log)
* puts "I only received 20 bytes '#{data}'"
* sleep 1
* socket.close
*
*
* # In another file, start this second
* require 'socket'
* include Socket::Constants
@ -542,29 +542,29 @@ rsock_sock_listen(VALUE sock, VALUE log)
* sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
* socket.connect( sockaddr )
* socket.puts "Watch this get cut short!"
* socket.close
*
* socket.close
*
* === Unix-based Exceptions
* On unix-based based systems the following system exceptions may be raised if the
* call to _recvfrom_ fails:
* * Errno::EAGAIN - the +socket+ file descriptor is marked as O_NONBLOCK and no
* data is waiting to be received; or MSG_OOB is set and no out-of-band data
* is available and either the +socket+ file descriptor is marked as
* O_NONBLOCK or the +socket+ does not support blocking to wait for
* is available and either the +socket+ file descriptor is marked as
* O_NONBLOCK or the +socket+ does not support blocking to wait for
* out-of-band-data
* * Errno::EWOULDBLOCK - see Errno::EAGAIN
* * Errno::EBADF - the +socket+ is not a valid file descriptor
* * Errno::ECONNRESET - a connection was forcibly closed by a peer
* * Errno::EFAULT - the socket's internal buffer, address or address length
* * Errno::EFAULT - the socket's internal buffer, address or address length
* cannot be accessed or written
* * Errno::EINTR - a signal interrupted _recvfrom_ before any data was available
* * Errno::EINVAL - the MSG_OOB flag is set and no out-of-band data is available
* * Errno::EIO - an i/o error occurred while reading from or writing to the
* * Errno::EIO - an i/o error occurred while reading from or writing to the
* filesystem
* * Errno::ENOBUFS - insufficient resources were available in the system to
* * Errno::ENOBUFS - insufficient resources were available in the system to
* perform the operation
* * Errno::ENOMEM - insufficient memory was available to fulfill the request
* * Errno::ENOSR - there were insufficient STREAMS resources available to
* * Errno::ENOSR - there were insufficient STREAMS resources available to
* complete the operation
* * Errno::ENOTCONN - a receive is attempted on a connection-mode socket that
* is not connected
@ -572,9 +572,9 @@ rsock_sock_listen(VALUE sock, VALUE log)
* * Errno::EOPNOTSUPP - the specified flags are not supported for this socket type
* * Errno::ETIMEDOUT - the connection timed out during connection establishment
* or due to a transmission timeout on an active connection
*
*
* === Windows Exceptions
* On Windows systems the following system exceptions may be raised if
* On Windows systems the following system exceptions may be raised if
* the call to _recvfrom_ fails:
* * Errno::ENETDOWN - the network is down
* * Errno::EFAULT - the internal buffer and from parameters on +socket+ are not
@ -582,31 +582,31 @@ rsock_sock_listen(VALUE sock, VALUE log)
* too small to accommodate the peer address
* * Errno::EINTR - the (blocking) call was cancelled by an internal call to
* the WinSock function WSACancelBlockingCall
* * Errno::EINPROGRESS - a blocking Windows Sockets 1.1 call is in progress or
* * Errno::EINPROGRESS - a blocking Windows Sockets 1.1 call is in progress or
* the service provider is still processing a callback function
* * Errno::EINVAL - +socket+ has not been bound with a call to _bind_, or an
* unknown flag was specified, or MSG_OOB was specified for a socket with
* SO_OOBINLINE enabled, or (for byte stream-style sockets only) the internal
* len parameter on +socket+ was zero or negative
* * Errno::EISCONN - +socket+ is already connected. The call to _recvfrom_ is
* not permitted with a connected socket on a socket that is connection
* not permitted with a connected socket on a socket that is connection
* oriented or connectionless.
* * Errno::ENETRESET - the connection has been broken due to the keep-alive
* * Errno::ENETRESET - the connection has been broken due to the keep-alive
* activity detecting a failure while the operation was in progress.
* * Errno::EOPNOTSUPP - MSG_OOB was specified, but +socket+ is not stream-style
* such as type SOCK_STREAM. OOB data is not supported in the communication
* domain associated with +socket+, or +socket+ is unidirectional and
* domain associated with +socket+, or +socket+ is unidirectional and
* supports only send operations
* * Errno::ESHUTDOWN - +socket+ has been shutdown. It is not possible to
* * Errno::ESHUTDOWN - +socket+ has been shutdown. It is not possible to
* call _recvfrom_ on a socket after _shutdown_ has been invoked.
* * Errno::EWOULDBLOCK - +socket+ is marked as nonblocking and a call to
* * Errno::EWOULDBLOCK - +socket+ is marked as nonblocking and a call to
* _recvfrom_ would block.
* * Errno::EMSGSIZE - the message was too large to fit into the specified buffer
* and was truncated.
* * Errno::ETIMEDOUT - the connection has been dropped, because of a network
* failure or because the system on the other end went down without
* notice
* * Errno::ECONNRESET - the virtual circuit was reset by the remote side
* * Errno::ECONNRESET - the virtual circuit was reset by the remote side
* executing a hard or abortive close. The application should close the
* socket; it is no longer usable. On a UDP-datagram socket this error
* indicates a previous send operation resulted in an ICMP Port Unreachable
@ -622,7 +622,7 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
* call-seq:
* socket.recvfrom_nonblock(maxlen) => [mesg, sender_addrinfo]
* socket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_addrinfo]
*
*
* Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
* O_NONBLOCK is set for the underlying file descriptor.
* _flags_ is zero or more of the +MSG_+ options.
@ -633,11 +633,11 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
* When recvfrom(2) returns 0, Socket#recvfrom_nonblock returns
* an empty string as data.
* The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
*
*
* === Parameters
* * +maxlen+ - the maximum number of bytes to receive from the socket
* * +flags+ - zero or more of the +MSG_+ options
*
* * +flags+ - zero or more of the +MSG_+ options
*
* === Example
* # In one file, start this first
* require 'socket'
@ -657,7 +657,7 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
* puts "I only received 20 bytes '#{data}'"
* sleep 1
* socket.close
*
*
* # In another file, start this second
* require 'socket'
* include Socket::Constants
@ -665,10 +665,10 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
* sockaddr = Socket.sockaddr_in(2200, 'localhost')
* socket.connect(sockaddr)
* socket.puts "Watch this get cut short!"
* socket.close
*
* socket.close
*
* Refer to Socket#recvfrom for the exceptions that may be thrown if the call
* to _recvfrom_nonblock_ fails.
* to _recvfrom_nonblock_ fails.
*
* Socket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
* including Errno::EWOULDBLOCK.
@ -717,13 +717,13 @@ sock_accept(VALUE sock)
/*
* call-seq:
* socket.accept_nonblock => [client_socket, client_addrinfo]
*
*
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
* It returns an array containing the accepted socket
* for the incoming connection, _client_socket_,
* and an Addrinfo, _client_addrinfo_.
*
*
* === Example
* # In one script, start this first
* require 'socket'
@ -741,19 +741,19 @@ sock_accept(VALUE sock)
* puts "The client said, '#{client_socket.readline.chomp}'"
* client_socket.puts "Hello from script one!"
* socket.close
*
*
* # In another script, start this second
* require 'socket'
* include Socket::Constants
* socket = Socket.new(AF_INET, SOCK_STREAM, 0)
* sockaddr = Socket.sockaddr_in(2200, 'localhost')
* socket.connect(sockaddr)
* socket.puts "Hello from script 2."
* socket.puts "Hello from script 2."
* puts "The server said, '#{socket.readline.chomp}'"
* socket.close
*
*
* Refer to Socket#accept for the exceptions that may be thrown if the call
* to _accept_nonblock_ fails.
* to _accept_nonblock_ fails.
*
* Socket#accept_nonblock may raise any error corresponding to accept(2) failure,
* including Errno::EWOULDBLOCK.
@ -761,7 +761,7 @@ sock_accept(VALUE sock)
* If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED or Errno::EPROTO,
* it is extended by IO::WaitReadable.
* So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
*
*
* === See
* * Socket#accept
*/
@ -781,11 +781,11 @@ sock_accept_nonblock(VALUE sock)
/*
* call-seq:
* socket.sysaccept => [client_socket_fd, client_addrinfo]
*
*
* Accepts an incoming connection returning an array containing the (integer)
* file descriptor for the incoming connection, _client_socket_fd_,
* and an Addrinfo, _client_addrinfo_.
*
*
* === Example
* # In one script, start this first
* require 'socket'
@ -799,20 +799,20 @@ sock_accept_nonblock(VALUE sock)
* puts "The client said, '#{client_socket.readline.chomp}'"
* client_socket.puts "Hello from script one!"
* socket.close
*
*
* # In another script, start this second
* require 'socket'
* include Socket::Constants
* socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
* sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
* socket.connect( sockaddr )
* socket.puts "Hello from script 2."
* socket.puts "Hello from script 2."
* puts "The server said, '#{socket.readline.chomp}'"
* socket.close
*
*
* Refer to Socket#accept for the exceptions that may be thrown if the call
* to _sysaccept_ fails.
*
* to _sysaccept_ fails.
*
* === See
* * Socket#accept
*/
@ -944,7 +944,7 @@ sock_s_gethostbyname(VALUE obj, VALUE host)
*
* Obtains the host information for _address_.
*
* p Socket.gethostbyaddr([221,186,184,68].pack("CCCC"))
* p Socket.gethostbyaddr([221,186,184,68].pack("CCCC"))
* #=> ["carbon.ruby-lang.org", [], 2, "\xDD\xBA\xB8D"]
*/
static VALUE
@ -1009,7 +1009,7 @@ sock_s_gethostbyaddr(int argc, VALUE *argv)
* Socket.getservbyname("smtp") #=> 25
* Socket.getservbyname("shell") #=> 514
* Socket.getservbyname("syslog", "udp") #=> 514
*/
*/
static VALUE
sock_s_getservbyname(int argc, VALUE *argv)
{
@ -1394,7 +1394,7 @@ sock_s_pack_sockaddr_un(VALUE self, VALUE path)
*
* _sockaddr_ should be a string or an addrinfo for AF_UNIX.
*
* sockaddr = Socket.sockaddr_un("/tmp/sock")
* sockaddr = Socket.sockaddr_un("/tmp/sock")
* p Socket.unpack_sockaddr_un(sockaddr) #=> "/tmp/sock"
*
*/
@ -1800,15 +1800,15 @@ socket_s_ip_address_list(VALUE self)
* The constants defined under Socket::Constants are also defined under Socket.
* For example, Socket::AF_INET is usable as well as Socket::Constants::AF_INET.
* See Socket::Constants for the list of constants.
*
*
* === Exception Handling
* Ruby's implementation of +Socket+ causes an exception to be raised
* based on the error generated by the system dependent implementation.
* This is why the methods are documented in a way that isolate
* Unix-based system exceptions from Windows based exceptions. If more
* information on particular exception is needed please refer to the
* information on particular exception is needed please refer to the
* Unix manual pages or the Windows WinSock reference.
*
*
* === Convenient methods
*
* Although the general way to create socket is Socket.new,
@ -1818,14 +1818,14 @@ socket_s_ip_address_list(VALUE self)
* * TCP server socket: Socket.tcp_server_loop, TCPServer.open
* * UNIX client socket: Socket.unix, UNIXSocket.open
* * UNIX server socket: Socket.unix_server_loop, UNIXServer.open
*
*
* === Documentation by
* * Zach Dennis
* * Sam Roberts
* * <em>Programming Ruby</em> from The Pragmatic Bookshelf.
*
* Much material in this documentation is taken with permission from
* <em>Programming Ruby</em> from The Pragmatic Bookshelf.
* * <em>Programming Ruby</em> from The Pragmatic Bookshelf.
*
* Much material in this documentation is taken with permission from
* <em>Programming Ruby</em> from The Pragmatic Bookshelf.
*/
void
Init_socket()

View file

@ -41,7 +41,7 @@ tcp_svr_init(int argc, VALUE *argv, VALUE sock)
* s.puts Time.now
* s.close
* }
*
*
*/
static VALUE
tcp_accept(VALUE sock)
@ -49,7 +49,7 @@ tcp_accept(VALUE sock)
rb_io_t *fptr;
struct sockaddr_storage from;
socklen_t fromlen;
GetOpenFile(sock, fptr);
fromlen = sizeof(from);
return rsock_s_accept(rb_cTCPSocket, fptr->fd,
@ -59,11 +59,11 @@ tcp_accept(VALUE sock)
/*
* call-seq:
* tcpserver.accept_nonblock => tcpsocket
*
*
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
* It returns an accepted TCPSocket for the incoming connection.
*
*
* === Example
* require 'socket'
* serv = TCPServer.new(2202)
@ -74,9 +74,9 @@ tcp_accept(VALUE sock)
* retry
* end
* # sock is an accepted socket.
*
*
* Refer to Socket#accept for the exceptions that may be thrown if the call
* to TCPServer#accept_nonblock fails.
* to TCPServer#accept_nonblock fails.
*
* TCPServer#accept_nonblock may raise any error corresponding to accept(2) failure,
* including Errno::EWOULDBLOCK.
@ -84,7 +84,7 @@ tcp_accept(VALUE sock)
* If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED, Errno::EPROTO,
* it is extended by IO::WaitReadable.
* So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
*
*
* === See
* * TCPServer#accept
* * Socket#accept
@ -110,7 +110,7 @@ tcp_accept_nonblock(VALUE sock)
*
* TCPServer.open("127.0.0.1", 28561) {|serv|
* fd = serv.sysaccept
* s = IO.for_fd(fd)
* s = IO.for_fd(fd)
* s.puts Time.now
* s.close
* }

View file

@ -137,7 +137,7 @@ udp_bind(VALUE sock, VALUE host, VALUE port)
* udpsocket.send(mesg, flags) => numbytes_sent
*
* Sends _mesg_ via _udpsocket_.
*
*
* _flags_ should be a bitwise OR of Socket::MSG_* constants.
*
* u1 = UDPSocket.new
@ -195,7 +195,7 @@ udp_send(int argc, VALUE *argv, VALUE sock)
* call-seq:
* udpsocket.recvfrom_nonblock(maxlen) => [mesg, sender_inet_addr]
* udpsocket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_inet_addr]
*
*
* Receives up to _maxlen_ bytes from +udpsocket+ using recvfrom(2) after
* O_NONBLOCK is set for the underlying file descriptor.
* If _maxlen_ is omitted, its default value is 65536.
@ -206,11 +206,11 @@ udp_send(int argc, VALUE *argv, VALUE sock)
* When recvfrom(2) returns 0,
* Socket#recvfrom_nonblock returns an empty string as data.
* It means an empty packet.
*
*
* === Parameters
* * +maxlen+ - the number of bytes to receive from the socket
* * +flags+ - zero or more of the +MSG_+ options
*
* * +flags+ - zero or more of the +MSG_+ options
*
* === Example
* require 'socket'
* s1 = UDPSocket.new
@ -228,7 +228,7 @@ udp_send(int argc, VALUE *argv, VALUE sock)
* end
*
* Refer to Socket#recvfrom for the exceptions that may be thrown if the call
* to _recvfrom_nonblock_ fails.
* to _recvfrom_nonblock_ fails.
*
* UDPSocket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
* including Errno::EWOULDBLOCK.

View file

@ -60,11 +60,11 @@ unix_accept(VALUE sock)
/*
* call-seq:
* unixserver.accept_nonblock => unixsocket
*
*
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
* It returns an accepted UNIXSocket for the incoming connection.
*
*
* === Example
* require 'socket'
* serv = UNIXServer.new("/tmp/sock")
@ -75,9 +75,9 @@ unix_accept(VALUE sock)
* retry
* end
* # sock is an accepted socket.
*
*
* Refer to Socket#accept for the exceptions that may be thrown if the call
* to UNIXServer#accept_nonblock fails.
* to UNIXServer#accept_nonblock fails.
*
* UNIXServer#accept_nonblock may raise any error corresponding to accept(2) failure,
* including Errno::EWOULDBLOCK.
@ -85,7 +85,7 @@ unix_accept(VALUE sock)
* If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED or Errno::EPROTO,
* it is extended by IO::WaitReadable.
* So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
*
*
* === See
* * UNIXServer#accept
* * Socket#accept
@ -115,7 +115,7 @@ unix_accept_nonblock(VALUE sock)
* fd = serv.sysaccept
* s = IO.new(fd)
* s.puts "hi"
* s.close
* s.close
* p c.read #=> "hi\n"
* }
* }

View file

@ -89,7 +89,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
*
* s = UNIXSocket.new("/tmp/sock")
* s.send "hello", 0
*
*
*/
static VALUE
unix_init(VALUE sock, VALUE path)
@ -271,11 +271,11 @@ recvmsg_blocking(void *data)
* unixsocket.recv_io([klass [, mode]]) => io
*
* UNIXServer.open("/tmp/sock") {|serv|
* UNIXSocket.open("/tmp/sock") {|c|
* UNIXSocket.open("/tmp/sock") {|c|
* s = serv.accept
*
* c.send_io STDOUT
* stdout = s.recv_io
* c.send_io STDOUT
* stdout = s.recv_io
*
* p STDOUT.fileno #=> 1
* p stdout.fileno #=> 7

View file

@ -323,7 +323,7 @@ strio_set_string(VALUE self, VALUE string)
* call-seq:
* strio.close -> nil
*
* Closes strio. The *strio* is unavailable for any further data
* Closes strio. The *strio* is unavailable for any further data
* operations; an +IOError+ is raised if such an attempt is made.
*/
static VALUE
@ -420,7 +420,7 @@ strio_closed_write(VALUE self)
* strio.eof -> true or false
* strio.eof? -> true or false
*
* Returns true if *strio* is at end of file. The stringio must be
* Returns true if *strio* is at end of file. The stringio must be
* opened for reading or an +IOError+ will be raised.
*/
static VALUE
@ -496,7 +496,7 @@ strio_set_lineno(VALUE self, VALUE lineno)
* strio.reopen(other_StrIO) -> strio
* strio.reopen(string, mode) -> strio
*
* Reinitializes *strio* with the given <i>other_StrIO</i> or _string_
* Reinitializes *strio* with the given <i>other_StrIO</i> or _string_
* and _mode_ (see StringIO#new).
*/
static VALUE
@ -971,7 +971,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
break;
}
}
str = strio_substr(ptr, s - RSTRING_PTR(ptr->string), e - s);
str = strio_substr(ptr, s - RSTRING_PTR(ptr->string), e - s);
}
else if (n == 1) {
if ((p = memchr(s, RSTRING_PTR(str)[0], e - s)) != 0) {

View file

@ -29,7 +29,7 @@ struct strscanner
/* the string to scan */
VALUE str;
/* scan pointers */
long prev; /* legal only when MATCHED_P(s) */
long curr; /* always legal */
@ -173,7 +173,7 @@ static VALUE
strscan_s_allocate(VALUE klass)
{
struct strscanner *p;
p = ALLOC(struct strscanner);
MEMZERO(p, struct strscanner, 1);
CLEAR_MATCH_STATUS(p);
@ -609,7 +609,7 @@ strscan_exist_p(VALUE self, VALUE re)
*
* s = StringScanner.new("Fri Dec 12 1975 14:39")
* s.skip_until /12/ # -> 10
* s #
* s #
*/
static VALUE
strscan_skip_until(VALUE self, VALUE re)
@ -893,7 +893,7 @@ strscan_matched_p(VALUE self)
/*
* Returns the last matched string.
*
*
* s = StringScanner.new('test string')
* s.match?(/\w+/) # -> 4
* s.matched # -> "test"
@ -951,7 +951,7 @@ strscan_aref(VALUE self, VALUE idx)
GET_SCANNER(self, p);
if (! MATCHED_P(p)) return Qnil;
i = NUM2LONG(idx);
if (i < 0)
i += p->regs.num_regs;
@ -1141,20 +1141,20 @@ inspect2(struct strscanner *p)
/*
* Document-class: StringScanner
*
*
* StringScanner provides for lexical scanning operations on a String. Here is
* an example of its usage:
*
* s = StringScanner.new('This is an example string')
* s.eos? # -> false
*
*
* p s.scan(/\w+/) # -> "This"
* p s.scan(/\w+/) # -> nil
* p s.scan(/\s+/) # -> " "
* p s.scan(/\s+/) # -> nil
* p s.scan(/\w+/) # -> "is"
* s.eos? # -> false
*
*
* p s.scan(/\s+/) # -> " "
* p s.scan(/\w+/) # -> "an"
* p s.scan(/\s+/) # -> " "
@ -1162,7 +1162,7 @@ inspect2(struct strscanner *p)
* p s.scan(/\s+/) # -> " "
* p s.scan(/\w+/) # -> "string"
* s.eos? # -> true
*
*
* p s.scan(/\s+/) # -> nil
* p s.scan(/\w+/) # -> nil
*
@ -1191,7 +1191,7 @@ inspect2(struct strscanner *p)
* the string without actually scanning. You can access the most recent match.
* You can modify the string being scanned, reset or terminate the scanner,
* find out or change the position of the scan pointer, skip ahead, and so on.
*
*
* === Advancing the Scan Pointer
*
* - #getch
@ -1222,7 +1222,7 @@ inspect2(struct strscanner *p)
* - #reset
* - #terminate
* - #pos=
*
*
* === Match Data
*
* - #matched
@ -1259,7 +1259,7 @@ Init_strscan()
tmp = rb_str_new2("$Id$");
rb_obj_freeze(tmp);
rb_const_set(StringScanner, rb_intern("Id"), tmp);
rb_define_alloc_func(StringScanner, strscan_s_allocate);
rb_define_private_method(StringScanner, "initialize", strscan_initialize, -1);
rb_define_private_method(StringScanner, "initialize_copy", strscan_init_copy, 1);

View file

@ -98,7 +98,7 @@ char *get_inline( SyckParser *parser );
if ( reset == 1 ) YYPOS(0); \
return YAML_IOPEN; \
} \
}
}
/*
* Nice little macro to ensure closure of levels.
@ -135,7 +135,7 @@ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser )
{
SyckLevel *lvl;
syck_parser_ptr = parser;
if ( YYCURSOR == NULL )
if ( YYCURSOR == NULL )
{
syck_parser_read( parser );
}
@ -289,7 +289,7 @@ yy17: ++YYCURSOR;
goto yy18;
yy18:
#line 288 "bytecode.re"
{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str);
{ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str);
goto Scalar;
}
#line 296 "<stdout>"
@ -392,7 +392,7 @@ yy28:
{ CHK_NL(YYCURSOR);
if ( lvl->status == syck_lvl_seq )
{
return YAML_INDENT;
return YAML_INDENT;
}
else if ( lvl->status == syck_lvl_map )
{
@ -434,12 +434,12 @@ yy33:
FORCE_NEXT_TOKEN( '}' );
return '{';
}
POP_LEVEL();
lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_seq )
{
FORCE_NEXT_TOKEN(YAML_INDENT);
FORCE_NEXT_TOKEN(YAML_INDENT);
}
else if ( lvl->status == syck_lvl_map )
{
@ -494,7 +494,7 @@ yy39:
{
complex = 1;
}
ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_map);
ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_map);
CHK_NL(YYCURSOR);
if ( complex )
{
@ -990,7 +990,7 @@ yy70: ++YYCURSOR;
yy71:
#line 461 "bytecode.re"
{ YYCURSOR = tok;
goto ScalarEnd;
goto ScalarEnd;
}
#line 996 "<stdout>"
yy72: ++YYCURSOR;
@ -1001,7 +1001,7 @@ yy72: ++YYCURSOR;
yy73:
#line 469 "bytecode.re"
{ CAT(str, cap, idx, tok[0]);
goto Scalar2;
goto Scalar2;
}
#line 1007 "<stdout>"
yy74: ++YYCURSOR;
@ -1071,7 +1071,7 @@ yy84:
#line 456 "bytecode.re"
{ CHK_NL(tok+1);
CAT(str, cap, idx, '\0');
goto Scalar2;
goto Scalar2;
}
#line 1077 "<stdout>"
}
@ -1139,7 +1139,7 @@ yy89: ++YYCURSOR;
yy90:
#line 515 "bytecode.re"
{ CAT(str, cap, idx, tok[0]);
goto Inline;
goto Inline;
}
#line 1145 "<stdout>"
yy91: ++YYCURSOR;

View file

@ -4,9 +4,9 @@
* $Author$
*
* Copyright (C) 2003 why the lucky stiff
*
*
* All Base64 code from Ruby's pack.c.
* Ruby is Copyright (C) 1993-2007 Yukihiro Matsumoto
* Ruby is Copyright (C) 1993-2007 Yukihiro Matsumoto
*/
#include "ruby/ruby.h"
@ -17,7 +17,7 @@
#define DEFAULT_ANCHOR_FORMAT "id%03d"
const char hex_table[] =
const char hex_table[] =
"0123456789ABCDEF";
static char b64_table[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@ -131,7 +131,7 @@ syck_new_emitter(void)
e->output_handler = NULL;
e->lvl_idx = 0;
e->lvl_capa = ALLOC_CT;
e->levels = S_ALLOC_N( SyckLevel, e->lvl_capa );
e->levels = S_ALLOC_N( SyckLevel, e->lvl_capa );
syck_emitter_reset_levels( e );
e->bonus = NULL;
return e;
@ -197,7 +197,7 @@ syck_emitter_pop_level( SyckEmitter *e )
free( e->levels[e->lvl_idx].domain );
}
void
void
syck_emitter_add_level( SyckEmitter *e, int len, enum syck_level_status status )
{
ASSERT( e != NULL );
@ -289,7 +289,7 @@ syck_emitter_write( SyckEmitter *e, const char *str, long len )
{
syck_emitter_clear( e );
}
/*
* Flush if at end of buffer
*/
@ -360,7 +360,7 @@ syck_emit( SyckEmitter *e, st_data_t n )
int indent = 0;
long x = 0;
SyckLevel *lvl = syck_emitter_current_level( e );
/*
* Determine headers.
*/
@ -485,7 +485,7 @@ void syck_emit_tag( SyckEmitter *e, const char *tag, const char *ignore )
lvl->anctag = 1;
}
/*
/*
* Emit a newline and an appropriately spaced indent.
*/
void syck_emit_indent( SyckEmitter *e )
@ -569,7 +569,7 @@ syck_scan_scalar( int req_width, const char *cursor, long len )
} else if ( len > 1 && cursor[len-2] == '\n' ) {
flags |= SCAN_MANYNL_E;
}
if (
if (
( len > 0 && ( cursor[0] == ' ' || cursor[0] == '\t' ) ) ||
( len > 1 && ( cursor[len-1] == ' ' || cursor[len-1] == '\t' ) )
) {
@ -594,7 +594,7 @@ syck_scan_scalar( int req_width, const char *cursor, long len )
flags |= SCAN_NEWLINE;
if ( len - i >= 3 && strncmp( &cursor[i+1], "---", 3 ) == 0 )
flags |= SCAN_DOCSEP;
if ( cursor[i+1] == ' ' || cursor[i+1] == '\t' )
if ( cursor[i+1] == ' ' || cursor[i+1] == '\t' )
flags |= SCAN_INDENTED;
if ( req_width > 0 && i - start > req_width )
flags |= SCAN_WIDE;
@ -618,12 +618,12 @@ syck_scan_scalar( int req_width, const char *cursor, long len )
}
/* remember, if plain collections get implemented, to add nb-plain-flow-char */
else if ( ( cursor[i] == ' ' && cursor[i+1] == '#' ) ||
( cursor[i] == ':' &&
( cursor[i] == ':' &&
( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) ) )
{
flags |= SCAN_INDIC_C;
}
else if ( cursor[i] == ',' &&
else if ( cursor[i] == ',' &&
( cursor[i+1] == ' ' || cursor[i+1] == '\n' || i == len - 1 ) )
{
flags |= SCAN_FLOWMAP;
@ -647,12 +647,12 @@ void syck_emit_scalar( SyckEmitter *e, const char *tag, enum scalar_style force_
int scan = 0;
const char *match_implicit;
char *implicit;
if ( str == NULL ) str = "";
/* No empty nulls as map keys */
if ( len == 0 && ( parent->status == syck_lvl_map || parent->status == syck_lvl_imap ) &&
parent->ncount % 2 == 1 && syck_tagcmp( tag, "tag:yaml.org,2002:null" ) == 0 )
if ( len == 0 && ( parent->status == syck_lvl_map || parent->status == syck_lvl_imap ) &&
parent->ncount % 2 == 1 && syck_tagcmp( tag, "tag:yaml.org,2002:null" ) == 0 )
{
str = "~";
len = 1;
@ -668,8 +668,8 @@ void syck_emit_scalar( SyckEmitter *e, const char *tag, enum scalar_style force_
} else {
/* complex key */
if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 &&
( !( tag == NULL ||
( implicit != NULL && syck_tagcmp( tag, implicit ) == 0 && e->explicit_typing == 0 ) ) ) )
( !( tag == NULL ||
( implicit != NULL && syck_tagcmp( tag, implicit ) == 0 && e->explicit_typing == 0 ) ) ) )
{
syck_emitter_write( e, "? ", 2 );
parent->status = syck_lvl_mapx;

View file

@ -1216,7 +1216,7 @@ yyreduce:
case 8:
#line 76 "gram.y"
{
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1232,7 +1232,7 @@ yyreduce:
case 10:
#line 86 "gram.y"
{
{
/*
* _Anchors_: The language binding must keep a separate symbol table
* for anchors. The actual ID in the symbol table is returned to the
@ -1266,7 +1266,7 @@ yyreduce:
case 16:
#line 114 "gram.y"
{
{
if ( ((SyckParser *)parser)->implicit_typing == 1 )
{
try_tag_implicit( yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
@ -1277,7 +1277,7 @@ yyreduce:
case 17:
#line 122 "gram.y"
{
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1293,7 +1293,7 @@ yyreduce:
case 19:
#line 132 "gram.y"
{
{
/*
* _Anchors_: The language binding must keep a separate symbol table
* for anchors. The actual ID in the symbol table is returned to the
@ -1305,7 +1305,7 @@ yyreduce:
case 26:
#line 165 "gram.y"
{
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1313,7 +1313,7 @@ yyreduce:
case 27:
#line 170 "gram.y"
{
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1321,7 +1321,7 @@ yyreduce:
case 28:
#line 175 "gram.y"
{
{
if ( ((SyckParser *)parser)->implicit_typing == 1 )
{
try_tag_implicit( yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
@ -1332,7 +1332,7 @@ yyreduce:
case 29:
#line 183 "gram.y"
{
{
yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
}
break;
@ -1350,7 +1350,7 @@ yyreduce:
case 31:
#line 195 "gram.y"
{
{
SyckNode *n = yyvsp[0].nodeData;
if ( ((SyckParser *)parser)->taguri_expansion == 1 )
{
@ -1373,28 +1373,28 @@ yyreduce:
case 39:
#line 229 "gram.y"
{
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
case 40:
#line 233 "gram.y"
{
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
case 41:
#line 239 "gram.y"
{
{
yyval.nodeId = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
}
break;
case 42:
#line 245 "gram.y"
{
{
syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1402,7 +1402,7 @@ yyreduce:
case 43:
#line 250 "gram.y"
{
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1410,7 +1410,7 @@ yyreduce:
case 44:
#line 255 "gram.y"
{
{
syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1418,7 +1418,7 @@ yyreduce:
case 45:
#line 260 "gram.y"
{
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1426,14 +1426,14 @@ yyreduce:
case 46:
#line 265 "gram.y"
{
{
yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
}
break;
case 47:
#line 269 "gram.y"
{
{
yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
}
break;
@ -1447,7 +1447,7 @@ yyreduce:
case 49:
#line 279 "gram.y"
{
{
syck_seq_add( yyvsp[-2].nodeData, yyvsp[0].nodeId );
yyval.nodeData = yyvsp[-2].nodeData;
}
@ -1455,21 +1455,21 @@ yyreduce:
case 50:
#line 284 "gram.y"
{
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
case 51:
#line 293 "gram.y"
{
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
case 52:
#line 297 "gram.y"
{
{
yyval.nodeData = syck_alloc_seq();
}
break;
@ -1483,7 +1483,7 @@ yyreduce:
case 54:
#line 307 "gram.y"
{
{
syck_seq_add( yyvsp[-2].nodeData, syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
yyval.nodeData = yyvsp[-2].nodeData;
}
@ -1491,7 +1491,7 @@ yyreduce:
case 57:
#line 321 "gram.y"
{
{
apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
yyval.nodeData = yyvsp[-1].nodeData;
}
@ -1499,7 +1499,7 @@ yyreduce:
case 58:
#line 326 "gram.y"
{
{
apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
yyval.nodeData = yyvsp[-1].nodeData;
}
@ -1507,7 +1507,7 @@ yyreduce:
case 59:
#line 333 "gram.y"
{
{
syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1515,7 +1515,7 @@ yyreduce:
case 60:
#line 338 "gram.y"
{
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1523,7 +1523,7 @@ yyreduce:
case 61:
#line 343 "gram.y"
{
{
syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1531,7 +1531,7 @@ yyreduce:
case 62:
#line 348 "gram.y"
{
{
syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
yyval.nodeData = yyvsp[0].nodeData;
}
@ -1539,14 +1539,14 @@ yyreduce:
case 63:
#line 353 "gram.y"
{
{
yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
}
break;
case 64:
#line 357 "gram.y"
{
{
yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
}
break;
@ -1561,8 +1561,8 @@ yyreduce:
case 68:
#line 380 "gram.y"
{
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
}
break;
@ -1603,8 +1603,8 @@ yyreduce:
case 73:
#line 427 "gram.y"
{
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
}
break;
@ -1637,8 +1637,8 @@ yyreduce:
#line 455 "gram.y"
{
NULL_NODE( parser, n );
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ),
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ),
syck_hdlr_add_node( (SyckParser *)parser, n ) );
}
break;

View file

@ -9,12 +9,12 @@
#include "ruby/ruby.h"
#include "syck.h"
SYMID
SYMID
syck_hdlr_add_node( SyckParser *p, SyckNode *n )
{
SYMID id;
if ( ! n->id )
if ( ! n->id )
{
n->id = (p->handler)( p, n );
}
@ -89,7 +89,7 @@ syck_hdlr_get_anchor( SyckParser *p, char *a )
if ( st_lookup( p->anchors, (st_data_t)a, (void *)&n ) )
{
if ( n != (void *)1 )
{
{
S_FREE( a );
return n;
}
@ -116,7 +116,7 @@ syck_hdlr_get_anchor( SyckParser *p, char *a )
if ( n->anchor )
{
S_FREE( a );
}
}
else
{
n->anchor = a;
@ -165,7 +165,7 @@ syck_taguri( const char *domain, const char *type_id, int type_len )
return uri;
}
int
int
syck_try_implicit( SyckNode *n )
{
return 1;

View file

@ -59,7 +59,7 @@ syck_alloc_map(void)
n = syck_alloc_node( syck_map_kind );
n->data.pairs = m;
return n;
}
@ -94,7 +94,7 @@ syck_alloc_str(void)
n = syck_alloc_node( syck_str_kind );
n->data.str = s;
return n;
}
@ -128,7 +128,7 @@ syck_replace_str( SyckNode *n, char *str, enum scalar_style style )
void
syck_replace_str2( SyckNode *n, char *str, long len, enum scalar_style style )
{
if ( n->data.str->ptr != NULL )
if ( n->data.str->ptr != NULL )
{
S_FREE( n->data.str->ptr );
n->data.str->ptr = NULL;
@ -201,7 +201,7 @@ syck_map_add( SyckNode *map, SYMID key, SYMID value )
ASSERT( map != NULL );
ASSERT( map->data.pairs != NULL );
m = map->data.pairs;
idx = m->idx;
m->idx += 1;
@ -226,7 +226,7 @@ syck_map_update( SyckNode *map1, SyckNode *map2 )
m1 = map1->data.pairs;
m2 = map2->data.pairs;
if ( m2->idx < 1 ) return;
new_idx = m1->idx;
new_idx += m2->idx;
new_capa = m1->capa;
@ -242,8 +242,8 @@ syck_map_update( SyckNode *map1, SyckNode *map2 )
}
for ( new_idx = 0; new_idx < m2->idx; m1->idx++, new_idx++ )
{
m1->keys[m1->idx] = m2->keys[new_idx];
m1->values[m1->idx] = m2->values[new_idx];
m1->keys[m1->idx] = m2->keys[new_idx];
m1->values[m1->idx] = m2->values[new_idx];
}
}
@ -324,7 +324,7 @@ syck_seq_add( SyckNode *arr, SYMID value )
ASSERT( arr != NULL );
ASSERT( arr->data.list != NULL );
s = arr->data.list;
idx = s->idx;
s->idx += 1;
@ -374,7 +374,7 @@ syck_free_members( SyckNode *n )
switch ( n->kind )
{
case syck_str_kind:
if ( n->data.str != NULL )
if ( n->data.str != NULL )
{
S_FREE( n->data.str->ptr );
n->data.str->ptr = NULL;

View file

@ -196,7 +196,7 @@ VALUE
syck_get_hash_aref(VALUE hsh, VALUE key)
{
VALUE val = rb_hash_aref( hsh, key );
if ( NIL_P( val ) )
if ( NIL_P( val ) )
{
val = rb_hash_new();
rb_hash_aset(hsh, key, val);
@ -537,11 +537,11 @@ yaml_org_handler( SyckNode *n, VALUE *ref )
obj = rb_funcall( cDefaultKey, s_new, 0 );
}
else if ( n->data.str->style == scalar_plain &&
n->data.str->len > 1 &&
n->data.str->len > 1 &&
strncmp( n->data.str->ptr, ":", 1 ) == 0 )
{
obj = rb_funcall( oDefaultResolver, s_transfer, 2,
rb_str_new2( "tag:ruby.yaml.org,2002:sym" ),
obj = rb_funcall( oDefaultResolver, s_transfer, 2,
rb_str_new2( "tag:ruby.yaml.org,2002:sym" ),
rb_str_new( n->data.str->ptr + 1, n->data.str->len - 1 ) );
}
else if ( strcmp( type_id, "str" ) == 0 )
@ -644,7 +644,7 @@ rb_syck_load_handler(SyckParser *p, SyckNode *n)
}
/*
* Create node,
* Create node,
*/
obj = rb_funcall( resolver, s_node_import, 1, Data_Wrap_Struct( cNode, NULL, NULL, n ) );
@ -680,8 +680,8 @@ rb_syck_err_handler(SyckParser *p, const char *msg)
rb_raise(rb_eArgError, "%s on line %d, col %"PRIdPTRDIFF": `%s'",
msg,
p->linect,
p->cursor - p->lineptr,
p->lineptr);
p->cursor - p->lineptr,
p->lineptr);
}
/*
@ -715,7 +715,7 @@ syck_set_model(VALUE p, VALUE input, VALUE model)
if ( NIL_P( input ) )
{
input = rb_ivar_get( p, s_input );
input = rb_ivar_get( p, s_input );
}
if ( input == sym_bytecode )
{
@ -773,7 +773,7 @@ rb_syck_free_parser(SyckParser *p)
* YAML::Syck::Parser.allocate
*/
VALUE syck_parser_s_alloc _((VALUE));
VALUE
VALUE
syck_parser_s_alloc(VALUE class)
{
VALUE pobj;
@ -880,7 +880,7 @@ syck_parser_load_documents(int argc, VALUE *argv, VALUE self)
model = rb_hash_aref( rb_attr_get( self, s_options ), sym_model );
Data_Get_Struct(self, SyckParser, parser);
syck_set_model( self, input, model );
bonus = (struct parser_xtra *)parser->bonus;
bonus->taint = syck_parser_assign_io(parser, &port);
bonus->resolver = rb_attr_get( self, s_resolver );
@ -947,7 +947,7 @@ syck_resolver_use_types_at(VALUE self, VALUE hsh)
}
/*
* YAML::Syck::Resolver#detect_implicit
* YAML::Syck::Resolver#detect_implicit
*/
VALUE
syck_resolver_detect_implicit(VALUE self, VALUE val)
@ -1075,7 +1075,7 @@ syck_const_find(VALUE const_name)
VALUE
syck_resolver_transfer(VALUE self, VALUE type, VALUE val)
{
if (NIL_P(type) || RSTRING_LEN(StringValue(type)) == 0)
if (NIL_P(type) || RSTRING_LEN(StringValue(type)) == 0)
{
type = rb_funcall( self, s_detect_implicit, 1, val );
}
@ -1123,7 +1123,7 @@ syck_resolver_transfer(VALUE self, VALUE type, VALUE val)
subclass = rb_funcall( target_class, s_tag_read_class, 1, subclass );
subclass_v = syck_const_find( subclass );
if ( subclass_v != Qnil )
if ( subclass_v != Qnil )
{
subclass = subclass_v;
}
@ -1177,7 +1177,7 @@ syck_resolver_transfer(VALUE self, VALUE type, VALUE val)
rb_block_call( val, s_each, 0, 0, syck_set_ivars, obj );
}
}
else
else
{
VALUE parts = rb_str_split( type, ":" );
VALUE scheme = rb_ary_shift( parts );
@ -1219,7 +1219,7 @@ syck_resolver_tagurize(VALUE self, VALUE val)
}
/*
* YAML::Syck::DefaultResolver#detect_implicit
* YAML::Syck::DefaultResolver#detect_implicit
*/
VALUE
syck_defaultresolver_detect_implicit(VALUE self, VALUE val)
@ -1278,19 +1278,19 @@ syck_genericresolver_node_import(VALUE self, VALUE node)
if ( n->data.str->style == scalar_1quote )
{
style = sym_1quote;
}
}
else if ( n->data.str->style == scalar_2quote )
{
style = sym_2quote;
}
}
else if ( n->data.str->style == scalar_fold )
{
style = sym_fold;
}
}
else if ( n->data.str->style == scalar_literal )
{
style = sym_literal;
}
}
else if ( n->data.str->style == scalar_plain )
{
style = sym_plain;
@ -1308,7 +1308,7 @@ syck_genericresolver_node_import(VALUE self, VALUE node)
if ( n->data.list->style == seq_inline )
{
style = sym_inline;
}
}
obj = rb_funcall( cSeq, s_new, 3, t, v, style );
rb_iv_set(obj, "@kind", sym_seq);
break;
@ -1322,7 +1322,7 @@ syck_genericresolver_node_import(VALUE self, VALUE node)
if ( n->data.pairs->style == map_inline )
{
style = sym_inline;
}
}
obj = rb_funcall( cMap, s_new, 3, t, v, style );
rb_iv_set(obj, "@kind", sym_map);
break;
@ -1347,8 +1347,8 @@ syck_badalias_initialize(VALUE self, VALUE val)
VALUE
syck_badalias_cmp(VALUE alias1, VALUE alias2)
{
VALUE str1 = rb_ivar_get( alias1, s_name );
VALUE str2 = rb_ivar_get( alias2, s_name );
VALUE str1 = rb_ivar_get( alias1, s_name );
VALUE str2 = rb_ivar_get( alias2, s_name );
VALUE val = rb_funcall( str1, s_cmp, 1, str2 );
return val;
}
@ -1459,23 +1459,23 @@ syck_scalar_style_set(VALUE self, VALUE style)
if ( NIL_P( style ) )
{
node->data.str->style = scalar_none;
}
}
else if ( style == sym_1quote )
{
node->data.str->style = scalar_1quote;
}
}
else if ( style == sym_2quote )
{
node->data.str->style = scalar_2quote;
}
}
else if ( style == sym_fold )
{
node->data.str->style = scalar_fold;
}
}
else if ( style == sym_literal )
{
node->data.str->style = scalar_literal;
}
}
else if ( style == sym_plain )
{
node->data.str->style = scalar_plain;
@ -1587,7 +1587,7 @@ syck_seq_style_set(VALUE self, VALUE style)
if ( style == sym_inline )
{
node->data.list->style = seq_inline;
}
}
else
{
node->data.list->style = seq_none;
@ -1709,7 +1709,7 @@ syck_map_style_set(VALUE self, VALUE style)
if ( style == sym_inline )
{
node->data.pairs->style = map_inline;
}
}
else
{
node->data.pairs->style = map_none;
@ -1865,7 +1865,7 @@ rb_syck_emitter_handler(SyckEmitter *e, st_data_t data)
/*
* Handle output from the emitter
*/
void
void
rb_syck_output_handler(SyckEmitter * emitter, char *str, long len)
{
struct emitter_xtra *bonus = (struct emitter_xtra *)emitter->bonus;
@ -1921,7 +1921,7 @@ rb_syck_free_emitter(SyckEmitter *e)
* YAML::Syck::Emitter.allocate
*/
VALUE syck_emitter_s_alloc _((VALUE));
VALUE
VALUE
syck_emitter_s_alloc(VALUE class)
{
VALUE pobj;
@ -1982,7 +1982,7 @@ syck_emitter_reset(int argc, VALUE *argv, VALUE self)
Check_Type(options, T_HASH);
rb_ivar_set(self, s_options, options);
}
emitter->headless = 0;
rb_ivar_set(self, s_level, INT2FIX(0));
rb_ivar_set(self, s_resolver, Qnil);
@ -2018,14 +2018,14 @@ syck_emitter_emit(int argc, VALUE *argv, VALUE self)
/* Second pass, build emitted string */
level -= 1;
rb_ivar_set(self, s_level, INT2FIX(level));
if ( level == 0 )
if ( level == 0 )
{
syck_emit(emitter, (st_data_t)symple);
syck_emitter_flush(emitter, 0);
return bonus->port;
}
return symple;
}

View file

@ -17,7 +17,7 @@ void syck_parser_pop_level( SyckParser * );
/*
* Custom assert
*/
void
void
syck_assert( const char *file_name, unsigned line_num, const char *expr )
{
fflush( NULL );
@ -160,7 +160,7 @@ syck_new_parser(void)
p = S_ALLOC( SyckParser );
S_MEMZERO( p, SyckParser, 1 );
p->lvl_capa = ALLOC_CT;
p->levels = S_ALLOC_N( SyckLevel, p->lvl_capa );
p->levels = S_ALLOC_N( SyckLevel, p->lvl_capa );
p->input_type = syck_yaml_utf8;
p->io_type = syck_io_str;
p->io.str = NULL;
@ -378,7 +378,7 @@ syck_parser_pop_level( SyckParser *p )
free( p->levels[p->lvl_idx].domain );
}
void
void
syck_parser_add_level( SyckParser *p, int len, enum syck_level_status status )
{
ASSERT( p != NULL );
@ -403,7 +403,7 @@ free_any_io( SyckParser *p )
switch ( p->io_type )
{
case syck_io_str:
if ( p->io.str != NULL )
if ( p->io.str != NULL )
{
S_FREE( p->io.str );
p->io.str = NULL;
@ -411,7 +411,7 @@ free_any_io( SyckParser *p )
break;
case syck_io_file:
if ( p->io.file != NULL )
if ( p->io.file != NULL )
{
S_FREE( p->io.file );
p->io.file = NULL;
@ -516,7 +516,7 @@ syck_parse( SyckParser *p )
void
syck_default_error_handler( SyckParser *p, const char *msg )
{
printf( "Error at [Line %d, Col %"PRIdPTRDIFF"]: %s\n",
printf( "Error at [Line %d, Col %"PRIdPTRDIFF"]: %s\n",
p->linect,
p->cursor - p->lineptr,
msg );

View file

@ -153,7 +153,7 @@ typedef struct _syck_level SyckLevel;
typedef SYMID (*SyckNodeHandler)(SyckParser *, SyckNode *);
typedef void (*SyckErrorHandler)(SyckParser *, const char *);
typedef SyckNode * (*SyckBadAnchorHandler)(SyckParser *, char *);
typedef long (*SyckIoFileRead)(char *, SyckIoFile *, long, long);
typedef long (*SyckIoFileRead)(char *, SyckIoFile *, long, long);
typedef long (*SyckIoStrRead)(char *, SyckIoStr *, long, long);
enum syck_io_type {
@ -205,7 +205,7 @@ struct _syck_str {
struct _syck_level {
/* Indent */
int spaces;
/* Counts nodes emitted at this level, useful for parsing
/* Counts nodes emitted at this level, useful for parsing
* keys and pairs in bytecode */
int ncount;
/* Does node have anchors or tags? */
@ -265,8 +265,8 @@ struct _syck_parser {
typedef struct _syck_emitter SyckEmitter;
typedef struct _syck_emitter_node SyckEmitterNode;
typedef void (*SyckOutputHandler)(SyckEmitter *, char *, long);
typedef void (*SyckEmitterHandler)(SyckEmitter *, st_data_t);
typedef void (*SyckOutputHandler)(SyckEmitter *, char *, long);
typedef void (*SyckEmitterHandler)(SyckEmitter *, st_data_t);
enum doc_stage {
doc_open,

View file

@ -70,7 +70,7 @@
if ( reset == 1 ) YYPOS(0); \
return YAML_IOPEN; \
} \
}
}
/*
* Nice little macro to ensure closure of levels.
@ -278,7 +278,7 @@ sycklex_yaml_utf8( YYSTYPE *sycklval, SyckParser *parser )
{
int doc_level = 0;
syck_parser_ptr = parser;
if ( YYCURSOR == NULL )
if ( YYCURSOR == NULL )
{
syck_parser_read( parser );
}
@ -331,7 +331,7 @@ yy2: yyaccept = 0;
yy3:
#line 374 "token.re"
{ YYPOS(0);
goto Document;
goto Document;
}
#line 337 "<stdout>"
yy4: yyaccept = 0;
@ -344,7 +344,7 @@ yy5: ++YYCURSOR;
goto yy6;
yy6:
#line 356 "token.re"
{ eat_comments( parser );
{ eat_comments( parser );
goto Header;
}
#line 351 "<stdout>"
@ -355,7 +355,7 @@ yy8:
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
return 0;
}
#line 361 "<stdout>"
yy9: yyaccept = 1;
@ -364,7 +364,7 @@ yy9: yyaccept = 1;
yy10:
#line 366 "token.re"
{ GOBBLE_UP_YAML_INDENT( doc_level, YYTOKEN );
goto Header;
goto Header;
}
#line 370 "<stdout>"
yy11: yych = *++YYCURSOR;
@ -432,15 +432,15 @@ yy24:
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
goto Header;
goto Header;
}
else
{
ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
return 0;
}
return 0;
return 0;
}
#line 446 "<stdout>"
yy25: ++YYCURSOR;
@ -476,13 +476,13 @@ yy31:
if ( lvl->status == syck_lvl_header )
{
YYPOS(3);
goto Directive;
goto Directive;
}
else
{
ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
return 0;
}
}
#line 489 "<stdout>"
@ -583,7 +583,7 @@ yy39: ++YYCURSOR;
yy40:
#line 497 "token.re"
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
goto Plain;
goto Plain;
}
#line 589 "<stdout>"
yy41: ++YYCURSOR;
@ -593,7 +593,7 @@ yy42:
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_iseq);
return YYTOKEN[0];
return YYTOKEN[0];
}
#line 599 "<stdout>"
yy43: ++YYCURSOR;
@ -603,7 +603,7 @@ yy44:
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_imap);
return YYTOKEN[0];
return YYTOKEN[0];
}
#line 609 "<stdout>"
yy45: ++YYCURSOR;
@ -611,7 +611,7 @@ yy45: ++YYCURSOR;
yy46:
#line 432 "token.re"
{ POP_LEVEL();
return YYTOKEN[0];
return YYTOKEN[0];
}
#line 617 "<stdout>"
yy47: yyaccept = 1;
@ -800,7 +800,7 @@ yy58: ++YYCURSOR;
goto yy59;
yy59:
#line 486 "token.re"
{ eat_comments( parser );
{ eat_comments( parser );
goto Document;
}
#line 807 "<stdout>"
@ -817,7 +817,7 @@ yy63:
#line 492 "token.re"
{ ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
return 0;
}
#line 823 "<stdout>"
yy64: yych = *++YYCURSOR;
@ -859,11 +859,11 @@ yy70: ++YYCURSOR;
goto yy71;
yy71:
#line 479 "token.re"
{ if ( is_newline( YYCURSOR - 1 ) )
{ if ( is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
}
goto ScalarBlock;
goto ScalarBlock;
}
#line 869 "<stdout>"
yy72: ++YYCURSOR;
@ -1041,14 +1041,14 @@ yy82:
FORCE_NEXT_TOKEN(YAML_IOPEN);
if ( *YYCURSOR == '#' || is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
YYCURSOR--;
ADD_LEVEL((YYTOKEN + 1) - YYLINEPTR, syck_lvl_seq);
}
else /* spaces followed by content uses the space as indentation */
{
ADD_LEVEL(YYCURSOR - YYLINEPTR, syck_lvl_seq);
}
return YYTOKEN[0];
return YYTOKEN[0];
}
#line 1054 "<stdout>"
yy83: ++YYCURSOR;
@ -1069,8 +1069,8 @@ yy86: ++YYCURSOR;
yy87:
#line 436 "token.re"
{ if ( *YYTOKEN == ':' && lvl->status != syck_lvl_imap ) lvl->status = syck_lvl_map;
YYPOS(1);
return YYTOKEN[0];
YYPOS(1);
return YYTOKEN[0];
}
#line 1076 "<stdout>"
yy88: ++YYCURSOR;
@ -1499,7 +1499,7 @@ Plain:
plvl = CURRENT_LEVEL();
GET_TRUE_YAML_INDENT(parentIndent);
Plain2:
Plain2:
YYTOKEN = YYCURSOR;
Plain3:
@ -1564,7 +1564,7 @@ yy113:
}
}
goto Plain2;
goto Plain2;
}
#line 1570 "<stdout>"
yy114: ++YYCURSOR;
@ -1631,13 +1631,13 @@ yy122: ++YYCURSOR;
}
yy123:
#line 617 "token.re"
{ if ( qidx == 0 )
{ if ( qidx == 0 )
{
goto Plain2;
}
else
{
goto Plain3;
goto Plain3;
}
}
#line 1644 "<stdout>"
@ -1655,7 +1655,7 @@ yy128: ++YYCURSOR;
goto yy129;
yy129:
#line 611 "token.re"
{ eat_comments( parser );
{ eat_comments( parser );
RETURN_IMPLICIT();
}
#line 1662 "<stdout>"
@ -1801,7 +1801,7 @@ yy147:
}
}
goto SingleQuote2;
goto SingleQuote2;
}
#line 1807 "<stdout>"
yy148: ++YYCURSOR;
@ -1811,8 +1811,8 @@ yy148: ++YYCURSOR;
}
yy149:
#line 712 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
}
#line 1818 "<stdout>"
yy150: ++YYCURSOR;
@ -1842,7 +1842,7 @@ yy151:
n->data.str->len = qidx;
n->data.str->style = scalar_1quote;
sycklval->nodeData = n;
return YAML_PLAIN;
return YAML_PLAIN;
}
#line 1848 "<stdout>"
yy152: yych = *++YYCURSOR;
@ -1854,7 +1854,7 @@ yy154: ++YYCURSOR;
yy155:
#line 685 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
goto SingleQuote2;
}
#line 1860 "<stdout>"
yy156: yyaccept = 0;
@ -1960,7 +1960,7 @@ yy163:
}
keep_nl = 1;
goto DoubleQuote2;
goto DoubleQuote2;
}
#line 1966 "<stdout>"
yy164: ++YYCURSOR;
@ -1970,8 +1970,8 @@ yy164: ++YYCURSOR;
}
yy165:
#line 820 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
#line 1977 "<stdout>"
yy166: yyaccept = 1;
@ -2010,7 +2010,7 @@ yy168:
n->data.str->len = qidx;
n->data.str->style = scalar_2quote;
sycklval->nodeData = n;
return YAML_PLAIN;
return YAML_PLAIN;
}
#line 2016 "<stdout>"
yy169: yych = *++YYCURSOR;
@ -2038,7 +2038,7 @@ yy175:
#line 792 "token.re"
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
goto DoubleQuote2;
}
#line 2044 "<stdout>"
yy176: yych = *++YYCURSOR;
@ -2076,7 +2076,7 @@ yy179:
#line 778 "token.re"
{ char ch = *( YYCURSOR - 1 );
QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
goto DoubleQuote2;
goto DoubleQuote2;
}
#line 2082 "<stdout>"
yy180: yych = *++YYCURSOR;
@ -2113,7 +2113,7 @@ yy182:
ch = strtol( chr_text, NULL, 16 );
free( chr_text );
QUOTECAT(qstr, qcapa, qidx, ch);
goto DoubleQuote2;
goto DoubleQuote2;
}
#line 2119 "<stdout>"
yy183: yyaccept = 0;
@ -2216,7 +2216,7 @@ yy189:
}
}
return YAML_TRANSFER;
return YAML_TRANSFER;
}
#line 2222 "<stdout>"
yy190: yych = *++YYCURSOR;
@ -2230,7 +2230,7 @@ yy192: ++YYCURSOR;
}
yy193:
#line 905 "token.re"
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto TransferMethod2;
}
#line 2237 "<stdout>"
@ -2505,7 +2505,7 @@ yy214:
#line 1046 "token.re"
{ YYCURSOR--;
POP_LEVEL();
RETURN_YAML_BLOCK();
RETURN_YAML_BLOCK();
}
#line 2511 "<stdout>"
yy215: yyaccept = 1;
@ -2636,7 +2636,7 @@ yy233: ++YYCURSOR;
}
yy234:
#line 1095 "token.re"
{ goto Comment;
{ goto Comment;
}
#line 2642 "<stdout>"
yy235: yych = *++YYCURSOR;
@ -2699,20 +2699,20 @@ newline_len( char *ptr )
{
if ( *ptr == '\n' )
return 1;
if ( *ptr == '\r' && *( ptr + 1 ) == '\n' )
return 2;
return 0;
}
int
int
syckwrap()
{
return 1;
}
void
void
syckerror( const char *msg )
{
if ( syck_parser_ptr->error_handler == NULL )

View file

@ -7,7 +7,7 @@
*
* WARNING WARNING WARNING --- THIS IS *NOT JUST* PLAYING
* ANYMORE! -- WHY HAS EMBRACED THIS AS THE REAL THING!
*/
*/
#include "ruby/ruby.h"
#include <syck.h>
#include <assert.h>
@ -35,7 +35,7 @@ typedef struct {
int printed;
} bytestring_t;
bytestring_t *bytestring_alloc(void) {
bytestring_t *ret;
bytestring_t *ret;
/*TRACE0("bytestring_alloc()");*/
ret = S_ALLOC(bytestring_t);
ret->hash = HASH;
@ -46,8 +46,8 @@ bytestring_t *bytestring_alloc(void) {
ret->printed = 0;
return ret;
}
void bytestring_append(bytestring_t *str, char code,
char *start, char *finish)
void bytestring_append(bytestring_t *str, char code,
char *start, char *finish)
{
long grow;
long length = 2; /* CODE + LF */
@ -62,14 +62,14 @@ void bytestring_append(bytestring_t *str, char code,
if(length > str->remaining) {
grow = (length - str->remaining) + CHUNKSIZE;
str->remaining += grow;
str->length += grow;
str->length += grow;
str->buffer = S_REALLOC_N( str->buffer, char, str->length + 1 );
assert(str->buffer);
}
curr = str->buffer + (str->length - str->remaining);
*curr = code;
curr += 1;
if(start)
if(start)
while(start < finish)
*curr ++ = *start ++;
*curr = '\n';
@ -99,7 +99,7 @@ void bytestring_extend(bytestring_t *str, bytestring_t *ext)
if(length > str->remaining) {
grow = (length - str->remaining) + CHUNKSIZE;
str->remaining += grow;
str->length += grow;
str->length += grow;
str->buffer = S_REALLOC_N( str->buffer, char, str->length + 1 );
}
curr = str->buffer + (str->length - str->remaining);
@ -176,7 +176,7 @@ syck_yaml2byte_handler(p, n)
{
bytestring_append(val,YAMLBYTE_NULLCHAR,NULL,NULL);
}
else
else
{
assert("oops");
}

View file

@ -83,11 +83,11 @@ typedef enum {
YAMLBYTE_E_OTHER = '?', /* some other error condition */
YAMLBYTE_E_PARSE = 'P', /* parse error, check bytecodes */
} yamlbyte_result_t;
typedef const yamlbyte_char_t *yamlbyte_buff_t;
/*
* The "Instruction" API
typedef const yamlbyte_char_t *yamlbyte_buff_t;
/*
* The "Instruction" API
*/
typedef struct yaml_instruction {
@ -96,7 +96,7 @@ typedef struct yaml_instruction {
yamlbyte_buff_t finish; /* open range, *finish is _not_ part */
} *yamlbyte_inst_t;
/* producer pushes the instruction with one bytecode event to the
/* producer pushes the instruction with one bytecode event to the
* consumer; if the consumer's result is not YAMLBYTE_OK, then
* the producer should stop */
typedef
@ -110,14 +110,14 @@ typedef
* case the instruction (and is buffer) are owned by the producer and
* will remain valid till the pull function is called once again;
* if the instruction is NULL, then there are no more results; and
* it is important to call the pull function till it returns NULL so
* it is important to call the pull function till it returns NULL so
* that the producer can clean up its memory allocations */
typedef
typedef
yamlbyte_result_t
(*yamlbyte_pull_t)(
yamlbyte_producer_t self,
yamlbyte_inst_t *inst /* to be filled in by the producer */
);
);
/*
* Buffer based API
@ -139,12 +139,12 @@ typedef
* is set to NULL, then there are no more results; it is important
* to call the pull function till it returns NULL so that the
* producer can clean up its memory allocations */
typedef
typedef
yamlbyte_result_t
(*yamlbyte_pullbuff_t)(
yamlbyte_producer_t self,
yamlbyte_buff_t *buff /* to be filled in by the producer */
);
);
/* convert a pull interface to a push interface; the reverse process
* requires threads and thus is language dependent */

View file

@ -1,4 +1,4 @@
/*
/*
* UNIX Syslog extension for Ruby
* Amos Gouaux, University of Texas at Dallas
* <amos+ruby@utdallas.edu>
@ -65,7 +65,7 @@ static VALUE mSyslog_open(int argc, VALUE *argv, VALUE self)
rb_scan_args(argc, argv, "03", &ident, &opt, &fac);
if (NIL_P(ident)) {
ident = rb_gv_get("$0");
ident = rb_gv_get("$0");
}
SafeStringValue(ident);
syslog_ident = strdup(RSTRING_PTR(ident));
@ -232,7 +232,7 @@ static VALUE mSyslogConstants_LOG_UPTO(VALUE klass, VALUE pri)
void Init_syslog()
{
mSyslog = rb_define_module("Syslog");
mSyslogConstants = rb_define_module_under(mSyslog, "Constants");
rb_include_module(mSyslog, mSyslogConstants);

View file

@ -46,7 +46,7 @@ _nativethread_consistency_check(ip)
return;
}
/* If the variable "tcl_platform(threaded)" exists,
/* If the variable "tcl_platform(threaded)" exists,
then the Tcl interpreter was compiled with threads enabled. */
if (Tcl_GetVar2(ip, "tcl_platform", "threaded", TCL_GLOBAL_ONLY) != (char*)NULL) {
#ifdef HAVE_NATIVETHREAD
@ -195,13 +195,13 @@ ruby_open_tcltk_dll(appname)
return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() );
}
int
int
tcl_stubs_init_p()
{
return(tclStubsPtr != (TclStubs*)NULL);
}
int
int
tk_stubs_init_p()
{
return(tkStubsPtr != (TkStubs*)NULL);
@ -246,14 +246,14 @@ ruby_tcl_create_ip_and_stubs_init(st)
}
}
p_Tcl_CreateInterp
p_Tcl_CreateInterp
= (Tcl_Interp *(*)())DL_SYM(tcl_dll, "Tcl_CreateInterp");
if (!p_Tcl_CreateInterp) {
if (st) *st = NO_CreateInterp;
return (Tcl_Interp*)NULL;
}
p_Tcl_DeleteInterp
p_Tcl_DeleteInterp
= (Tcl_Interp *(*)())DL_SYM(tcl_dll, "Tcl_DeleteInterp");
if (!p_Tcl_DeleteInterp) {
if (st) *st = NO_DeleteInterp;
@ -444,7 +444,7 @@ ruby_open_tcl_dll(appname)
return TCLTK_STUBS_OK;
}
int
int
ruby_open_tk_dll()
{
if (!open_tcl_dll) {
@ -455,7 +455,7 @@ ruby_open_tk_dll()
return TCLTK_STUBS_OK;
}
int
int
#ifdef HAVE_PROTOTYPES
ruby_open_tcltk_dll(char *appname)
#else
@ -466,13 +466,13 @@ ruby_open_tcltk_dll(appname)
return( ruby_open_tcl_dll(appname) || ruby_open_tk_dll() );
}
int
int
tcl_stubs_init_p()
{
return 1;
}
int
int
tk_stubs_init_p()
{
return call_tk_stubs_init;
@ -505,13 +505,13 @@ ruby_tcl_create_ip_and_stubs_init(st)
return tcl_ip;
}
int
int
ruby_tcl_stubs_init()
{
return TCLTK_STUBS_OK;
}
int
int
#ifdef HAVE_PROTOTYPES
ruby_tk_stubs_init(Tcl_Interp *tcl_ip)
#else
@ -559,7 +559,7 @@ ruby_tk_stubs_safeinit(tcl_ip)
#endif
}
int
int
ruby_tcltk_stubs()
{
/* Tcl_FindExecutable(RSTRING_PTR(rb_argv0)); */

File diff suppressed because it is too large Load diff

View file

@ -155,7 +155,7 @@ tk_do_callback(argc, argv, self)
rb_scan_args(argc, argv, "1*", &id, &rest);
return rb_apply(rb_hash_aref(CALLBACK_TABLE, id), ID_call, rest);
#endif
return rb_funcall2(rb_hash_aref(CALLBACK_TABLE, argv[0]),
return rb_funcall2(rb_hash_aref(CALLBACK_TABLE, argv[0]),
ID_call, argc - 1, argv + 1);
}
@ -209,12 +209,12 @@ tk_uninstall_cmd(self, cmd_id)
if (strncmp(cmd_id_head, RSTRING_PTR(cmd_id), head_len) != 0) {
return Qnil;
}
if (strncmp(cmd_id_prefix,
if (strncmp(cmd_id_prefix,
RSTRING_PTR(cmd_id) + head_len, prefix_len) != 0) {
return Qnil;
}
return rb_hash_delete(CALLBACK_TABLE,
return rb_hash_delete(CALLBACK_TABLE,
rb_str_new2(RSTRING_PTR(cmd_id) + head_len));
}
@ -697,7 +697,7 @@ push_kv_enc(key, val, args)
#if 0
rb_ary_push(ary, key2keyname(key));
if (val != TK_None) {
rb_ary_push(ary, get_eval_string_core(val, Qtrue,
rb_ary_push(ary, get_eval_string_core(val, Qtrue,
RARRAY_PTR(args)[1]));
}
#endif
@ -829,7 +829,7 @@ get_eval_string_core(obj, enc_flag, self)
case T_SYMBOL:
if (RTEST(enc_flag)) {
if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) {
return rb_funcall(self, ID_toUTF8, 1,
return rb_funcall(self, ID_toUTF8, 1,
rb_str_new2(rb_id2name(SYM2ID(obj))));
} else {
return fromDefaultEnc_toUTF8(rb_str_new2(rb_id2name(SYM2ID(obj))), self);
@ -867,7 +867,7 @@ get_eval_string_core(obj, enc_flag, self)
default:
if (rb_obj_is_kind_of(obj, cTkObject)) {
/* return rb_str_new3(rb_funcall(obj, ID_path, 0, 0)); */
return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0),
return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0),
enc_flag, self);
}
@ -885,18 +885,18 @@ get_eval_string_core(obj, enc_flag, self)
if (rb_obj_respond_to(obj, ID_to_eval, Qtrue)) {
/* return rb_funcall(obj, ID_to_eval, 0, 0); */
return get_eval_string_core(rb_funcall(obj, ID_to_eval, 0, 0),
return get_eval_string_core(rb_funcall(obj, ID_to_eval, 0, 0),
enc_flag, self);
} else if (rb_obj_respond_to(obj, ID_path, Qtrue)) {
/* return rb_funcall(obj, ID_path, 0, 0); */
return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0),
return get_eval_string_core(rb_funcall(obj, ID_path, 0, 0),
enc_flag, self);
} else if (rb_obj_respond_to(obj, ID_to_s, Qtrue)) {
return rb_funcall(obj, ID_to_s, 0, 0);
}
}
rb_warning("fail to convert '%s' to string for Tk",
rb_warning("fail to convert '%s' to string for Tk",
RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0)));
return obj;
@ -1039,7 +1039,7 @@ static VALUE
tkstr_invalid_numstr(value)
VALUE value;
{
rb_raise(rb_eArgError,
rb_raise(rb_eArgError,
"invalid value for Number: '%s'", RSTRING_PTR(value));
return Qnil; /*dummy*/
}
@ -1048,8 +1048,8 @@ static VALUE
tkstr_rescue_float(value)
VALUE value;
{
return rb_rescue2(tkstr_to_float, value,
tkstr_invalid_numstr, value,
return rb_rescue2(tkstr_to_float, value,
tkstr_invalid_numstr, value,
rb_eArgError, 0);
}
@ -1061,8 +1061,8 @@ tkstr_to_number(value)
if (RSTRING_PTR(value) == (char*)NULL) return INT2FIX(0);
return rb_rescue2(tkstr_to_int, value,
tkstr_rescue_float, value,
return rb_rescue2(tkstr_to_int, value,
tkstr_rescue_float, value,
rb_eArgError, 0);
}
@ -1111,8 +1111,8 @@ tcl2rb_num_or_str(self, value)
if (RSTRING_PTR(value) == (char*)NULL) return rb_tainted_str_new2("");
return rb_rescue2(tkstr_to_number, value,
tkstr_to_str, value,
return rb_rescue2(tkstr_to_number, value,
tkstr_to_str, value,
rb_eArgError, 0);
}
@ -1199,7 +1199,7 @@ allocate_cbsubst_info(struct cbsubst_info **inf_ptr)
static void
cbsubst_init()
{
rb_const_set(cCB_SUBST, ID_SUBST_INFO,
rb_const_set(cCB_SUBST, ID_SUBST_INFO,
allocate_cbsubst_info((struct cbsubst_info **)NULL));
}
@ -1212,7 +1212,7 @@ cbsubst_initialize(argc, argv, self)
struct cbsubst_info *inf;
int idx, iv_idx;
Data_Get_Struct(rb_const_get(rb_obj_class(self), ID_SUBST_INFO),
Data_Get_Struct(rb_const_get(rb_obj_class(self), ID_SUBST_INFO),
struct cbsubst_info, inf);
idx = 0;
@ -1252,7 +1252,7 @@ each_attr_def(key, value, klass)
key_id = SYM2ID(key);
break;
default:
rb_raise(rb_eArgError,
rb_raise(rb_eArgError,
"includes invalid key(s). expected a String or a Symbol");
}
@ -1264,7 +1264,7 @@ each_attr_def(key, value, klass)
value_id = SYM2ID(value);
break;
default:
rb_raise(rb_eArgError,
rb_raise(rb_eArgError,
"includes invalid value(s). expected a String or a Symbol");
}
@ -1284,7 +1284,7 @@ cbsubst_def_attr_aliases(self, tbl)
rb_raise(rb_eArgError, "expected a Hash");
}
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
struct cbsubst_info, inf);
rb_hash_foreach(tbl, each_attr_def, self);
@ -1306,7 +1306,7 @@ cbsubst_sym_to_subst(self, sym)
if (TYPE(sym) != T_SYMBOL) return sym;
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
struct cbsubst_info, inf);
if (!NIL_P(ret = rb_hash_aref(inf->aliases, sym))) {
@ -1358,7 +1358,7 @@ cbsubst_get_subst_arg(argc, argv, self)
ID id;
volatile VALUE arg_sym, ret;
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
struct cbsubst_info, inf);
ptr = buf = ALLOC_N(char, inf->full_subst_length + 1);
@ -1428,7 +1428,7 @@ cbsubst_get_subst_key(self, str)
list = rb_funcall(cTclTkLib, ID_split_tklist, 1, str);
len = RARRAY_LEN(list);
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
struct cbsubst_info, inf);
ptr = buf = ALLOC_N(char, inf->full_subst_length + len + 1);
@ -1476,7 +1476,7 @@ cbsubst_get_all_subst_keys(self)
int idx, len;
volatile VALUE ret;
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
struct cbsubst_info, inf);
ptr = buf = ALLOC_N(char, inf->full_subst_length + 1);
@ -1587,7 +1587,7 @@ cbsubst_table_setup(argc, argv, self)
chr = (unsigned char)(0x80 + idx);
subst_inf->keylen[chr] = RSTRING_LEN(RARRAY_PTR(inf)[0]);
#if HAVE_STRNDUP
subst_inf->key[chr] = strndup(RSTRING_PTR(RARRAY_PTR(inf)[0]),
subst_inf->key[chr] = strndup(RSTRING_PTR(RARRAY_PTR(inf)[0]),
RSTRING_LEN(RARRAY_PTR(inf)[0]));
#else
subst_inf->key[chr] = malloc(RSTRING_LEN(RARRAY_PTR(inf)[0]) + 1);
@ -1620,10 +1620,10 @@ cbsubst_table_setup(argc, argv, self)
for(idx = 0; idx < len; idx++) {
inf = RARRAY_PTR(proc_inf)[idx];
if (TYPE(inf) != T_ARRAY) continue;
rb_hash_aset(subst_inf->proc,
((TYPE(RARRAY_PTR(inf)[0]) == T_STRING)?
INT2FIX(*(RSTRING_PTR(RARRAY_PTR(inf)[0]))) :
RARRAY_PTR(inf)[0]),
rb_hash_aset(subst_inf->proc,
((TYPE(RARRAY_PTR(inf)[0]) == T_STRING)?
INT2FIX(*(RSTRING_PTR(RARRAY_PTR(inf)[0]))) :
RARRAY_PTR(inf)[0]),
RARRAY_PTR(inf)[1]);
}
@ -1661,7 +1661,7 @@ cbsubst_scan_args(self, arg_key, val_ary)
old_gc = rb_gc_disable();
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
Data_Get_Struct(rb_const_get(self, ID_SUBST_INFO),
struct cbsubst_info, inf);
for(idx = 0; idx < vallen; idx++) {
@ -1680,7 +1680,7 @@ cbsubst_scan_args(self, arg_key, val_ary)
if (NIL_P(proc)) {
rb_ary_push(dst, RARRAY_PTR(val_ary)[idx]);
} else {
rb_ary_push(dst, rb_funcall(proc, ID_call, 1,
rb_ary_push(dst, rb_funcall(proc, ID_call, 1,
RARRAY_PTR(val_ary)[idx]));
}
}
@ -1736,7 +1736,7 @@ Init_tkutil()
/* --------------------- */
rb_define_const(mTK, "RELEASE_DATE",
rb_define_const(mTK, "RELEASE_DATE",
rb_obj_freeze(rb_str_new2(tkutil_release_date)));
/* --------------------- */
@ -1766,19 +1766,19 @@ Init_tkutil()
ID_SUBST_INFO = rb_intern("SUBST_INFO");
rb_define_singleton_method(cCB_SUBST, "ret_val", cbsubst_ret_val, 1);
rb_define_singleton_method(cCB_SUBST, "scan_args", cbsubst_scan_args, 2);
rb_define_singleton_method(cCB_SUBST, "_sym2subst",
rb_define_singleton_method(cCB_SUBST, "_sym2subst",
cbsubst_sym_to_subst, 1);
rb_define_singleton_method(cCB_SUBST, "subst_arg",
rb_define_singleton_method(cCB_SUBST, "subst_arg",
cbsubst_get_subst_arg, -1);
rb_define_singleton_method(cCB_SUBST, "_get_subst_key",
rb_define_singleton_method(cCB_SUBST, "_get_subst_key",
cbsubst_get_subst_key, 1);
rb_define_singleton_method(cCB_SUBST, "_get_all_subst_keys",
rb_define_singleton_method(cCB_SUBST, "_get_all_subst_keys",
cbsubst_get_all_subst_keys, 0);
rb_define_singleton_method(cCB_SUBST, "_setup_subst_table",
rb_define_singleton_method(cCB_SUBST, "_setup_subst_table",
cbsubst_table_setup, -1);
rb_define_singleton_method(cCB_SUBST, "_get_extra_args_tbl",
rb_define_singleton_method(cCB_SUBST, "_get_extra_args_tbl",
cbsubst_get_extra_args_tbl, 0);
rb_define_singleton_method(cCB_SUBST, "_define_attribute_aliases",
rb_define_singleton_method(cCB_SUBST, "_define_attribute_aliases",
cbsubst_def_attr_aliases, 1);
rb_define_method(cCB_SUBST, "initialize", cbsubst_initialize, -1);
@ -1827,9 +1827,9 @@ Init_tkutil()
rb_define_singleton_method(mTK, "uninstall_cmd", tk_uninstall_cmd, 1);
rb_define_singleton_method(mTK, "_symbolkey2str", tk_symbolkey2str, 1);
rb_define_singleton_method(mTK, "hash_kv", tk_hash_kv, -1);
rb_define_singleton_method(mTK, "_get_eval_string",
rb_define_singleton_method(mTK, "_get_eval_string",
tk_get_eval_string, -1);
rb_define_singleton_method(mTK, "_get_eval_enc_str",
rb_define_singleton_method(mTK, "_get_eval_enc_str",
tk_get_eval_enc_str, 1);
rb_define_singleton_method(mTK, "_conv_args", tk_conv_args, -1);

File diff suppressed because it is too large Load diff

View file

@ -1052,7 +1052,7 @@ rb_zstream_avail_out(VALUE obj)
/*
* Allocates +size+ bytes of free space in the output buffer. If there are more
* than +size+ bytes already in the buffer, the buffer is truncated. Because
* than +size+ bytes already in the buffer, the buffer is truncated. Because
* free space is allocated automatically, you usually don't need to use this
* method.
*/
@ -1358,7 +1358,7 @@ rb_deflate_flush(int argc, VALUE *argv, VALUE obj)
/*
* call-seq: params(level, strategy)
*
*
* Changes the parameters of the deflate stream. See zlib.h for details. The
* output from the stream by changing the params is preserved in output
* buffer.
@ -2781,7 +2781,7 @@ rb_gzfile_ecopts(struct gzfile *gz, VALUE opts)
* Document-class: Zlib::GzipWriter
*
* Zlib::GzipWriter is a class for writing gzipped files. GzipWriter should
* be used with an instance of IO, or IO-like, object.
* be used with an instance of IO, or IO-like, object.
*
* For example:
*
@ -2842,7 +2842,7 @@ rb_gzwriter_initialize(int argc, VALUE *argv, VALUE obj)
opt = rb_check_convert_type(argv[argc-1], T_HASH, "Hash", "to_hash");
if (!NIL_P(opt)) argc--;
}
rb_scan_args(argc, argv, "12", &io, &level, &strategy);
Data_Get_Struct(obj, struct gzfile, gz);
@ -3739,21 +3739,21 @@ Init_zlib()
/*
* Document-class: Zlib::GzipFile::NoFooter
*
* Raised when gzip file footer is not found.
* Raised when gzip file footer is not found.
*/
/*
* Document-class: Zlib::GzipFile::CRCError
*
* Raised when the CRC checksum recorded in gzip file footer is not equivalent
* to the CRC checksum of the actual uncompressed data.
* to the CRC checksum of the actual uncompressed data.
*/
/*
* Document-class: Zlib::GzipFile::LengthError
*
* Raised when the data length recorded in the gzip file footer is not equivalent
* to the length of the actual uncompressed data.
* to the length of the actual uncompressed data.
*/