Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66bca32

Browse files
Port to Solaris 2.3.
1 parent 57531fe commit 66bca32

4 files changed

Lines changed: 203 additions & 45 deletions

File tree

Modules/md5module.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ extern typeobject MD5type; /* Really static, forward */
4141

4242
#define is_md5object(v) ((v)->ob_type == &MD5type)
4343

44-
static const char initialiser_name[] = "md5";
45-
4644
/* #define MD5_DEBUG */
4745

4846
static md5object *
@@ -207,7 +205,7 @@ typeobject MD5type = {
207205
/* List of functions exported by this module */
208206

209207
static struct methodlist md5_functions[] = {
210-
{initialiser_name, MD5_md5},
208+
{"md5", MD5_md5},
211209
{NULL, NULL} /* Sentinel */
212210
};
213211

Modules/sunaudiodev.c

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3030

3131
#include <stropts.h>
3232
#include <sys/ioctl.h>
33+
#ifdef SOLARIS
34+
#include <multimedia/libaudio.h>
35+
#else
3336
#include <sun/audioio.h>
37+
#endif
3438

3539
/* #define offsetof(str,mem) ((int)(((str *)0)->mem)) */
3640

@@ -50,7 +54,7 @@ typedef struct {
5054

5155
extern typeobject Sadtype; /* Really static, forward */
5256
extern typeobject Sadstatustype; /* Really static, forward */
53-
extern sadstatusobject *sads_alloc(); /* Forward */
57+
static sadstatusobject *sads_alloc(); /* Forward */
5458

5559
static object *SunAudioError;
5660

@@ -256,6 +260,24 @@ sad_drain(self, args)
256260
return None;
257261
}
258262

263+
#ifdef SOLARIS
264+
static object *
265+
sad_getdev(self, args)
266+
sadobject *self;
267+
object *args;
268+
{
269+
struct audio_device ad;
270+
271+
if ( !getargs(args, "") )
272+
return 0;
273+
if ( ioctl(self->x_fd, AUDIO_GETDEV, &ad) < 0 ) {
274+
err_errno(SunAudioError);
275+
return NULL;
276+
}
277+
return mkvalue("(sss)", ad.name, ad.version, ad.config);
278+
}
279+
#endif
280+
259281
static object *
260282
sad_flush(self, args)
261283
sadobject *self;
@@ -298,6 +320,9 @@ static struct methodlist sad_methods[] = {
298320
{ "setinfo", sad_setinfo },
299321
{ "drain", sad_drain },
300322
{ "flush", sad_flush },
323+
#ifdef SOLARIS
324+
{ "getdev", sad_getdev },
325+
#endif
301326
{ "close", sad_close },
302327
{NULL, NULL} /* sentinel */
303328
};
@@ -345,6 +370,11 @@ static struct memberlist sads_ml[] = {
345370
{ "i_waiting", T_UBYTE, OFF(record.waiting) },
346371
{ "i_open", T_UBYTE, OFF(record.open) , RO},
347372
{ "i_active", T_UBYTE, OFF(record.active) , RO},
373+
#ifdef SOLARIS
374+
{ "i_buffer_size", T_UINT, OFF(record.buffer_size) },
375+
{ "i_balance", T_UBYTE, OFF(record.balance) },
376+
{ "i_avail_ports", T_UINT, OFF(record.avail_ports) },
377+
#endif
348378

349379
{ "o_sample_rate", T_UINT, OFF(play.sample_rate) },
350380
{ "o_channels", T_UINT, OFF(play.channels) },
@@ -359,6 +389,11 @@ static struct memberlist sads_ml[] = {
359389
{ "o_waiting", T_UBYTE, OFF(play.waiting) },
360390
{ "o_open", T_UBYTE, OFF(play.open) , RO},
361391
{ "o_active", T_UBYTE, OFF(play.active) , RO},
392+
#ifdef SOLARIS
393+
{ "o_buffer_size", T_UINT, OFF(play.buffer_size) },
394+
{ "o_balance", T_UBYTE, OFF(play.balance) },
395+
{ "o_avail_ports", T_UINT, OFF(play.avail_ports) },
396+
#endif
362397

363398
{ "monitor_gain", T_UINT, OFF(monitor_gain) },
364399
{ NULL, 0, 0},
@@ -382,7 +417,7 @@ sads_setattr(xp, name, v)
382417
if (v == NULL) {
383418
err_setstr(TypeError,
384419
"can't delete sun audio status attributes");
385-
return NULL;
420+
return 0;
386421
}
387422
return setmember((char *)&xp->ai, sads_ml, name, v);
388423
}

Modules/threadmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ t_bootstrap(args_raw)
195195
func = gettupleitem(args, 0);
196196
arg = gettupleitem(args, 1);
197197
res = call_object(func, arg);
198-
DECREF(arg); /* Matches the INCREF(arg) in thread_start_new_thread */
198+
DECREF(args); /* Matches the INCREF(args) in thread_start_new_thread */
199199
if (res == NULL) {
200200
fprintf(stderr, "Unhandled exception in thread:\n");
201201
print_error(); /* From pythonmain.c */

0 commit comments

Comments
 (0)