<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
img {
max-width: 100%;
height: auto;
}
p.details {
font-style:italic;
color:#777
}
.footer p {
font-size:small;
color:#777
}
pre.commit-message {
white-space: pre-wrap;
}
.file-stats a {
text-decoration: none;
}
.file-stats .new-file {
color: #090;
}
.file-stats .deleted-file {
color: #B00;
}
</style>
<body>
<div class='content'>
<h3>Andrew Price pushed to branch master at <a href="https://projects.sucs.org/arthur/mw">Justin Mitchell / mw</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://projects.sucs.org/arthur/mw/commit/07679188dab56cc80227009d6969ee2e7d82ff1b">07679188</a></strong>
<div>
<span>by Andrew Price</span>
<i>at 2015-11-14T16:11:40Z</i>
</div>
<pre class='commit-message'>More SEEK_* usage
That coccinelle script works better without the semicolons (duh):
@rule0@
expression A,B;
@@
- lseek(A, B, 0)
+ lseek(A, B, SEEK_SET)
@rule1@
expression A,B;
@@
- lseek(A, B, 1)
+ lseek(A, B, SEEK_CUR)
@rule2@
expression A,B;
@@
- lseek(A, B, 2)
+ lseek(A, B, SEEK_END)</pre>
</li>
</ul>
<h4>6 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/client/add.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
src/client/edit.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
src/client/mod.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
src/client/new.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-4'>
src/client/newmain.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-5'>
src/client/read.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://projects.sucs.org/arthur/mw/commit/07679188dab56cc80227009d6969ee2e7d82ff1b#diff-0'>
<strong>
src/client/add.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/add.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/add.c
</span><span style="color: #aaaaaa">@@ -159,7 +159,7 @@ int add_msg(int folnum, struct user *user, int replyto)
</span> }
posn=(replyto-(fol->first))*sizeof(struct Header);
<span style="color: #000000;background-color: #ffdddd">- tmppos=lseek(headfile,0,2);
</span><span style="color: #000000;background-color: #ddffdd">+ tmppos=lseek(headfile, 0, SEEK_END);
</span> if (posn<0 || posn>tmppos-sizeof(struct Header))
{
printf(_("There is no message %d\n"),replyto);
<span style="color: #aaaaaa">@@ -178,7 +178,7 @@ int add_msg(int folnum, struct user *user, int replyto)
</span> free(new);
return(0);
}
<span style="color: #000000;background-color: #ffdddd">- replyposn=lseek(headfile,0,1)-sizeof(inreplyto);
</span><span style="color: #000000;background-color: #ddffdd">+ replyposn=lseek(headfile, 0, SEEK_CUR)-sizeof(inreplyto);
</span> close(headfile);
inreplyto.status|=(1<<2);
}
<span style="color: #aaaaaa">@@ -371,7 +371,7 @@ int add_msg(int folnum, struct user *user, int replyto)
</span> free(buff);
return(0);
}
<span style="color: #000000;background-color: #ffdddd">- size=lseek(tfile,0,2);
</span><span style="color: #000000;background-color: #ddffdd">+ size=lseek(tfile, 0, SEEK_END);
</span> lseek(tfile, 0, SEEK_SET);
buff=(char *)realloc(buff,size);
read(tfile,buff,size);
<span style="color: #aaaaaa">@@ -397,7 +397,7 @@ int add_msg(int folnum, struct user *user, int replyto)
</span> Lock_File(i);
Lock_File(data);
<span style="color: #000000;background-color: #ffdddd">- new->datafield=lseek(data,0l,2);
</span><span style="color: #000000;background-color: #ddffdd">+ new->datafield=lseek(data, 0l, SEEK_END);
</span> lseek(folderfile, folnum * sizeof(struct folder), SEEK_SET);
read(folderfile,fol,sizeof(*fol));
lseek(folderfile, -1 * sizeof(struct folder), SEEK_CUR);
<span style="color: #aaaaaa">@@ -416,7 +416,7 @@ int add_msg(int folnum, struct user *user, int replyto)
</span> new->Ref=0;
}
<span style="color: #000000;background-color: #ffdddd">- tt=lseek(i,0,2);
</span><span style="color: #000000;background-color: #ddffdd">+ tt=lseek(i, 0, SEEK_END);
</span> td=tt%sizeof(*new);
if (td>0){
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://projects.sucs.org/arthur/mw/commit/07679188dab56cc80227009d6969ee2e7d82ff1b#diff-1'>
<strong>
src/client/edit.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/edit.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/edit.c
</span><span style="color: #aaaaaa">@@ -865,7 +865,7 @@ void mesg_edit(const char *args, struct folder *folder, int msgno, struct user *
</span> perms_restore();
return;
}
<span style="color: #000000;background-color: #ffdddd">- size=lseek(tfile,0,2);
</span><span style="color: #000000;background-color: #ddffdd">+ size=lseek(tfile, 0, SEEK_END);
</span> lseek(tfile, 0, SEEK_SET);
buff=(char *)realloc(buff,size);
read(tfile,buff,size);
<span style="color: #aaaaaa">@@ -875,7 +875,7 @@ void mesg_edit(const char *args, struct folder *folder, int msgno, struct user *
</span> /* end of setuid stuff */
Lock_File(text);
<span style="color: #000000;background-color: #ffdddd">- head.datafield=lseek(text,0,2);
</span><span style="color: #000000;background-color: #ddffdd">+ head.datafield=lseek(text, 0, SEEK_END);
</span> write(text,buff,size);
Unlock_File(text);
}else
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://projects.sucs.org/arthur/mw/commit/07679188dab56cc80227009d6969ee2e7d82ff1b#diff-2'>
<strong>
src/client/mod.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/mod.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/mod.c
</span><span style="color: #aaaaaa">@@ -30,7 +30,7 @@ static void add_message(struct folder *fold, struct Header *head, char *text)
</span> Lock_File(modindex);
Lock_File(modtext);
head->Ref=fold->last;
<span style="color: #000000;background-color: #ffdddd">- head->datafield=lseek(modtext,0,2);
</span><span style="color: #000000;background-color: #ddffdd">+ head->datafield=lseek(modtext, 0, SEEK_END);
</span> if (write(modindex,head,sizeof(*head))<0) {perror("mod: writehead");}
if (write(modtext,text,head->size)<0) {perror("mod: write text");}
<span style="color: #aaaaaa">@@ -53,7 +53,7 @@ static void put_back(struct folder *fold, struct Header *head, char *text)
</span> exit(-1);
Lock_File(newindex);
Lock_File(newtext);
<span style="color: #000000;background-color: #ffdddd">- head->datafield=lseek(newtext,0,2);
</span><span style="color: #000000;background-color: #ddffdd">+ head->datafield=lseek(newtext, 0, SEEK_END);
</span> head->Ref=0;
write(newindex,head,sizeof(*head));
write(newtext,text,head->size);
</code></pre>
<br>
</li>
<li id='diff-3'>
<a href='https://projects.sucs.org/arthur/mw/commit/07679188dab56cc80227009d6969ee2e7d82ff1b#diff-3'>
<strong>
src/client/new.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/new.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/new.c
</span><span style="color: #aaaaaa">@@ -149,7 +149,7 @@ static int read_new(struct user *user, struct folder *data, int folnum)
</span> if (stringcmp(tmp,"reply",3))
{
long foo;
<span style="color: #000000;background-color: #ffdddd">- foo=lseek(indexfile,0,1);
</span><span style="color: #000000;background-color: #ddffdd">+ foo=lseek(indexfile, 0, SEEK_CUR);
</span> add_msg(folnum, user, head.Ref);
lseek(indexfile, foo, SEEK_SET);
get_folder_number(data,folnum);
</code></pre>
<br>
</li>
<li id='diff-4'>
<a href='https://projects.sucs.org/arthur/mw/commit/07679188dab56cc80227009d6969ee2e7d82ff1b#diff-4'>
<strong>
src/client/newmain.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/newmain.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/newmain.c
</span><span style="color: #aaaaaa">@@ -723,7 +723,7 @@ void c_tidyup(CommandList *cm, int argc, const char **argv, char *args)
</span> textbuff=(char *)malloc(idx.size+1);
lseek(textin, idx.datafield, SEEK_SET);
read(textin,textbuff,idx.size);
<span style="color: #000000;background-color: #ffdddd">- idx.datafield=lseek(textout,0,1);
</span><span style="color: #000000;background-color: #ddffdd">+ idx.datafield=lseek(textout, 0, SEEK_CUR);
</span> write(textout,textbuff,idx.size);
write(indexout,&idx,sizeof(idx));
free(textbuff);
</code></pre>
<br>
</li>
<li id='diff-5'>
<a href='https://projects.sucs.org/arthur/mw/commit/07679188dab56cc80227009d6969ee2e7d82ff1b#diff-5'>
<strong>
src/client/read.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/client/read.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/client/read.c
</span><span style="color: #aaaaaa">@@ -129,7 +129,7 @@ int read_msg(int folnum, int msgnum, struct user *user)
</span> close(headfile);
return false;
}
<span style="color: #000000;background-color: #ffdddd">- tmppos=lseek(headfile,0,2);
</span><span style="color: #000000;background-color: #ddffdd">+ tmppos=lseek(headfile, 0, SEEK_END);
</span> posn=(msgnum - data.last - 1)*sizeof(struct Header);
if (posn < -tmppos)
lseek(headfile, 0, SEEK_SET);
<span style="color: #aaaaaa">@@ -283,7 +283,7 @@ int get_mesg_header(struct folder *data, int msgnum, struct Header *head)
</span> return false;
/* no message - file too small */
<span style="color: #000000;background-color: #ffdddd">- tmppos = lseek(headfile, 0, 2);
</span><span style="color: #000000;background-color: #ddffdd">+ tmppos = lseek(headfile, 0, SEEK_END);
</span>
/* locate to file data */
posn=(msgnum - data->last - 1)*sizeof(struct Header);
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://projects.sucs.org/arthur/mw/commit/07679188dab56cc80227009d6969ee2e7d82ff1b">View it on GitLab</a>
<br>
You're receiving this email because of your account on <a href="https://projects.sucs.org/">projects.sucs.org</a>.
If you'd like to receive fewer emails, you can adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://projects.sucs.org/arthur/mw/commit/07679188dab56cc80227009d6969ee2e7d82ff1b"}}</script>
</p>
</div>
</body>
</html>