leonbloy/pngcs

OpenFileForReading should perform Read-only access on file

Opened this issue · 1 comments

From kei.naka...@gmail.com on November 09, 2013 07:39:10

By view point of parallelism, sometimes we access .png files by multiple threads simultaneously. Current pngcs implementation prevents things from working properly because OpenFileForReading method in FileHelper performs Read/Write (calling FileStream(String, FileMode) constructor without passing third argument; FileAccess, result in R/W access) and perform locks on files.

So, I propose applying the following patch on FileHelper.cs

  •        isx = new FileStream(file, FileMode.Open);
    
  •        isx = new FileStream(file, FileMode.Open, FileAccess.Read);
    

Original issue: http://code.google.com/p/pngcs/issues/detail?id=9

From kei.naka...@gmail.com on November 09, 2013 02:45:04

Just forgot to note. Please refer to http://msdn.microsoft.com/en-us/library/47ek66wy(v=vs.110).aspx for more detail about FileStream constructor behaviour.