<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I agree. Is casting to int actually the right thing ? Definitely not
    always<br>
    Looking here (for example) <br>
    <pre>1042     int len;
1060     len = (int)(strlen(vendor) + 1 + strlen(renderer) + 1 + 1+strlen(version)+1 + 1);

we use len ONLY as an argument to malloc

1061     pAdapterId = malloc(len);]

So I think the correct fix is to change the declared type of len.

Others may be similar. Please review all the proposed changes with that in mind.


This has nothing to do with changing macros ..
but if we do that an option is to use desktop specific macros .. we have 
already have SAFE_TO_ALLOC_2 and SAFE_TO_ALLOC_3 desktop module macros.

Also I'd really like to see what the compiler warnings are that you are fixing.
Else I find these kinds of changes difficult to review.
Please enumerate the warnings along with explanationo why the fix is "right"

And since you are changing shared code you need to test this on ALL platforms,
even if you are fixing just gcc warnings.


-phil.
</pre>
    <div class="moz-cite-prefix">On 11/27/18 5:32 AM, Krishna Addepalli
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:3f7399d2-9ae0-47af-94be-8eec3c083807@default">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:"Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hi
            Magnus,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thanks
            for taking a look. I was wanting to change the SAFE_ALLOC
            definition, but since that file is in java.base, I was not
            sure of changing it.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Krishna<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"><b><span
                  style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif">
                Magnus Ihse Bursie <br>
                <b>Sent:</b> Tuesday, November 27, 2018 6:52 PM<br>
                <b>To:</b> Krishna Addepalli
                <a class="moz-txt-link-rfc2396E" href="mailto:krishna.addepalli@oracle.com"><krishna.addepalli@oracle.com></a><br>
                <b>Cc:</b> Philip Race <a class="moz-txt-link-rfc2396E" href="mailto:philip.race@oracle.com"><philip.race@oracle.com></a>;
                <a class="moz-txt-link-abbreviated" href="mailto:awt-dev@openjdk.java.net">awt-dev@openjdk.java.net</a>; 2d-dev
                <a class="moz-txt-link-rfc2396E" href="mailto:2d-dev@openjdk.java.net"><2d-dev@openjdk.java.net></a>; build-dev
                <a class="moz-txt-link-rfc2396E" href="mailto:build-dev@openjdk.java.net"><build-dev@openjdk.java.net></a><br>
                <b>Subject:</b> Re: [OpenJDK 2D-Dev] <AWT Dev>
                [12]RFR: [JDK-8074824]: Resolve disabled warnings for
                libawt_xawt<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <p class="MsoNormal">I normally do not comment on component
            source code changes, but I glanced through this and noticed
            that a lot of size_t values are casted to int, in situations
            where a size_t is expected, like SAFE_ALLOC or so. Perhaps
            it would be better to change the argument to those
            functions, rather than to cast a lot of size_t expressions
            to int. As a rule of thumb, any expression that measure an
            amount of memory should be of type size_t, rather than int. <br>
            <br>
            /Magnus<o:p></o:p></p>
        </div>
        <div>
          <p class="MsoNormal" style="margin-bottom:12.0pt"><br>
            27 nov. 2018 kl. 12:14 skrev Krishna Addepalli <<a
              href="mailto:krishna.addepalli@oracle.com"
              moz-do-not-send="true">krishna.addepalli@oracle.com</a>>:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hi
                Phil,</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">To
                reduce the scope, I have created a new webrev, which
                addresses only warnings on Linux platform.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Warnings
                for other platforms will be addressed in separate bugs.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Here
                is the new webrev: <a
                  href="http://cr.openjdk.java.net/~kaddepalli/8074824/webrev02/"
                  moz-do-not-send="true">http://cr.openjdk.java.net/~kaddepalli/8074824/webrev02/</a></span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">For
                your reference, I’m attaching the warning log generated
                by the compiler for each warning type. Hope this helps
                in the review.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I
                ran the all the jtreg tests, but I’m not sure if the
                changes have caused any problems. </span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I
                checked with Ajit (who tried to address this issue
                before), and ran SwingSet2 with GTK2 and GTK3 and did
                not find any crashes.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thanks,</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Krishna</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
            <div>
              <div style="border:none;border-top:solid #E1E1E1
                1.0pt;padding:3.0pt 0in 0in 0in">
                <p class="MsoNormal"><b><span
                      style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif">
                    Krishna Addepalli <br>
                    <b>Sent:</b> Tuesday, October 2, 2018 8:53 PM<br>
                    <b>To:</b> Philip Race <<a
                      href="mailto:philip.race@oracle.com"
                      moz-do-not-send="true">philip.race@oracle.com</a>><br>
                    <b>Cc:</b> <a
                      href="mailto:awt-dev@openjdk.java.net"
                      moz-do-not-send="true">awt-dev@openjdk.java.net</a>;
                    2d-dev <<a href="mailto:2d-dev@openjdk.java.net"
                      moz-do-not-send="true">2d-dev@openjdk.java.net</a>>;
                    build-dev <<a
                      href="mailto:build-dev@openjdk.java.net"
                      moz-do-not-send="true">build-dev@openjdk.java.net</a>><br>
                    <b>Subject:</b> Re: [OpenJDK 2D-Dev] <AWT Dev>
                    [12]RFR: [JDK-8074824]: Resolve disabled warnings
                    for libawt_xawt</span><o:p></o:p></p>
              </div>
            </div>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal">Yes, that is right.<o:p></o:p></p>
            <div>
              <p class="MsoNormal">I have compiled it Mac, Linux and
                Windows locally. I tried submitting a Mach5 job, but was
                unable to as it was down. Will try it again.<o:p></o:p></p>
            </div>
            <div>
              <p class="MsoNormal"> <o:p></o:p></p>
            </div>
            <div>
              <p class="MsoNormal">Thanks<o:p></o:p></p>
            </div>
            <div>
              <p class="MsoNormal">Krishna<o:p></o:p></p>
              <div>
                <p class="MsoNormal"><br>
                  <br>
                  <br>
                  <o:p></o:p></p>
                <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
                  <div>
                    <p class="MsoNormal">On 02-Oct-2018, at 3:39 AM,
                      Philip Race <<a
                        href="mailto:philip.race@oracle.com"
                        moz-do-not-send="true">philip.race@oracle.com</a>>
                      wrote:<o:p></o:p></p>
                  </div>
                  <p class="MsoNormal"> <o:p></o:p></p>
                  <div>
                    <p class="MsoNormal"><span
