< prev index next >

src/share/native/com/sun/java/util/jar/pack/bytes.h

Print this page
rev 1357 : 6496269: Many warnings generated from com/sun/java/util/jar/pack/*.cpp when compiled on Linux
Summary: Removal of compiler warnings and fixing of assert logic.
Reviewed-by: jrose, ksrini, bristor
rev 1364 : 8074839: Resolve disabled warnings for libunpack and the unpack200 binary
Reviewed-by: dholmes, ksrini

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -61,11 +61,11 @@
   }
   bytes slice(size_t beg, size_t end) {
     bytes res;
     res.ptr = ptr + beg;
     res.len = end - beg;
-    assert(res.len == 0 || inBounds(res.ptr) && inBounds(res.limit()-1));
+    assert(res.len == 0 || (inBounds(res.ptr) && inBounds(res.limit()-1)));
     return res;
   }
   // building C strings inside byte buffers:
   bytes& strcat(const char* str) { ::strcat((char*)ptr, str); return *this; }
   bytes& strcat(bytes& other) { ::strncat((char*)ptr, (char*)other.ptr, other.len); return *this; }

@@ -115,11 +115,11 @@
     { return append(str, strlen(str)); }
 };
 
 struct ptrlist : fillbytes {
   typedef const void* cvptr;
-  int    length()     { return size() / sizeof(cvptr); }
+  int    length()     { return (int)(size() / sizeof(cvptr)); }
   cvptr* base()       { return (cvptr*) fillbytes::base(); }
   cvptr& get(int i)   { return *(cvptr*)loc(i * sizeof(cvptr)); }
   cvptr* limit()      { return (cvptr*) fillbytes::limit(); }
   void   add(cvptr x) { *(cvptr*)grow(sizeof(x)) = x; }
   void   popTo(int l) { assert(l <= length()); b.len = l * sizeof(cvptr); }

@@ -131,11 +131,11 @@
 // between member and non-member function pointers.
 #define PTRLIST_QSORT(ptrls, fn) \
   ::qsort((ptrls).base(), (ptrls).length(), sizeof(void*), fn)
 
 struct intlist : fillbytes {
-  int    length()     { return size() / sizeof(int); }
+  int    length()     { return (int)(size() / sizeof(int)); }
   int*   base()       { return (int*) fillbytes::base(); }
   int&   get(int i)   { return *(int*)loc(i * sizeof(int)); }
   int*   limit()      { return (int*) fillbytes::limit(); }
   void   add(int x)   { *(int*)grow(sizeof(x)) = x; }
   void   popTo(int l) { assert(l <= length()); b.len = l * sizeof(int); }
< prev index next >