- if(!this->pages) {
- this->pagebuflen = 1024;
- this->pages = (int*)malloc(this->pagebuflen*sizeof(int));
- memset(this->pages, -1, this->pagebuflen*sizeof(int));
- } else {
- while(pdfpage >= this->pagebuflen)
- {
- int oldlen = this->pagebuflen;
- this->pagebuflen+=1024;
- this->pages = (int*)realloc(this->pages, this->pagebuflen*sizeof(int));
- memset(&this->pages[oldlen], -1, (this->pagebuflen-oldlen)*sizeof(int));
- }
+ if(!gfxglobals->pages) {
+ gfxglobals->pagebuflen = 1024;
+ if(pdfpage > gfxglobals->pagebuflen)
+ gfxglobals->pagebuflen = pdfpage+1;
+ gfxglobals->pages = (int*)malloc(gfxglobals->pagebuflen*sizeof(int));
+ memset(gfxglobals->pages, -1, gfxglobals->pagebuflen*sizeof(int));
+ }
+
+ while(pdfpage >= gfxglobals->pagebuflen)
+ {
+ int oldlen = gfxglobals->pagebuflen;
+ gfxglobals->pagebuflen+=1024;
+ gfxglobals->pages = (int*)realloc(gfxglobals->pages, gfxglobals->pagebuflen*sizeof(int));
+ memset(&gfxglobals->pages[oldlen], -1, (gfxglobals->pagebuflen-oldlen)*sizeof(int));