34 static const size_t buffer_size = 1024;
35 char buffer[buffer_size];
36 #if defined(WIN32_VC) || defined(WIN64_VC) 38 vsprintf(buffer, format, ap);
40 vsnprintf(buffer, buffer_size, format, ap);
42 nassertv(strlen(buffer) < buffer_size);
44 pnmimage_cat.info() << buffer <<
"\n";
58 static const size_t buffer_size = 1024;
59 char buffer[buffer_size];
60 #if defined(WIN32_VC) || defined(WIN64_VC) 62 vsprintf(buffer, format, ap);
64 vsnprintf(buffer, buffer_size, format, ap);
66 nassertv(strlen(buffer) < buffer_size);
68 pnmimage_cat.error() << buffer <<
"\n";
85 nassertr(bits != 0, 16);
96 return ( 1 << bits ) - 1;
104 return (
char *)PANDA_MALLOC_ARRAY(cols * size);
112 PANDA_FREE_ARRAY(itrow);
120 pm_readbigshort(istream *in,
short *sP) {
122 *sP = reader.get_be_int16();
123 return (!in->fail()) ? 0 : -1;
127 pm_writebigshort(ostream *out,
short s) {
129 writer.add_be_int16(s);
130 return (!out->fail()) ? 0 : -1;
134 pm_readbiglong(istream *in,
long *lP) {
136 *lP = reader.get_be_int32();
137 return (!in->fail()) ? 0 : -1;
141 pm_writebiglong(ostream *out,
long l) {
143 writer.add_be_int32(l);
144 return (!out->fail()) ? 0 : -1;
148 pm_readlittleshort(istream *in,
short *sP) {
150 *sP = reader.get_int16();
151 return (!in->fail()) ? 0 : -1;
155 pm_writelittleshort(ostream *out,
short s) {
158 return (!out->fail()) ? 0 : -1;
162 pm_readlittlelong(istream *in,
long *lP) {
164 *lP = reader.get_int32();
165 return (!in->fail()) ? 0 : -1;
169 pm_writelittlelong(ostream *out,
long l) {
172 return (!out->fail()) ? 0 : -1;
A StreamWriter object is used to write sequential binary data directly to an ostream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void pm_message(const char *format,...)
Outputs the given printf-style message to the user and returns.
int pm_maxvaltobits(int maxval)
Returns the number of bits sufficient to hold the indicated maxval value.
void pm_freerow(char *itrow)
Frees the row previously allocated withm pm_allocrow().
void pm_error(const char *format,...)
Outputs the given printf-style message to the user and terminates messily.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int pm_bitstomaxval(int bits)
Returns the highest maxval that can be represented in the indicated number of bits.
char * pm_allocrow(int cols, int size)
Allocates a row of cols * size bytes.
A class to read sequential binary data directly from an istream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.