style="font-size:9.0pt;font-family:"Helvetica",sans-serif;background:white">I
                        suspect I understand this one now .. the array
                        is stack allocated so we don't want NULL</span><span
style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br>
                        <span style="background:white">but the compiler
                          probably complained about possible
                          uninitialised use of the values ?</span><br>
                        <br>
                        <span style="background:white">-phil.</span><br>
                        <br>
                        <span style="background:white">On 10/1/18, 9:38
                          AM, Philip Race wrote:</span></span><o:p></o:p></p>
                    <blockquote
                      style="margin-top:5.0pt;margin-bottom:5.0pt">
                      <p class="MsoNormal" style="background:white"><span
style="font-size:9.0pt;font-family:"Helvetica",sans-serif">You
                          really do need to explain *each* of the
                          changes better.<br>
                          This one .. why not NULL ?<br>
                          <a
href="http://cr.openjdk.java.net/%7Ekaddepalli/8074824/webrev01/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c.udiff.html"
                            moz-do-not-send="true"><span
                              style="color:#954F72">http://cr.openjdk.java.net/~kaddepalli/8074824/webrev01/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c.udiff.html</span></a><br>
                          <br>
                          -phil<br>
                          <br>
                          On 10/1/18, 9:19 AM, Philip Race wrote:</span><o:p></o:p></p>
                      <blockquote
                        style="margin-top:5.0pt;margin-bottom:5.0pt">
                        <p class="MsoNormal" style="background:white"><span
style="font-size:9.0pt;font-family:"Helvetica",sans-serif">Hi,<br>
                            <br>
                            1) Has this been built on all platforms ?<br>
                            2)  I can't find the list of warnings that
                            you are seeing and fixing and they are all
                            over the place.<br>
                            So adding 2d-dev and build-dev.<br>
                            For each of these changes, please show what
                            was the warning that you received from the
                            compiler<br>
                            This might sound like a lot of work, but it
                            won't be disproportionate and I've made the
                            same<br>
                            request for similar reviews and without it,
                            it is hard to review the changes.<br>
                            <br>
                            For example (and I do mean just example)<span
                              class="apple-converted-space"> </span><br>
                            <a
href="http://cr.openjdk.java.net/%7Ekaddepalli/8074824/webrev01/src/java.desktop/unix/native/common/awt/awt_Font.c.udiff.html"
                              moz-do-not-send="true"><span
                                style="color:#954F72">http://cr.openjdk.java.net/~kaddepalli/8074824/webrev01/src/java.desktop/unix/native/common/awt/awt_Font.c.udiff.html</span></a><br>
                            <br>
                            why would that not be #ifdef instead ?<br>
                            <br>
                            3) Testing .. did you run at least all our
                            jtreg tests to make sure you didn't break<br>
                            some behaviour ..<br>
                            <br>
                            -phil.<br>
                            <br>
                            On 9/29/18, 8:18 PM, Krishna Addepalli
                            wrote:</span><o:p></o:p></p>
                        <blockquote
                          style="margin-top:5.0pt;margin-bottom:5.0pt">
                          <div>
                            <p class="MsoNormal"
                              style="background:white"><span
                                style="font-size:11.0pt;font-family:"Calibri",sans-serif">Hi
                                All,<span class="apple-converted-space"> </span></span><o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal"
                              style="background:white"><span
                                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal"
                              style="background:white"><span
                                style="font-size:11.0pt;font-family:"Calibri",sans-serif">Please
                                review a fix for JDK-8074824:<span
                                  class="apple-converted-space"> </span><a
href="https://bugs.openjdk.java.net/browse/JDK-8074824"
                                  moz-do-not-send="true"><span
                                    style="color:#954F72">https://bugs.openjdk.java.net/browse/JDK-8074824</span></a></span><o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal"
                              style="background:white"><span
                                style="font-size:11.0pt;font-family:"Calibri",sans-serif">Webrev:<span
                                  class="apple-converted-space"> </span><a
href="http://cr.openjdk.java.net/%7Ekaddepalli/8074824/webrev01/"
                                  moz-do-not-send="true"><span
                                    style="color:#954F72">http://cr.openjdk.java.net/~kaddepalli/8074824/webrev01/</span></a></span><o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal"
                              style="background:white"><span
                                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal"
                              style="background:white"><span
                                style="font-size:11.0pt;font-family:"Calibri",sans-serif">Most
                                of the warnings have been fixed for
                                Linux, Mac and Windows.</span><o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal"
                              style="background:white"><span
                                style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span><o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal"
                              style="background:white"><span
                                style="font-size:11.0pt;font-family:"Calibri",sans-serif">Thanks,</span><o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal"
                              style="background:white"><span
                                style="font-size:11.0pt;font-family:"Calibri",sans-serif">Krishna</span><o:p></o:p></p>
                          </div>
                        </blockquote>
                      </blockquote>
                    </blockquote>
                  </div>
                </blockquote>
              </div>
              <p class="MsoNormal"> <o:p></o:p></p>
            </div>
          </div>
        </blockquote>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <p class="MsoNormal"><WarningInfo.txt><o:p></o:p></p>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>