[ 
https://issues.apache.org/jira/browse/TS-2549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13889071#comment-13889071
 ] 

Leif Hedstrom commented on TS-2549:
-----------------------------------

Perhaps this:

{code}
diff --git a/lib/atscppapi/src/TransformationPlugin.cc 
b/lib/atscppapi/src/TransformationPlugin.cc
index 75a6706..f859bb3 100644
--- a/lib/atscppapi/src/TransformationPlugin.cc
+++ b/lib/atscppapi/src/TransformationPlugin.cc
@@ -24,6 +24,7 @@
 
 #include <ts/ts.h>
 #include <cstddef>
+#include <inttypes.h>
 #include "utils_internal.h"
 #include "logging_internal.h"
 #include "atscppapi/noncopyable.h"
@@ -91,7 +92,7 @@ int handleTransformationPluginRead(TSCont contp, 
TransformationPluginState *stat
   TSVIO write_vio = TSVConnWriteVIOGet(contp);
   if (write_vio) {
     int64_t to_read = TSVIONTodoGet(write_vio);
-    LOG_DEBUG("Transformation contp=%p write_vio=%p, to_read=%ld", contp, 
write_vio, to_read);
+    LOG_DEBUG("Transformation contp=%p write_vio=%p, to_read=%" PRId64, contp, 
write_vio, to_read);
 
     if (to_read > 0) {
       /*
@@ -99,11 +100,11 @@ int handleTransformationPluginRead(TSCont contp, 
TransformationPluginState *stat
        * the amount of data actually in the read buffer.
        **/
       int64_t avail = TSIOBufferReaderAvail(TSVIOReaderGet(write_vio));
-      LOG_DEBUG("Transformation contp=%p write_vio=%p, to_read=%ld, buffer 
reader avail=%ld", contp, write_vio, to_read, avail);
+      LOG_DEBUG("Transformation contp=%p write_vio=%p, to_read=%" PRId64 ", 
buffer reader avail=%" PRId64, contp, write_vio, to_read, avail);
 
       if (to_read > avail) {
         to_read = avail;
-        LOG_DEBUG("Transformation contp=%p write_vio=%p, to read > avail, 
fixing to_read to be equal to avail. to_read=%ld, buffer reader avail=%ld", 
contp, write_vio, to_read, avail);
+        LOG_DEBUG("Transformation contp=%p write_vio=%p, to read > avail, 
fixing to_read to be equal to avail. to_read=%" PRId64 ", buffer reader 
avail=%" PRId64, contp, write_vio, to_read, avail);
       }
 
       if (to_read > 0) {
@@ -261,11 +262,11 @@ size_t TransformationPlugin::produce(const std::string 
&data) {
   // Finally we can copy this data into the output_buffer
   int64_t bytes_written = TSIOBufferWrite(state_->output_buffer_, 
data.c_str(), write_length);
   state_->bytes_written_ += bytes_written; // So we can set BytesDone on 
outputComplete().
-  LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p write to TSIOBuffer %ld 
bytes total bytes written %ld", this, state_->txn_, bytes_written, 
state_->bytes_written_);
+  LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p write to TSIOBuffer %" 
PRId64 " bytes total bytes written %" PRId64, this, state_->txn_, 
bytes_written, state_->bytes_written_);
 
   // Sanity Checks
   if (bytes_written != write_length) {
-    LOG_ERROR("TransformationPlugin=%p tshttptxn=%p bytes written < expected. 
bytes_written=%ld write_length=%ld", this, state_->txn_, bytes_written, 
write_length);
+    LOG_ERROR("TransformationPlugin=%p tshttptxn=%p bytes written < expected. 
bytes_written=%" PRId64 " write_length=%" PRId64, this, state_->txn_, 
bytes_written, write_length);
   }
 
   int connection_closed = TSVConnClosedGet(state_->vconn_);
@@ -282,7 +283,7 @@ size_t TransformationPlugin::produce(const std::string 
&data) {
 
 size_t TransformationPlugin::setOutputComplete() {
   int connection_closed = TSVConnClosedGet(state_->vconn_);
-  LOG_DEBUG("OutputComplete TransformationPlugin=%p tshttptxn=%p vconn=%p 
connection_closed=%d, total bytes written=%ld", this, state_->txn_, 
state_->vconn_, connection_closed,state_->bytes_written_);
+  LOG_DEBUG("OutputComplete TransformationPlugin=%p tshttptxn=%p vconn=%p 
connection_closed=%d, total bytes written=%" PRId64, this, state_->txn_, 
state_->vconn_, connection_closed,state_->bytes_written_);
 
   if (!connection_closed && !state_->output_vio_) {
       LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p output complete without 
writing any data, initiating write of 0 bytes.", this, state_->txn_);
{code}


> Compiler warnings on OSX (clang) with the CPP APIs
> --------------------------------------------------
>
>                 Key: TS-2549
>                 URL: https://issues.apache.org/jira/browse/TS-2549
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: TS API
>            Reporter: Leif Hedstrom
>             Fix For: 4.2.0
>
>
> {code}
>   CXX      TransformationPlugin.lo
> TransformationPlugin.cc:94:166: warning: format specifies type 'long' but the 
> argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "94" , "[%s()] 
> " "Transformation contp=%p write_vio=%p, to_read=%ld", __FUNCTION__, contp, 
> write_vio, to_read); } while (false);
>                                                                               
>                                                  ~~~                          
>          ^~~~~~~
>                                                                               
>                                                  %lld
> TransformationPlugin.cc:102:194: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>       do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "102" , 
> "[%s()] " "Transformation contp=%p write_vio=%p, to_read=%ld, buffer reader 
> avail=%ld", __FUNCTION__, contp, write_vio, to_read, avail); } while (false);
>                                                                               
>                                                     ~~~                       
>                                      ^~~~~~~
>                                                                               
>                                                     %lld
> TransformationPlugin.cc:102:203: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>       do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "102" , 
> "[%s()] " "Transformation contp=%p write_vio=%p, to_read=%ld, buffer reader 
> avail=%ld", __FUNCTION__, contp, write_vio, to_read, avail); } while (false);
>                                                                               
>                                                                              
> ~~~                                            ^~~~~
>                                                                               
>                                                                              
> %lld
> TransformationPlugin.cc:106:250: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>         do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "106" , 
> "[%s()] " "Transformation contp=%p write_vio=%p, to read > avail, fixing 
> to_read to be equal to avail. to_read=%ld, buffer reader avail=%ld", 
> __FUNCTION__, contp, write_vio, to_read, avail); } while (false);
>                                                                               
>                                                                               
>                               ~~~                                             
>                ^~~~~~~
>                                                                               
>                                                                               
>                               %lld
> TransformationPlugin.cc:106:259: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>         do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "106" , 
> "[%s()] " "Transformation contp=%p write_vio=%p, to read > avail, fixing 
> to_read to be equal to avail. to_read=%ld, buffer reader avail=%ld", 
> __FUNCTION__, contp, write_vio, to_read, avail); } while (false);
>                                                                               
>                                                                               
>                                                        ~~~                    
>                         ^~~~~
>                                                                               
>                                                                               
>                                                        %lld
> TransformationPlugin.cc:264:208: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>   do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "264" , "[%s()] 
> " "TransformationPlugin=%p tshttptxn=%p write to TSIOBuffer %ld bytes total 
> bytes written %ld", __FUNCTION__, this, state_->txn_, bytes_written, 
> state_->bytes_written_); } while (false);
>                                                                               
>                                                            ~~~                
>                                                    ^~~~~~~~~~~~~
>                                                                               
>                                                            %lld
> TransformationPlugin.cc:264:223: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>   do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "264" , "[%s()] 
> " "TransformationPlugin=%p tshttptxn=%p write to TSIOBuffer %ld bytes total 
> bytes written %ld", __FUNCTION__, this, state_->txn_, bytes_written, 
> state_->bytes_written_); } while (false);
>                                                                               
>                                                                               
>            ~~~                                                    
> ^~~~~~~~~~~~~~~~~~~~~~
>                                                                               
>                                                                               
>            %lld
> TransformationPlugin.cc:268:233: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "268" , 
> "[%s()] " "[ERROR] " "TransformationPlugin=%p tshttptxn=%p bytes written < 
> expected. bytes_written=%ld write_length=%ld", __FUNCTION__, this, 
> state_->txn_, bytes_written, write_length); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "TransformationPlugin=%p tshttptxn=%p bytes written < 
> expected. bytes_written=%ld write_length=%ld", "atscppapi", 
> "TransformationPlugin.cc", 268, __FUNCTION__, this, state_->txn_, 
> bytes_written, write_length); } while (false);
>                                                                               
>                                                                               
>                    ~~~                                                      
> ^~~~~~~~~~~~~
>                                                                               
>                                                                               
>                    %lld
> TransformationPlugin.cc:268:248: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "268" , 
> "[%s()] " "[ERROR] " "TransformationPlugin=%p tshttptxn=%p bytes written < 
> expected. bytes_written=%ld write_length=%ld", __FUNCTION__, this, 
> state_->txn_, bytes_written, write_length); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "TransformationPlugin=%p tshttptxn=%p bytes written < 
> expected. bytes_written=%ld write_length=%ld", "atscppapi", 
> "TransformationPlugin.cc", 268, __FUNCTION__, this, state_->txn_, 
> bytes_written, write_length); } while (false);
>                                                                               
>                                                                               
>                                     ~~~                                       
>              ^~~~~~~~~~~~
>                                                                               
>                                                                               
>                                     %lld
> TransformationPlugin.cc:268:490: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "268" , 
> "[%s()] " "[ERROR] " "TransformationPlugin=%p tshttptxn=%p bytes written < 
> expected. bytes_written=%ld write_length=%ld", __FUNCTION__, this, 
> state_->txn_, bytes_written, write_length); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "TransformationPlugin=%p tshttptxn=%p bytes written < 
> expected. bytes_written=%ld write_length=%ld", "atscppapi", 
> "TransformationPlugin.cc", 268, __FUNCTION__, this, state_->txn_, 
> bytes_written, write_length); } while (false);
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                            
> ~~~                                                                           
>                         ^~~~~~~~~~~~~
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                            
> %lld
> TransformationPlugin.cc:268:505: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "268" , 
> "[%s()] " "[ERROR] " "TransformationPlugin=%p tshttptxn=%p bytes written < 
> expected. bytes_written=%ld write_length=%ld", __FUNCTION__, this, 
> state_->txn_, bytes_written, write_length); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "TransformationPlugin=%p tshttptxn=%p bytes written < 
> expected. bytes_written=%ld write_length=%ld", "atscppapi", 
> "TransformationPlugin.cc", 268, __FUNCTION__, this, state_->txn_, 
> bytes_written, write_length); } while (false);
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>               ~~~                                                             
>                                     ^~~~~~~~~~~~
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>               %lld
> TransformationPlugin.cc:285:258: warning: format specifies type 'long' but 
> the argument has type 'int64_t' (aka 'long long') [-Wformat]
>   do { TSDebug("atscppapi" "." "TransformationPlugin.cc" ":" "285" , "[%s()] 
> " "OutputComplete TransformationPlugin=%p tshttptxn=%p vconn=%p 
> connection_closed=%d, total bytes written=%ld", __FUNCTION__, this, 
> state_->txn_, state_->vconn_, connection_closed,state_->bytes_written_); } 
> while (false);
>                                                                               
>                                                                               
>                            ~~~                                                
>                        ^~~~~~~~~~~~~~~~~~~~~~
>                                                                               
>                                                                               
>                            %lld
> 12 warnings generated.
>   CXX      Logger.lo
>   CXX      Stat.lo
>   CXX      AsyncHttpFetch.lo
>   CXX      RemapPlugin.lo
>   CXX      GzipDeflateTransformation.lo
> GzipDeflateTransformation.cc:151:205: warning: format specifies type 'long' 
> but the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "GzipDeflateTransformation.cc" ":" 
> "151" , "[%s()] " "[ERROR] " "Gzip bytes produced sanity check failed, 
> deflated bytes = %ld != written bytes = %ld", __FUNCTION__, 
> state_->bytes_produced_, bytes_written); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "Gzip bytes produced sanity check failed, deflated bytes = 
> %ld != written bytes = %ld", "atscppapi", "GzipDeflateTransformation.cc", 
> 151, __FUNCTION__, state_->bytes_produced_, bytes_written); } while (false);
>                                                                               
>                                                                               
>      ~~~                                        ^~~~~~~~~~~~~~~~~~~~~~~
>                                                                               
>                                                                               
>      %lld
> GzipDeflateTransformation.cc:151:230: warning: format specifies type 'long' 
> but the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "GzipDeflateTransformation.cc" ":" 
> "151" , "[%s()] " "[ERROR] " "Gzip bytes produced sanity check failed, 
> deflated bytes = %ld != written bytes = %ld", __FUNCTION__, 
> state_->bytes_produced_, bytes_written); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "Gzip bytes produced sanity check failed, deflated bytes = 
> %ld != written bytes = %ld", "atscppapi", "GzipDeflateTransformation.cc", 
> 151, __FUNCTION__, state_->bytes_produced_, bytes_written); } while (false);
>                                                                               
>                                                                               
>                             ~~~                                          
> ^~~~~~~~~~~~~
>                                                                               
>                                                                               
>                             %lld
> GzipDeflateTransformation.cc:151:445: warning: format specifies type 'long' 
> but the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "GzipDeflateTransformation.cc" ":" 
> "151" , "[%s()] " "[ERROR] " "Gzip bytes produced sanity check failed, 
> deflated bytes = %ld != written bytes = %ld", __FUNCTION__, 
> state_->bytes_produced_, bytes_written); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "Gzip bytes produced sanity check failed, deflated bytes = 
> %ld != written bytes = %ld", "atscppapi", "GzipDeflateTransformation.cc", 
> 151, __FUNCTION__, state_->bytes_produced_, bytes_written); } while (false);
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                        ~~~                                    
>                                                       ^~~~~~~~~~~~~~~~~~~~~~~
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                        %lld
> GzipDeflateTransformation.cc:151:470: warning: format specifies type 'long' 
> but the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "GzipDeflateTransformation.cc" ":" 
> "151" , "[%s()] " "[ERROR] " "Gzip bytes produced sanity check failed, 
> deflated bytes = %ld != written bytes = %ld", __FUNCTION__, 
> state_->bytes_produced_, bytes_written); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "Gzip bytes produced sanity check failed, deflated bytes = 
> %ld != written bytes = %ld", "atscppapi", "GzipDeflateTransformation.cc", 
> 151, __FUNCTION__, state_->bytes_produced_, bytes_written); } while (false);
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                               ~~~             
>                                                                               
>  ^~~~~~~~~~~~~
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                               %lld
> 4 warnings generated.
>   CXX      GzipInflateTransformation.lo
> GzipInflateTransformation.cc:125:205: warning: format specifies type 'long' 
> but the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "GzipInflateTransformation.cc" ":" 
> "125" , "[%s()] " "[ERROR] " "Gzip bytes produced sanity check failed, 
> inflated bytes = %ld != written bytes = %ld", __FUNCTION__, 
> state_->bytes_produced_, bytes_written); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "Gzip bytes produced sanity check failed, inflated bytes = 
> %ld != written bytes = %ld", "atscppapi", "GzipInflateTransformation.cc", 
> 125, __FUNCTION__, state_->bytes_produced_, bytes_written); } while (false);
>                                                                               
>                                                                               
>      ~~~                                        ^~~~~~~~~~~~~~~~~~~~~~~
>                                                                               
>                                                                               
>      %lld
> GzipInflateTransformation.cc:125:230: warning: format specifies type 'long' 
> but the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "GzipInflateTransformation.cc" ":" 
> "125" , "[%s()] " "[ERROR] " "Gzip bytes produced sanity check failed, 
> inflated bytes = %ld != written bytes = %ld", __FUNCTION__, 
> state_->bytes_produced_, bytes_written); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "Gzip bytes produced sanity check failed, inflated bytes = 
> %ld != written bytes = %ld", "atscppapi", "GzipInflateTransformation.cc", 
> 125, __FUNCTION__, state_->bytes_produced_, bytes_written); } while (false);
>                                                                               
>                                                                               
>                             ~~~                                          
> ^~~~~~~~~~~~~
>                                                                               
>                                                                               
>                             %lld
> GzipInflateTransformation.cc:125:445: warning: format specifies type 'long' 
> but the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "GzipInflateTransformation.cc" ":" 
> "125" , "[%s()] " "[ERROR] " "Gzip bytes produced sanity check failed, 
> inflated bytes = %ld != written bytes = %ld", __FUNCTION__, 
> state_->bytes_produced_, bytes_written); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "Gzip bytes produced sanity check failed, inflated bytes = 
> %ld != written bytes = %ld", "atscppapi", "GzipInflateTransformation.cc", 
> 125, __FUNCTION__, state_->bytes_produced_, bytes_written); } while (false);
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                        ~~~                                    
>                                                       ^~~~~~~~~~~~~~~~~~~~~~~
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                        %lld
> GzipInflateTransformation.cc:125:470: warning: format specifies type 'long' 
> but the argument has type 'int64_t' (aka 'long long') [-Wformat]
>     do { do { TSDebug("atscppapi" "." "GzipInflateTransformation.cc" ":" 
> "125" , "[%s()] " "[ERROR] " "Gzip bytes produced sanity check failed, 
> inflated bytes = %ld != written bytes = %ld", __FUNCTION__, 
> state_->bytes_produced_, bytes_written); } while (false); TSError("[%s] 
> [%s:%d, %s()] " "Gzip bytes produced sanity check failed, inflated bytes = 
> %ld != written bytes = %ld", "atscppapi", "GzipInflateTransformation.cc", 
> 125, __FUNCTION__, state_->bytes_produced_, bytes_written); } while (false);
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                               ~~~             
>                                                                               
>  ^~~~~~~~~~~~~
>                                                                               
>                                                                               
>                                                                               
>                                                                               
>                                                               %lld



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to