Skip to content

Commit

Permalink
Merge pull request #1126 from hugovk/if0
Browse files Browse the repository at this point in the history
Remove unreachable code (if 0)
  • Loading branch information
wiredfool committed Mar 6, 2015
2 parents 44bb45d + 0b79c6e commit 6a296a4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 58 deletions.
14 changes: 5 additions & 9 deletions PIL/PngImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def __new__(cls, text, lang, tkey):
:param lang: language code
:param tkey: UTF-8 version of the key name
"""

self = str.__new__(cls, text)
self.lang = lang
self.tkey = tkey
Expand All @@ -198,7 +198,7 @@ def add(self, cid, data):
:param data: a byte string of the encoded data
"""

self.chunks.append((cid, data))

def add_itxt(self, key, value, lang="", tkey="", zip=False):
Expand All @@ -211,7 +211,7 @@ def add_itxt(self, key, value, lang="", tkey="", zip=False):
:param zip: compression flag
"""

if not isinstance(key, bytes):
key = key.encode("latin-1", "strict")
if not isinstance(value, bytes):
Expand All @@ -235,7 +235,7 @@ def add_text(self, key, value, zip=0):
:param value: value for this key, text or an
:py:class:`PIL.PngImagePlugin.iTXt` instance
:param zip: compression flag
"""
if isinstance(value, iTXt):
return self.add_itxt(key, value, value.lang, value.tkey, bool(zip))
Expand Down Expand Up @@ -462,7 +462,7 @@ def chunk_iTXt(self, pos, length):

self.im_info[k] = self.im_text[k] = iTXt(v, lang, tk)
self.check_text_memory(len(v))

return s


Expand Down Expand Up @@ -729,10 +729,6 @@ def _save(im, fp, filename, chunk=putchunk, check=0):
alpha_bytes = 2**bits
chunk(fp, b"tRNS", alpha[:alpha_bytes])

if 0:
# FIXME: to be supported some day
chunk(fp, b"gAMA", o32(int(gamma * 100000.0)))

dpi = im.encoderinfo.get("dpi")
if dpi:
chunk(fp, b"pHYs",
Expand Down
13 changes: 0 additions & 13 deletions libImaging/Dib.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,6 @@ ImagingNewDIB(const char *mode, int xsize, int ysize)

#endif

#if 0
{
/* DEBUG: dump palette to file */
FILE *err = fopen("dib.pal", "w");
for (i = 0; i < 256; i++)
fprintf(err, "%d: %d/%d/%d\n", i,
pal->palPalEntry[i].peRed,
pal->palPalEntry[i].peGreen,
pal->palPalEntry[i].peBlue);
fclose(err);
}
#endif

dib->palette = CreatePalette(pal);

}
Expand Down
17 changes: 0 additions & 17 deletions libImaging/Geometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,23 +304,6 @@ perspective_transform(double* xin, double* yin, int x, int y, void* data)
return 1;
}

#if 0
static int
quadratic_transform(double* xin, double* yin, int x, int y, void* data)
{
double* a = (double*) data;

double a0 = a[0]; double a1 = a[1]; double a2 = a[2]; double a3 = a[3];
double a4 = a[4]; double a5 = a[5]; double a6 = a[6]; double a7 = a[7];
double a8 = a[8]; double a9 = a[9]; double a10 = a[10]; double a11 = a[11];

xin[0] = a0 + a1*x + a2*y + a3*x*x + a4*x*y + a5*y*y;
yin[0] = a6 + a7*x + a8*y + a9*x*x + a10*x*y + a11*y*y;

return 1;
}
#endif

static int
quad_transform(double* xin, double* yin, int x, int y, void* data)
{
Expand Down
19 changes: 0 additions & 19 deletions libImaging/QuantHash.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ struct _HashTable {
#define RESIZE_FACTOR 3

static int _hashtable_insert_node(HashTable *,HashNode *,int,int,CollisionFunc);
#if 0
static int _hashtable_test(HashTable *);
#endif

HashTable *hashtable_new(HashFunc hf,HashCmpFunc cf) {
HashTable *h;
Expand Down Expand Up @@ -132,22 +129,6 @@ static void _hashtable_resize(HashTable *h) {
}
}

#if 0
static int _hashtable_test(HashTable *h) {
uint32_t i;
int j;
HashNode *n;
for (i=0;i<h->length;i++) {
for (n=h->table[i];n&&n->next;n=n->next) {
j=h->cmpFunc(h,n->key,n->next->key);
printf ("%c",j?(j<0?'-':'+'):'=');
}
printf ("\n");
}
return 0;
}
#endif

static int _hashtable_insert_node(HashTable *h,HashNode *node,int resize,int update,CollisionFunc cf) {
uint32_t hash=h->hashFunc(h,node->key)%h->length;
HashNode **n,*nv;
Expand Down

0 comments on commit 6a296a4

Please sign in to comment.