Changeset 494

Show
Ignore:
Timestamp:
10/29/07 17:30:32 (12 months ago)
Author:
krobillard
Message:

Converting a UCS2 string to binary now creates big-endian words on all
platforms.

Location:
trunk/thune
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/make.c

    r480 r494  
    172172        if( size ) 
    173173        { 
    174             memCpy( bin->ptr.b, cpA, size ); 
     174#ifndef __BIG_ENDIAN__ 
     175            if( ur_is(cell, UT_STRING) && (ur_encoding(cell) == UR_ENC_UCS2) ) 
     176                memSwab( cpA, bin->ptr.b, size ); 
     177            else 
     178#endif 
     179                memCpy( bin->ptr.b, cpA, size ); 
     180 
    175181            bin->used = size; 
    176182        } 
     
    17111717                goto init_bin; 
    17121718            } 
     1719#if 0 
     1720            else if( ur_is(tos, UT_WORD) && (argc == 2) ) 
     1721            { 
     1722                binN = ur_makeBinaryFrom( ut, ur_s_prev(tos) ); 
     1723                goto init_bin; 
     1724            } 
     1725#endif 
    17131726            else if( ur_stringSlice(ut, tos, &spA, &spB) ) 
    17141727            { 
  • trunk/thune/project.r

    r471 r494  
    3131        cflags {-std=c99} 
    3232        ;cflags {-std=gnu99} 
     33        cflags {-D_GNU_SOURCE}  ; Needed to find swab() in unistd.h on Linux 
    3334        cflags {-pedantic} 
    3435        include_from %unix 
  • trunk/thune/unix/os.h

    r458 r494  
    1212#include <string.h> 
    1313#include <pthread.h> 
     14#include <unistd.h> 
    1415 
    1516 
     
    2930#define memSet      memset 
    3031#define memMove     memmove 
     32#define memSwab     swab 
    3133 
    3234#ifdef TRACK_MALLOC 
  • trunk/thune/win32/os.h

    r473 r494  
    3939#define memSet      memset 
    4040#define memMove     memmove 
     41#define memSwab     _swab 
    4142 
    4243#ifdef TRACK_MALLOC