Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1242525

Need byte-swapping support around XDrawString16 for Solaris x86

XMLWordPrintable

    • 1.0.2
    • x86
    • solaris_2.4
    • Verified

      Use of XDrawString16() in awt_Graphics.c needs help with byte swapping for use
      on Solaris x86. A test case is the NervousText applet, which works fine on SPARC
      Solaris but not on x86. The same problem exists in tiny_Graphics.c.

      For awt_Graphics.c, Netscape has already provided the code, but we hadn't been
      using it. I'd made the awt_Graphics.c in the /usr/green/SCCS_DIRECTORIES/java
      workspace use that code, so we are done for the AWT (but not the tiny AWT) if we
      use that workspace to build 1.0.2.

      static void
      awt_XDrawString16(Display *display, Drawable draw,
                                        GC gc, int x, int y,
                                        XChar2b *string, int length)
      {
      #if i386 || (defined(NETSCAPE) && defined(IS_LITTLE_ENDIAN))
              XChar2b *str = sysMalloc(sizeof(XChar2b) * length);
              if(str) {
                      XChar2b *s, *d, *limit;
                      for(s=string, d=str, limit=str+length; d<limit; d++, s++) {
                              d->byte1 = s->byte2;
                              d->byte2 = s->byte1;
                      }
                      XDrawString16(display, draw, gc, x, y, str, length);
                      sysFree(str);
              }
      #else
              XDrawString16(display, draw, gc, x, y, string, length);
      #endif
              return;
      }

      If we don't build 1.0.2 out of that workspace, then that code should be brought over
      to the actual workspace.

      The tiny AWT's tiny_Graphics.c still uses a raw XDrawString16(), and needs to do
      the above too if it's going to work on Solaris x86 or any other byte-swapped machine.

            tlindholsunw Timothy Lindholm (Inactive)
            tlindholsunw Timothy Lindholm (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: